[WIN32KNT_APITEST] Add NtUserGetKeyboardLayoutName testcase (#4594)

The type of the 1st argument of NtUserGetKeyboardLayoutName is doubtful.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-08-02 10:47:49 +09:00 committed by GitHub
parent b9ecf4b055
commit 54b3b73c08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 2 deletions

View file

@ -54,6 +54,7 @@ list(APPEND SOURCE
ntuser/NtUserFindExistingCursorIcon.c
ntuser/NtUserGetClassInfo.c
# ntuser/NtUserGetIconInfo.c
ntuser/NtUserGetKeyboardLayoutName.c
ntuser/NtUserGetThreadState.c
ntuser/NtUserGetTitleBarInfo.c
ntuser/NtUserProcessConnect.c

View file

@ -0,0 +1,57 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
* PURPOSE: Test for NtUserGetKeyboardLayoutName
* COPYRIGHT: Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include <win32nt.h>
#include <pseh/pseh2.h>
typedef BOOL (APIENTRY *FN_NtUserGetKeyboardLayoutName)(PVOID);
START_TEST(NtUserGetKeyboardLayoutName)
{
FN_NtUserGetKeyboardLayoutName fn = (FN_NtUserGetKeyboardLayoutName)NtUserGetKeyboardLayoutName;
UNICODE_STRING ustr;
WCHAR szBuff[MAX_PATH];
BOOL bHung;
/* Try NULL */
ok_int(fn(NULL), 0);
/* Try szBuff */
bHung = FALSE;
szBuff[0] = 0;
_SEH2_TRY
{
fn(szBuff);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
bHung = TRUE;
}
_SEH2_END;
ok_int(bHung, FALSE);
ok(szBuff[0] == 0, "szBuff[0] was %d\n", szBuff[0]);
/* Try ustr */
szBuff[0] = 0;
ustr.Buffer = szBuff;
ustr.Length = 0;
ustr.MaximumLength = RTL_NUMBER_OF(szBuff);
bHung = FALSE;
_SEH2_TRY
{
fn(&ustr);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
bHung = TRUE;
}
_SEH2_END;
ok_int(bHung, FALSE);
ok(szBuff[0] != 0, "szBuff[0] was %d\n", szBuff[0]);
}

View file

@ -53,8 +53,9 @@ extern void func_NtUserCreateWindowEx(void);
extern void func_NtUserEnumDisplaySettings(void);
extern void func_NtUserFindExistingCursorIcon(void);
extern void func_NtUserGetClassInfo(void);
extern void func_NtUserGetThreadState(void);
//extern void func_NtUserGetIconInfo(void);
extern void func_NtUserGetKeyboardLayoutName(void);
extern void func_NtUserGetThreadState(void);
extern void func_NtUserGetTitleBarInfo(void);
extern void func_NtUserProcessConnect(void);
extern void func_NtUserRedrawWindow(void);
@ -120,8 +121,9 @@ const struct test winetest_testlist[] =
{ "NtUserEnumDisplaySettings", func_NtUserEnumDisplaySettings },
{ "NtUserFindExistingCursorIcon", func_NtUserFindExistingCursorIcon },
{ "NtUserGetClassInfo", func_NtUserGetClassInfo },
{ "NtUserGetThreadState", func_NtUserGetThreadState },
//{ "NtUserGetIconInfo", func_NtUserGetIconInfo },
{ "NtUserGetKeyboardLayoutName", func_NtUserGetKeyboardLayoutName },
{ "NtUserGetThreadState", func_NtUserGetThreadState },
{ "NtUserGetTitleBarInfo", func_NtUserGetTitleBarInfo },
{ "NtUserProcessConnect", func_NtUserProcessConnect },
{ "NtUserRedrawWindow", func_NtUserRedrawWindow },