winex11: Use unixlib interface for x11drv_is_system_module.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-04 00:45:01 +02:00 committed by Alexandre Julliard
parent 0dcd1eaae5
commit 2f4a338da3
3 changed files with 45 additions and 16 deletions

View File

@ -127,6 +127,30 @@ static NTSTATUS x11drv_clipboard_init( UINT arg )
}
static NTSTATUS WINAPI x11drv_is_system_module( void *arg, ULONG size )
{
HMODULE module;
unsigned int i;
static const WCHAR cursor_modules[][16] =
{
{ 'u','s','e','r','3','2','.','d','l','l',0 },
{ 'c','o','m','c','t','l','3','2','.','d','l','l',0 },
{ 'o','l','e','3','2','.','d','l','l',0 },
{ 'r','i','c','h','e','d','2','0','.','d','l','l',0 }
};
if (!(module = GetModuleHandleW( arg ))) return system_module_none;
for (i = 0; i < ARRAYSIZE(cursor_modules); i++)
{
if (GetModuleHandleW( cursor_modules[i] ) == module) return i;
}
return system_module_none;
}
typedef NTSTATUS (*callback_func)( UINT arg );
static const callback_func callback_funcs[] =
{
@ -157,11 +181,13 @@ static const kernel_callback kernel_callbacks[] =
x11drv_dnd_post_drop,
x11drv_ime_set_composition_string,
x11drv_ime_set_result,
x11drv_is_system_module,
x11drv_systray_change_owner,
};
C_ASSERT( NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func_last );
BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
{
void **callback_table;

View File

@ -930,16 +930,12 @@ static const struct system_cursors riched20_cursors[] =
{ 0 }
};
static const struct
static const struct system_cursors *module_cursors[] =
{
const struct system_cursors *cursors;
WCHAR name[16];
} module_cursors[] =
{
{ user32_cursors, {'u','s','e','r','3','2','.','d','l','l',0} },
{ comctl32_cursors, {'c','o','m','c','t','l','3','2','.','d','l','l',0} },
{ ole32_cursors, {'o','l','e','3','2','.','d','l','l',0} },
{ riched20_cursors, {'r','i','c','h','e','d','2','0','.','d','l','l',0} }
user32_cursors,
comctl32_cursors,
ole32_cursors,
riched20_cursors,
};
struct cursor_font_fallback
@ -1059,7 +1055,6 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
const struct system_cursors *cursors;
unsigned int i;
Cursor cursor = 0;
HMODULE module;
HKEY key;
const char * const *names = NULL;
WCHAR *p, name[MAX_PATH * 2];
@ -1098,13 +1093,11 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
}
if (info->szResName[0]) goto done; /* only integer resources are supported here */
if (!(module = GetModuleHandleW( info->szModName ))) goto done;
i = x11drv_client_func( client_func_is_system_module, info->szModName,
(lstrlenW( info->szModName ) + 1) * sizeof(WCHAR) );
if (i == system_module_none) goto done;
for (i = 0; i < ARRAY_SIZE( module_cursors ); i++)
if (GetModuleHandleW( module_cursors[i].name ) == module) break;
if (i == ARRAY_SIZE( module_cursors )) goto done;
cursors = module_cursors[i].cursors;
cursors = module_cursors[i];
for (i = 0; cursors[i].id; i++)
if (cursors[i].id == info->wResID)
{

View File

@ -66,6 +66,15 @@ struct systray_dock_params
BOOL *layered;
};
enum system_modules
{
system_module_user32,
system_module_comctl32,
system_module_ole32,
system_module_riched20,
system_module_none = 0xffff,
};
/* x11drv_tablet_info params */
struct tablet_info_params
{
@ -90,6 +99,7 @@ enum x11drv_client_funcs
client_func_dnd_post_drop,
client_func_ime_set_composition_string,
client_func_ime_set_result,
client_func_is_system_module,
client_func_systray_change_owner,
client_func_last
};