From: Matteo Bruni <mbruni@codeweavers.com> Registry access is unnecessary, the layout name matches the high word of the HKL in those cases. --- dlls/win32u/input.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index da203666549..cf2e106e4dd 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1454,10 +1454,20 @@ BOOL WINAPI NtUserGetKeyboardLayoutName( WCHAR *name ) layout = NtUserGetKeyboardLayout( 0 ); id = HandleToUlong( layout ); - if (HIWORD( id ) == LOWORD( id )) id = LOWORD( id ); + TRACE_(keyboard)("hkl %08x\n", id); + if ((id & 0xf0000000) == 0xf0000000) id &= 0x0fffffff; + else id = HIWORD(id); snprintf( buffer, sizeof(buffer), "%08X", id ); asciiz_to_unicode( name, buffer ); + if ((HandleToUlong( layout ) & 0xf0000000) != 0xf0000000) + { + info->kbd_layout_id = id; + + TRACE_(keyboard)( "ret %s\n", debugstr_w( name ) ); + return TRUE; + } + if ((hkey = reg_open_key( NULL, keyboard_layouts_keyW, sizeof(keyboard_layouts_keyW) ))) { while (!NtEnumerateKey( hkey, i++, KeyNodeInformation, key, @@ -1469,8 +1479,6 @@ BOOL WINAPI NtUserGetKeyboardLayoutName( WCHAR *name ) if (query_reg_ascii_value( subkey, "Layout Id", value, sizeof(buffer) ) && value->Type == REG_SZ) id = 0xf000 | (wcstoul( (const WCHAR *)value->Data, NULL, 16 ) & 0xfff); - else - id = wcstoul( klid, NULL, 16 ); NtClose( subkey ); if (HIWORD( layout ) == id) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10779