Commit 824e9bdd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Directly use ntdll for registry access in create_xcursor_system_cursor.

parent a3ebf88a
...@@ -1060,9 +1060,8 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) ...@@ -1060,9 +1060,8 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
HMODULE module; HMODULE module;
HKEY key; HKEY key;
const char * const *names = NULL; const char * const *names = NULL;
WCHAR *p, name[MAX_PATH * 2], valueW[64]; WCHAR *p, name[MAX_PATH * 2];
char valueA[64]; char valueA[64];
DWORD ret;
if (!info->szModName[0]) return 0; if (!info->szModName[0]) return 0;
...@@ -1075,13 +1074,15 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) ...@@ -1075,13 +1074,15 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
valueA[0] = 0; valueA[0] = 0;
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver\Cursors */ /* @@ Wine registry key: HKCU\Software\Wine\X11 Driver\Cursors */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\X11 Driver\\Cursors", &key )) if ((key = open_hkcu_key( "Software\\Wine\\X11 Driver\\Cursors" )))
{ {
DWORD size = sizeof(valueW); char buffer[4096];
ret = RegQueryValueExW( key, name, NULL, NULL, (BYTE *)valueW, &size ); KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer;
RegCloseKey( key ); DWORD size = query_reg_value( key, NULL, value, sizeof(buffer) );
if (!ret) NtClose( key );
if (size && value->Type == REG_SZ)
{ {
const WCHAR *valueW = (const WCHAR *)value->Data;
if (!valueW[0]) return 0; /* force standard cursor */ if (!valueW[0]) return 0; /* force standard cursor */
if (!WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, sizeof(valueA), NULL, NULL )) if (!WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, sizeof(valueA), NULL, NULL ))
valueA[0] = 0; valueA[0] = 0;
......
...@@ -841,6 +841,12 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) ...@@ -841,6 +841,12 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
max( rect->bottom, rect->top + 1 ) > virtual_rect.top); max( rect->bottom, rect->top + 1 ) > virtual_rect.top);
} }
/* registry helpers */
extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
extern ULONG query_reg_value( HKEY hkey, const WCHAR *name,
KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) DECLSPEC_HIDDEN;
/* string helpers */ /* string helpers */
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
......
...@@ -353,7 +353,7 @@ static HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len ) ...@@ -353,7 +353,7 @@ static HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len )
} }
static HKEY open_hkcu_key( const char *name ) HKEY open_hkcu_key( const char *name )
{ {
WCHAR bufferW[256]; WCHAR bufferW[256];
static HKEY hkcu; static HKEY hkcu;
...@@ -385,8 +385,7 @@ static HKEY open_hkcu_key( const char *name ) ...@@ -385,8 +385,7 @@ static HKEY open_hkcu_key( const char *name )
} }
static ULONG query_reg_value( HKEY hkey, const WCHAR *name, ULONG query_reg_value( HKEY hkey, const WCHAR *name, KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size )
KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size )
{ {
unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0; unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0;
UNICODE_STRING nameW = { name_size, name_size, (WCHAR *)name }; UNICODE_STRING nameW = { name_size, name_size, (WCHAR *)name };
......
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