Module: wine Branch: master Commit: 439fb2519091c282094d484ecdae98959fe26142 URL: https://source.winehq.org/git/wine.git/?a=commit;h=439fb2519091c282094d484ec...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Feb 24 01:27:36 2022 +0100
win32u: Move get_icon_param and set_icon_param from user32.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/cursoricon.c | 23 ++----------------- dlls/win32u/cursoricon.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/ntuser_private.h | 24 -------------------- dlls/win32u/sysparams.c | 4 ++++ dlls/win32u/win32u_private.h | 2 ++ include/ntuser.h | 2 ++ 6 files changed, 63 insertions(+), 45 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index d0aaceb14a0..cab9fbde32e 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -81,31 +81,12 @@ static void free_icon_frame( struct cursoricon_frame *frame )
ULONG_PTR get_icon_param( HICON handle ) { - ULONG_PTR ret = 0; - struct cursoricon_object *obj = get_user_handle_ptr( handle, NTUSER_OBJ_ICON ); - - if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); - else if (obj) - { - ret = obj->param; - release_user_handle_ptr( obj ); - } - return ret; + return NtUserCallOneParam( HandleToUlong(handle), NtUserGetIconParam ); }
ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) { - ULONG_PTR ret = 0; - struct cursoricon_object *obj = get_user_handle_ptr( handle, NTUSER_OBJ_ICON ); - - if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); - else if (obj) - { - ret = obj->param; - obj->param = param; - release_user_handle_ptr( obj ); - } - return ret; + return NtUserCallTwoParam( HandleToUlong(handle), param, NtUserSetIconParam ); }
diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c index e2c121d6c1e..0249eb3da50 100644 --- a/dlls/win32u/cursoricon.c +++ b/dlls/win32u/cursoricon.c @@ -37,6 +37,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(cursor); WINE_DECLARE_DEBUG_CHANNEL(icon);
+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 */ + UNICODE_STRING module; /* module for icons loaded from resources */ + WCHAR *resname; /* resource name for icons loaded from resources */ + HRSRC rsrc; /* resource for shared icons */ + BOOL is_shared; /* whether this object is shared */ + BOOL is_icon; /* whether icon or cursor */ + BOOL is_ani; /* whether this object is a static cursor or an animated cursor */ + UINT delay; /* delay between this frame and the next (in jiffies) */ + union + { + struct cursoricon_frame frame; /* frame-specific icon data */ + struct + { + UINT num_frames; /* number of frames in the icon/cursor */ + UINT num_steps; /* number of sequence steps in the icon/cursor */ + HICON *frames; /* list of animated cursor frames */ + } ani; + }; +}; + static struct list icon_cache = LIST_INIT( icon_cache );
static struct cursoricon_object *get_icon_ptr( HICON handle ) @@ -733,3 +757,32 @@ failed: release_user_handle_ptr( obj ); return result; } + +ULONG_PTR get_icon_param( HICON handle ) +{ + ULONG_PTR ret = 0; + struct cursoricon_object *obj = get_user_handle_ptr( handle, NTUSER_OBJ_ICON ); + + if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); + else if (obj) + { + ret = obj->param; + release_user_handle_ptr( obj ); + } + return ret; +} + +ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) +{ + ULONG_PTR ret = 0; + struct cursoricon_object *obj = get_user_handle_ptr( handle, NTUSER_OBJ_ICON ); + + if (obj == OBJ_OTHER_PROCESS) WARN( "icon handle %p from other process\n", handle ); + else if (obj) + { + ret = obj->param; + obj->param = param; + release_user_handle_ptr( obj ); + } + return ret; +} diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index db1a08ff102..f79930ba229 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -125,30 +125,6 @@ struct user_key_state_info BYTE state[256]; /* State for each key */ };
-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 */ - UNICODE_STRING module; /* module for icons loaded from resources */ - LPWSTR resname; /* resource name for icons loaded from resources */ - HRSRC rsrc; /* resource for shared icons */ - BOOL is_shared; /* whether this object is shared */ - BOOL is_icon; /* whether icon or cursor */ - BOOL is_ani; /* whether this object is a static cursor or an animated cursor */ - UINT delay; /* delay between this frame and the next (in jiffies) */ - union - { - struct cursoricon_frame frame; /* frame-specific icon data */ - struct - { - UINT num_frames; /* number of frames in the icon/cursor */ - UINT num_steps; /* number of sequence steps in the icon/cursor */ - HICON *frames; /* list of animated cursor frames */ - } ani; - }; -}; - /* cursoricon.c */ HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN;
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 70d310646ef..4eaaceb2892 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4558,6 +4558,8 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) return get_clip_cursor( (RECT *)arg ); case NtUserGetCursorPos: return get_cursor_pos( (POINT *)arg ); + case NtUserGetIconParam: + return get_icon_param( UlongToHandle(arg) ); case NtUserGetSysColor: return get_sys_color( arg ); case NtUserRealizePalette: @@ -4616,6 +4618,8 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code return mirror_window_region( UlongToHandle(arg1), UlongToHandle(arg2) ); case NtUserMonitorFromRect: return HandleToUlong( monitor_from_rect( (const RECT *)arg1, arg2, get_thread_dpi() )); + case NtUserSetIconParam: + return set_icon_param( UlongToHandle(arg1), arg2 ); case NtUserUnhookWindowsHook: return unhook_windows_hook( arg1, (HOOKPROC)arg2 ); /* temporary exports */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 9ff6d3143db..64712a66e12 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -247,6 +247,8 @@ struct unix_funcs /* cursoricon.c */ extern HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN; extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN; +extern ULONG_PTR get_icon_param( HICON handle ) DECLSPEC_HIDDEN; +extern ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) DECLSPEC_HIDDEN;
/* hook.c */ extern BOOL unhook_windows_hook( INT id, HOOKPROC proc ) DECLSPEC_HIDDEN; diff --git a/include/ntuser.h b/include/ntuser.h index ecefd2d68cb..a4184c944d4 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -80,6 +80,7 @@ enum NtUserCreateCursorIcon, NtUserGetClipCursor, NtUserGetCursorPos, + NtUserGetIconParam, NtUserGetPrimaryMonitorRect, NtUserGetSysColor, NtUserGetSysColorBrush, @@ -104,6 +105,7 @@ enum NtUserGetSystemMetricsForDpi, NtUserMirrorRgn, NtUserMonitorFromRect, + NtUserSetIconParam, NtUserUnhookWindowsHook, /* temporary exports */ NtUserAllocHandle,