Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/input.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index bf9f5be80a3..0304b7fb49d 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -1107,7 +1107,9 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID) */ BOOL WINAPI GetKeyboardLayoutNameW( WCHAR *name ) { - DWORD tmp; + WCHAR klid[KL_NAMELENGTH], value[5]; + DWORD value_size, tmp, i = 0; + HKEY hkey; HKL layout;
TRACE_(keyboard)( "name %p\n", name ); @@ -1123,6 +1125,24 @@ BOOL WINAPI GetKeyboardLayoutNameW( WCHAR *name ) if (HIWORD( tmp ) == LOWORD( tmp )) tmp = LOWORD( tmp ); swprintf( name, KL_NAMELENGTH, L"%08X", tmp );
+ if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, L"System\CurrentControlSet\Control\Keyboard Layouts", &hkey )) + { + while (!RegEnumKeyW( hkey, i++, klid, ARRAY_SIZE(klid) )) + { + tmp = wcstoul( klid, NULL, 16 ); + value_size = sizeof(value); + if (!RegGetValueW( hkey, klid, L"Layout Id", RRF_RT_REG_SZ, NULL, (void *)&value, &value_size )) + tmp = MAKELONG( LOWORD( tmp ), 0xf000 | (wcstoul( value, NULL, 16 ) & 0xfff) ); + + if (layout == (HKL)(ULONG_PTR)tmp) + { + lstrcpynW( name, klid, KL_NAMELENGTH ); + break; + } + } + RegCloseKey( hkey ); + } + TRACE_(keyboard)( "ret %s\n", debugstr_w( name ) ); return TRUE; }