Module: wine
Branch: master
Commit: 28a829a1da93af950def9fd6f56c24a567a190a7
URL: https://gitlab.winehq.org/wine/wine/-/commit/28a829a1da93af950def9fd6f56c24…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com>
Date: Thu Jan 18 19:56:49 2024 +0800
win32u: Don't set the high word of keyboard layout to 0xe001 in CJK locales.
The high word of the keyboard layout in CJK locale on Vista+ is the same as the low word, even when
IME is on according to tests in user32 and manual tests on Windows 10.
Fix Super Robo Wars 30 (SteamID: 898750) crash on start when CJK locales are used.
---
dlls/user32/input.c | 15 +--------------
dlls/user32/tests/input.c | 2 --
dlls/win32u/input.c | 15 +--------------
3 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 8f3cd8acae7..1fff29c7f87 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -38,7 +38,6 @@ WINE_DECLARE_DEBUG_CHANNEL(keyboard);
static HKL get_locale_kbd_layout(void)
{
ULONG_PTR layout;
- LANGID langid;
/* FIXME:
*
@@ -52,19 +51,7 @@ static HKL get_locale_kbd_layout(void)
*/
layout = GetUserDefaultLCID();
-
- /*
- * Microsoft Office expects this value to be something specific
- * for Japanese and Korean Windows with an IME the value is 0xe001
- * We should probably check to see if an IME exists and if so then
- * set this word properly.
- */
- langid = PRIMARYLANGID( LANGIDFROMLCID( layout ) );
- if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
- layout = MAKELONG( layout, 0xe001 ); /* IME */
- else
- layout = MAKELONG( layout, layout );
-
+ layout = MAKELONG( layout, layout );
return (HKL)layout;
}
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 5bc1003f644..2e66b084d6a 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -5248,7 +5248,6 @@ static void test_keyboard_layout(void)
if (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN)
{
hkl = GetKeyboardLayout(0);
- todo_wine
ok(HIWORD(hkl) == LOWORD(hkl), "Got unexpected hkl %p.\n", hkl);
if (lang_id == LANG_CHINESE)
@@ -5258,7 +5257,6 @@ static void test_keyboard_layout(void)
else if (lang_id == LANG_KOREAN)
layout_name = "00000412";
hkl = LoadKeyboardLayoutA(layout_name, 0);
- todo_wine
ok(HIWORD(hkl) == LOWORD(hkl), "Got unexpected hkl %p.\n", hkl);
}
}
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index aaaac12ce36..ef8d564c264 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -913,7 +913,6 @@ DWORD get_input_state(void)
static HKL get_locale_kbd_layout(void)
{
LCID layout;
- LANGID langid;
/* FIXME:
*
@@ -927,19 +926,7 @@ static HKL get_locale_kbd_layout(void)
*/
NtQueryDefaultLocale( TRUE, &layout );
-
- /*
- * Microsoft Office expects this value to be something specific
- * for Japanese and Korean Windows with an IME the value is 0xe001
- * We should probably check to see if an IME exists and if so then
- * set this word properly.
- */
- langid = PRIMARYLANGID( LANGIDFROMLCID( layout ) );
- if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
- layout = MAKELONG( layout, 0xe001 ); /* IME */
- else
- layout = MAKELONG( layout, layout );
-
+ layout = MAKELONG( layout, layout );
return ULongToHandle( layout );
}