Commit 1a89cea4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Avoid using kernel32 functions in get_config_key.

parent 30d5a04f
...@@ -422,7 +422,7 @@ static inline DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name, ...@@ -422,7 +422,7 @@ static inline DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
static void setup_options(void) static void setup_options(void)
{ {
static const WCHAR x11driverW[] = {'\\','X','1','1',' ','D','r','i','v','e','r',0}; static const WCHAR x11driverW[] = {'\\','X','1','1',' ','D','r','i','v','e','r',0};
WCHAR buffer[MAX_PATH+16]; WCHAR buffer[MAX_PATH+16], *p, *appname;
HKEY hkey, appkey = 0; HKEY hkey, appkey = 0;
DWORD len; DWORD len;
...@@ -431,18 +431,21 @@ static void setup_options(void) ...@@ -431,18 +431,21 @@ static void setup_options(void)
/* open the app-specific key */ /* open the app-specific key */
len = GetModuleFileNameW( 0, buffer, MAX_PATH ); appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
if ((p = strrchrW( appname, '/' ))) appname = p + 1;
if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
len = lstrlenW( appname );
if (len && len < MAX_PATH) if (len && len < MAX_PATH)
{ {
HKEY tmpkey; HKEY tmpkey;
WCHAR *p, *appname = buffer; int i;
if ((p = strrchrW( appname, '/' ))) appname = p + 1; for (i = 0; appname[i]; i++) buffer[i] = RtlDowncaseUnicodeChar( appname[i] );
if ((p = strrchrW( appname, '\\' ))) appname = p + 1; buffer[i] = 0;
CharLowerW(appname); appname = buffer;
len = WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, NULL, 0, NULL, NULL ); if ((process_name = malloc( len * 3 + 1 )))
if ((process_name = malloc( len ))) ntdll_wcstoumbs( appname, len + 1, process_name, len * 3 + 1, FALSE );
WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, process_name, len, NULL, NULL ); memcpy( appname + i, x11driverW, sizeof(x11driverW) );
strcatW( appname, x11driverW );
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */
if ((tmpkey = open_hkcu_key( "Software\\Wine\\AppDefaults" ))) if ((tmpkey = open_hkcu_key( "Software\\Wine\\AppDefaults" )))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment