Rémi Bernon : user32: Read "Layout Id" from registry in LoadKeyboardLayoutW.
Module: wine Branch: master Commit: 3e2b225428137fd425f677ef182204f3d553afab URL: https://source.winehq.org/git/wine.git/?a=commit;h=3e2b225428137fd425f677ef1... Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri May 7 10:29:46 2021 +0200 user32: Read "Layout Id" from registry in LoadKeyboardLayoutW. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/input.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index fc928af6723..5d9bbe14cd6 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -1540,7 +1540,9 @@ BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id) */ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags ) { - DWORD tmp; + WCHAR layout_path[MAX_PATH], value[5]; + DWORD value_size, tmp; + HKEY hkey; HKL layout; FIXME_(keyboard)( "name %s, flags %x, semi-stub!\n", debugstr_w( name ), flags ); @@ -1548,6 +1550,18 @@ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags ) tmp = wcstoul( name, NULL, 16 ); layout = UlongToHandle( tmp ); + wcscpy( layout_path, L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\" ); + wcscat( layout_path, name ); + + 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) ) ); + + RegCloseKey( hkey ); + } + if ((flags & KLF_ACTIVATE) && ActivateKeyboardLayout( layout, 0 )) return layout; /* FIXME: semi-stub: returning default layout */
participants (1)
-
Alexandre Julliard