From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/input.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 2f4dc06f6ce..a955a633c1b 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -439,7 +439,8 @@ BOOL WINAPI BlockInput(BOOL fBlockIt) HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags ) { WCHAR layout_path[MAX_PATH], value[5]; - DWORD value_size, tmp; + LCID locale = GetUserDefaultLCID(); + DWORD id, value_size, tmp; HKEY hkey; HKL layout;
@@ -448,6 +449,7 @@ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags ) tmp = wcstoul( name, NULL, 16 ); if (HIWORD( tmp )) layout = UlongToHandle( tmp ); else layout = UlongToHandle( MAKELONG( LOWORD( tmp ), LOWORD( tmp ) ) ); + id = LOWORD( tmp );
wcscpy( layout_path, L"System\CurrentControlSet\Control\Keyboard Layouts\" ); wcscat( layout_path, name ); @@ -455,12 +457,15 @@ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags ) if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, layout_path, &hkey )) { value_size = sizeof(value); - if (!RegGetValueW( hkey, NULL, L"Layout Id", RRF_RT_REG_SZ, NULL, (void *)&value, &value_size )) - layout = UlongToHandle( MAKELONG( LOWORD( tmp ), 0xf000 | (wcstoul( value, NULL, 16 ) & 0xfff) ) ); + if (((UINT_PTR)layout >> 28 == 0xe)) /* IME don't have a Layout Id */ + id = HIWORD( layout ); + else if (!RegGetValueW( hkey, NULL, L"Layout Id", RRF_RT_REG_SZ, NULL, (void *)&value, &value_size )) + id = 0xf000 | (wcstoul( value, NULL, 16 ) & 0xfff);
RegCloseKey( hkey ); }
+ layout = UlongToHandle( MAKELONG( locale, id ) ); if ((flags & KLF_ACTIVATE) && NtUserActivateKeyboardLayout( layout, 0 )) return layout;
/* FIXME: semi-stub: returning default layout */