Rémi Bernon (@rbernon) commented about dlls/win32u/input.c:
- 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) ))) There's also IME layouts to consider, they have 0xe000 high bits (instead of 0xf000 for alt layouts). It looks like they don't have a "Layout Id" value assigned and that GetKeyboardLayoutName returns the HKL with the highest bits kept.
I'm also not sure we should use the HKL high word as KLID if registry keys are missing. The high word seems to be a globally unique counter, while the KLID is supposed to be a per-language monotonic counter with predefined values. If we're missing the registry keys, I'd suggest using completely distinct names as we do already. Something like that should cover both, what do you think? ```suggestion:-14+0 if (!(HIWORD( id ) & 0xf000)) id = HIWORD( id ); snprintf( buffer, sizeof(buffer), "%08X", id ); asciiz_to_unicode( name, buffer ); if ((HIWORD( id ) & 0x1000) && (hkey = reg_open_key( NULL, keyboard_layouts_keyW, sizeof(keyboard_layouts_keyW) ))) ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10779#note_139404