From: Zhiyi Zhang zzhang@codeweavers.com
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 b954293b5a3..32bae76bf6e 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -5432,7 +5432,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) @@ -5442,7 +5441,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 3ee46f0bfcf..248bfa1daa4 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 ); }