1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later) 4 * PURPOSE: Test for NtUserGetKeyboardLayoutName 5 * COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8 #include <win32nt.h> 9 #include <pseh/pseh2.h> 10 11 typedef BOOL (APIENTRY *FN_NtUserGetKeyboardLayoutName)(PVOID); 12 13 START_TEST(NtUserGetKeyboardLayoutName) 14 { 15 FN_NtUserGetKeyboardLayoutName fn = (FN_NtUserGetKeyboardLayoutName)NtUserGetKeyboardLayoutName; 16 UNICODE_STRING ustr; 17 WCHAR szBuff[MAX_PATH]; 18 BOOL bHung, ret; 19 20 /* Try NULL */ 21 ok_int(fn(NULL), FALSE); 22 23 /* Try szBuff */ 24 ret = bHung = FALSE; 25 RtlZeroMemory(szBuff, sizeof(szBuff)); 26 _SEH2_TRY 27 { 28 ret = fn(szBuff); 29 } 30 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) 31 { 32 bHung = TRUE; 33 } 34 _SEH2_END; 35 36 ok_int(bHung, FALSE); 37 //ok_int(ret, FALSE); // XP:TRUE, 2k3:FALSE 38 ok(szBuff[0] == 0, "szBuff[0] was %d\n", szBuff[0]); 39 40 /* Try ustr */ 41 RtlZeroMemory(szBuff, sizeof(szBuff)); 42 ustr.Buffer = szBuff; 43 ustr.Length = 0; 44 ustr.MaximumLength = RTL_NUMBER_OF(szBuff) * sizeof(WCHAR); 45 ret = bHung = FALSE; 46 _SEH2_TRY 47 { 48 ret = fn(&ustr); 49 } 50 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) 51 { 52 bHung = TRUE; 53 } 54 _SEH2_END; 55 56 ok_int(bHung, FALSE); 57 ok_int(ret, TRUE); 58 ok(szBuff[0] != 0, "szBuff[0] was %d\n", szBuff[0]); 59 trace("szBuff: %S\n", szBuff); 60 } 61