[USER32] Refactoring on LoadKeyboardLayout(W/Ex) (#4601)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Fri, 12 Aug 2022 00:16:18 +0000 (09:16 +0900)
committerGitHub <noreply@github.com>
Fri, 12 Aug 2022 00:16:18 +0000 (09:16 +0900)
- Add IntLoadKeyboardLayout (Win: LoadKeyboardLayoutWorker) helper function.
- Use it in LoadKeyboardLayoutW and LoadKeyboardLayoutEx functions.
CORE-11700

win32ss/user/user32/misc/stubs.c
win32ss/user/user32/windows/input.c

index 8199c02..bb1754b 100644 (file)
@@ -441,15 +441,6 @@ BOOL WINAPI IsServerSideWindow(HWND wnd)
   return FALSE;
 }
 
-/*
- * @unimplemented
- */
-HKL WINAPI LoadKeyboardLayoutEx(DWORD unknown,LPCWSTR pwszKLID,UINT Flags) //1st parameter unknown
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
 /*
  * @unimplemented
  */
index 1de1dc0..dd39699 100644 (file)
@@ -639,11 +639,16 @@ LoadKeyboardLayoutA(LPCSTR pszKLID,
 }
 
 /*
- * @implemented
+ * @unimplemented
  */
-HKL WINAPI
-LoadKeyboardLayoutW(LPCWSTR pwszKLID,
-                    UINT Flags)
+/* Win: LoadKeyboardLayoutWorker */
+HKL APIENTRY
+IntLoadKeyboardLayout(
+    _In_    HKL     hklUnload,
+    _In_z_  LPCWSTR pwszKLID,
+    _In_    LANGID  wLangID,
+    _In_    UINT    Flags,
+    _In_    BOOL    unknown5)
 {
     DWORD dwhkl, dwType, dwSize;
     UNICODE_STRING ustrKbdName;
@@ -712,6 +717,31 @@ LoadKeyboardLayoutW(LPCWSTR pwszKLID,
                                       dwhkl, Flags);
 }
 
+/*
+ * @implemented
+ */
+HKL WINAPI
+LoadKeyboardLayoutW(LPCWSTR pwszKLID,
+                    UINT Flags)
+{
+    TRACE("(%s, 0x%X)", debugstr_w(pwszKLID), Flags);
+    return IntLoadKeyboardLayout(NULL, pwszKLID, 0, Flags, FALSE);
+}
+
+/*
+ * @unimplemented
+ */
+HKL WINAPI
+LoadKeyboardLayoutEx(HKL hklUnload,
+                     LPCWSTR pwszKLID,
+                     UINT Flags)
+{
+    FIXME("(%p, %s, 0x%X)", hklUnload, debugstr_w(pwszKLID), Flags);
+    if (!hklUnload)
+        return NULL;
+    return IntLoadKeyboardLayout(hklUnload, pwszKLID, 0, Flags, FALSE);
+}
+
 /*
  * @implemented
  */