[PATCH 2/2] win32u: Create an empty registry key for the current keyboard layout.
Zebediah Figura
zfigura at codeweavers.com
Tue Apr 12 20:33:05 CDT 2022
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47439
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/win32u/sysparams.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index c542de61451..81b64d1abf7 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -3117,11 +3117,12 @@ static union sysparam_all_entry * const default_entries[] =
void sysparams_init(void)
{
-
DWORD i, dispos, dpi_scaling;
WCHAR layout[KL_NAMELENGTH];
+ char layoutA[KL_NAMELENGTH];
pthread_mutexattr_t attr;
- HKEY hkey;
+ HKEY layout_key, hkey;
+ unsigned int hkl;
static const WCHAR software_wineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e'};
static const WCHAR temporary_system_parametersW[] =
@@ -3130,17 +3131,31 @@ void sysparams_init(void)
static const WCHAR oneW[] = {'1',0};
static const WCHAR kl_preloadW[] =
{'K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','\\','P','r','e','l','o','a','d'};
+ static const WCHAR keyboard_layoutsW[] = {'K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s'};
pthread_mutexattr_init( &attr );
pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
pthread_mutex_init( &user_mutex, &attr );
pthread_mutexattr_destroy( &attr );
+ hkl = (ULONG_PTR)NtUserGetKeyboardLayout( 0 );
+ if (HIWORD( hkl ) == LOWORD( hkl )) hkl = LOWORD( hkl );
+ sprintf( layoutA, "%08X", hkl );
+ asciiz_to_unicode( layout, layoutA );
+
if ((hkey = reg_create_key( hkcu_key, kl_preloadW, sizeof(kl_preloadW), 0, NULL )))
{
- if (NtUserGetKeyboardLayoutName( layout ))
- set_reg_value( hkey, oneW, REG_SZ, (const BYTE *)layout,
- (lstrlenW(layout) + 1) * sizeof(WCHAR) );
+ set_reg_value( hkey, oneW, REG_SZ, (const BYTE *)layout,
+ (wcslen(layout) + 1) * sizeof(WCHAR) );
+ NtClose( hkey );
+ }
+
+ if (!control_key) control_key = reg_create_key( NULL, control_keyW, sizeof(control_keyW), 0, NULL );
+
+ if ((hkey = reg_create_key( control_key, keyboard_layoutsW, sizeof(keyboard_layoutsW), 0, NULL )))
+ {
+ if ((layout_key = reg_create_key( hkey, layout, wcslen( layout ) * sizeof(WCHAR), 0, NULL )))
+ NtClose( layout_key );
NtClose( hkey );
}
--
2.34.1
More information about the wine-devel
mailing list