From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user.exe16/message.c | 4 ++-- dlls/win32u/cursoricon.c | 14 +++++++------- dlls/win32u/sysparams.c | 2 +- dlls/win32u/win32u_private.h | 2 +- include/ntuser.h | 8 +++++++- 5 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/dlls/user.exe16/message.c b/dlls/user.exe16/message.c index f88752f832d..227a8c114b0 100644 --- a/dlls/user.exe16/message.c +++ b/dlls/user.exe16/message.c @@ -2585,8 +2585,8 @@ HWND create_window16( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE instance,
static NTSTATUS WINAPI User16CallFreeIcon( void *args, ULONG size ) { - ULONG *param = args; - GlobalFree16( LOWORD(*param) ); + const struct free_icon_params *params = args; + GlobalFree16( LOWORD(params->param) ); return STATUS_SUCCESS; }
diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c index 661ef34c2e0..5f94fb3342e 100644 --- a/dlls/win32u/cursoricon.c +++ b/dlls/win32u/cursoricon.c @@ -41,7 +41,7 @@ struct cursoricon_object { struct user_object obj; /* object header */ struct list entry; /* entry in shared icons list */ - ULONG_PTR param; /* opaque param used by 16-bit code */ + struct free_icon_params params; /* opaque params used by 16-bit code */ UNICODE_STRING module; /* module for icons loaded from resources */ WCHAR *resname; /* resource name for icons loaded from resources */ HRSRC rsrc; /* resource for shared icons */ @@ -179,7 +179,7 @@ static BOOL free_icon_handle( HICON handle ) if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); else if (obj) { - ULONG param = obj->param; + struct free_icon_params params = obj->params; void *ret_ptr; ULONG ret_len; UINT i; @@ -213,7 +213,7 @@ static BOOL free_icon_handle( HICON handle ) } if (!IS_INTRESOURCE( obj->resname )) free( obj->resname ); free( obj ); - if (param) KeUserModeCallback( NtUserCallFreeIcon, ¶m, sizeof(param), &ret_ptr, &ret_len ); + if (params.param) KeUserModeCallback( NtUserCallFreeIcon, ¶ms, sizeof(params), &ret_ptr, &ret_len ); user_driver->pDestroyCursorIcon( handle ); return TRUE; } @@ -685,13 +685,13 @@ ULONG_PTR get_icon_param( HICON handle ) if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); else if (obj) { - ret = obj->param; + ret = obj->params.param; release_user_handle_ptr( obj ); } return ret; }
-ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) +ULONG_PTR set_icon_param( HICON handle, const struct free_icon_params *params ) { ULONG_PTR ret = 0; struct cursoricon_object *obj = get_user_handle_ptr( handle, NTUSER_OBJ_ICON ); @@ -699,8 +699,8 @@ ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); else if (obj) { - ret = obj->param; - obj->param = param; + ret = obj->params.param; + obj->params = *params; release_user_handle_ptr( obj ); } return ret; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 5a1b2e12e40..3cb9c7758cb 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6563,7 +6563,7 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code return set_caret_pos( arg1, arg2 );
case NtUserCallTwoParam_SetIconParam: - return set_icon_param( UlongToHandle(arg1), arg2 ); + return set_icon_param( UlongToHandle(arg1), UlongToHandle(arg2) );
case NtUserCallTwoParam_SetIMECompositionWindowPos: return set_ime_composition_window_pos( UlongToHandle(arg1), (const POINT *)arg2 ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 28801dfd30f..8a84c16208d 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -41,7 +41,7 @@ extern void release_clipboard_owner( HWND hwnd ); extern BOOL process_wine_setcursor( HWND hwnd, HWND window, HCURSOR handle ); extern HICON alloc_cursoricon_handle( BOOL is_icon ); extern ULONG_PTR get_icon_param( HICON handle ); -extern ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ); +extern ULONG_PTR set_icon_param( HICON handle, const struct free_icon_params *params );
/* dce.c */ extern struct window_surface dummy_surface; diff --git a/include/ntuser.h b/include/ntuser.h index adeb56afe79..b132a1027b5 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1094,9 +1094,15 @@ static inline BOOL NtUserSetCaretPos( int x, int y ) return NtUserCallTwoParam( x, y, NtUserCallTwoParam_SetCaretPos ); }
+struct free_icon_params +{ + UINT64 param; +}; + static inline UINT_PTR NtUserSetIconParam( HICON icon, ULONG_PTR param ) { - return NtUserCallTwoParam( HandleToUlong(icon), param, NtUserCallTwoParam_SetIconParam ); + struct free_icon_params params = {.param = param}; + return NtUserCallTwoParam( HandleToUlong(icon), (UINT_PTR)¶ms, NtUserCallTwoParam_SetIconParam ); }
static inline BOOL NtUserUnhookWindowsHook( INT id, HOOKPROC proc )