https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54b3b73c08e5a8b111f17ae00e451f31abad7da9

commit 54b3b73c08e5a8b111f17ae00e451f31abad7da9
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Tue Aug 2 10:47:49 2022 +0900
Commit:     GitHub <[email protected]>
CommitDate: Tue Aug 2 10:47:49 2022 +0900

    [WIN32KNT_APITEST] Add NtUserGetKeyboardLayoutName testcase (#4594)
    
    The type of the 1st argument of NtUserGetKeyboardLayoutName is doubtful.
    CORE-11700
---
 modules/rostests/apitests/win32nt/CMakeLists.txt   |  1 +
 .../win32nt/ntuser/NtUserGetKeyboardLayoutName.c   | 57 ++++++++++++++++++++++
 modules/rostests/apitests/win32nt/testlist.c       |  6 ++-
 3 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/modules/rostests/apitests/win32nt/CMakeLists.txt 
b/modules/rostests/apitests/win32nt/CMakeLists.txt
index 2ff69348a04..7060f79f219 100644
--- a/modules/rostests/apitests/win32nt/CMakeLists.txt
+++ b/modules/rostests/apitests/win32nt/CMakeLists.txt
@@ -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
diff --git 
a/modules/rostests/apitests/win32nt/ntuser/NtUserGetKeyboardLayoutName.c 
b/modules/rostests/apitests/win32nt/ntuser/NtUserGetKeyboardLayoutName.c
new file mode 100644
index 00000000000..ea49ff9de59
--- /dev/null
+++ b/modules/rostests/apitests/win32nt/ntuser/NtUserGetKeyboardLayoutName.c
@@ -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 
<[email protected]>
+ */
+
+#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]);
+}
diff --git a/modules/rostests/apitests/win32nt/testlist.c 
b/modules/rostests/apitests/win32nt/testlist.c
index d58f6b5a5d0..8d2be31fc2c 100644
--- a/modules/rostests/apitests/win32nt/testlist.c
+++ b/modules/rostests/apitests/win32nt/testlist.c
@@ -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 },

Reply via email to