From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/dllmain.c | 26 ++++++++++++++++++++++++++ dlls/winex11.drv/mouse.c | 25 +++++++++---------------- dlls/winex11.drv/unixlib.h | 10 ++++++++++ 3 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index 7ea07647dc9..705503dc37c 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -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; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index d080ed5458e..adf23d04450 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -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; - - 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; + 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].cursors; + cursors = module_cursors[i]; 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 dc3c74979ca..233a2578b41 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -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 };