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 )
HMODULE module;
HKEY key;
const char * const *names = NULL;
WCHAR *p, name[MAX_PATH * 2], valueW[64];
WCHAR *p, name[MAX_PATH * 2];
char valueA[64];
DWORD ret;
if (!info->szModName[0]) return 0;
......@@ -1075,13 +1074,15 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
valueA[0] = 0;
/* @@ 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);
ret = RegQueryValueExW( key, name, NULL, NULL, (BYTE *)valueW, &size );
RegCloseKey( key );
if (!ret)
char buffer[4096];
KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer;
DWORD size = query_reg_value( key, NULL, value, sizeof(buffer) );
NtClose( key );
if (size && value->Type == REG_SZ)
{
const WCHAR *valueW = (const WCHAR *)value->Data;
if (!valueW[0]) return 0; /* force standard cursor */
if (!WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, sizeof(valueA), NULL, NULL ))
valueA[0] = 0;
......
......@@ -841,6 +841,12 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
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 */
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 )
}
static HKEY open_hkcu_key( const char *name )
HKEY open_hkcu_key( const char *name )
{
WCHAR bufferW[256];
static HKEY hkcu;
......@@ -385,8 +385,7 @@ static HKEY open_hkcu_key( const char *name )
}
static ULONG query_reg_value( HKEY hkey, const WCHAR *name,
KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size )
ULONG query_reg_value( HKEY hkey, const WCHAR *name, KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size )
{
unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0;
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