From 5e18d7d8234e5d9186e94c58d0ef21bf62d05544 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 29 May 2022 16:13:31 +0200 Subject: [PATCH] winex11: Detect system cursors from cursor module name in create_xcursor_system_cursor. Signed-off-by: Jacek Caban --- dlls/winex11.drv/dllmain.c | 25 ------------------------- dlls/winex11.drv/mouse.c | 26 +++++++++++++++++--------- dlls/winex11.drv/unixlib.h | 10 ---------- 3 files changed, 17 insertions(+), 44 deletions(-) diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index b9bf5efd1e3..b06c955c2a4 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -128,30 +128,6 @@ 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; -} - - static NTSTATUS x11drv_load_icon( UINT id ) { return HandleToUlong( LoadIconW( NULL, UlongToPtr( id ))); @@ -189,7 +165,6 @@ 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, }; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 2ce03c3f12f..9e005881170 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -931,12 +931,16 @@ static const struct system_cursors riched20_cursors[] = { 0 } }; -static const struct system_cursors *module_cursors[] = +static const struct { - user32_cursors, - comctl32_cursors, - ole32_cursors, - riched20_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} } }; struct cursor_font_fallback @@ -1054,6 +1058,7 @@ static int find_fallback_shape( const char *name ) static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) { const struct system_cursors *cursors; + const WCHAR *module; unsigned int i; Cursor cursor = 0; HKEY key; @@ -1094,11 +1099,14 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) } if (info->szResName[0]) goto done; /* only integer resources are supported here */ - i = x11drv_client_func( client_func_is_system_module, info->szModName, - (lstrlenW( info->szModName ) + 1) * sizeof(WCHAR) ); - if (i == system_module_none) goto done; - cursors = module_cursors[i]; + if ((module = wcsrchr( info->szModName, '\\' ))) module++; + else module = info->szModName; + for (i = 0; i < ARRAY_SIZE( module_cursors ); i++) + if (!wcsicmp( module, module_cursors[i].name )) break; + if (i == ARRAY_SIZE( module_cursors )) goto done; + + cursors = module_cursors[i].cursors; for (i = 0; cursors[i].id; i++) if (cursors[i].id == info->wResID) { diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 9be7c18cd12..76cfad88f4d 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -75,15 +75,6 @@ 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 { @@ -108,7 +99,6 @@ 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 };