Jacek Caban : win32u: Move NtUserGetIconSize implementation from user32.

Alexandre Julliard julliard at winehq.org
Wed Feb 23 16:00:06 CST 2022


Module: wine
Branch: master
Commit: 9e4be5467cca9f8ce9bf2c8c97c6198c113c2641
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9e4be5467cca9f8ce9bf2c8c97c6198c113c2641

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb 23 13:39:47 2022 +0100

win32u: Move NtUserGetIconSize implementation from user32.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/cursoricon.c | 13 +++----------
 dlls/win32u/cursoricon.c | 35 +++++++++++++++++++++++++++++++++++
 dlls/win32u/syscall.c    |  1 +
 dlls/win32u/win32u.spec  |  2 +-
 dlls/wow64win/syscall.h  |  1 +
 dlls/wow64win/user.c     | 10 ++++++++++
 include/ntuser.h         |  1 +
 7 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index e97d4f1e0d9..26c82c2c70c 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -334,16 +334,9 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
  */
 BOOL get_icon_size( HICON handle, SIZE *size )
 {
-    struct cursoricon_object *info;
-    struct cursoricon_frame *frame;
-
-    if (!(info = get_icon_ptr( handle ))) return FALSE;
-    frame = get_icon_frame( info, 0 );
-    size->cx = frame->width;
-    size->cy = frame->height;
-    release_icon_frame( info, frame);
-    release_user_handle_ptr( info );
-    return TRUE;
+    BOOL ret = NtUserGetIconSize( handle, 0, &size->cx, &size->cy );
+    if (ret) size->cy /= 2;
+    return ret;
 }
 
 struct png_wrapper
diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c
index c83f3790c11..f0a9c1b0609 100644
--- a/dlls/win32u/cursoricon.c
+++ b/dlls/win32u/cursoricon.c
@@ -212,6 +212,22 @@ HICON alloc_cursoricon_handle( BOOL is_icon )
     return handle;
 }
 
+static struct cursoricon_object *get_icon_frame_ptr( HICON handle, UINT step )
+{
+    struct cursoricon_object *obj, *ret;
+
+    if (!(obj = get_icon_ptr( handle ))) return NULL;
+    if (!obj->is_ani) return obj;
+    if (step >= obj->ani.num_steps)
+    {
+        release_user_handle_ptr( obj );
+        return NULL;
+    }
+    ret = get_icon_ptr( obj->ani.frames[step] );
+    release_user_handle_ptr( obj );
+    return ret;
+}
+
 static BOOL free_icon_handle( HICON handle )
 {
     struct cursoricon_object *obj = free_user_handle( handle, NTUSER_OBJ_ICON );
@@ -403,3 +419,22 @@ HICON WINAPI NtUserFindExistingCursorIcon( UNICODE_STRING *module, UNICODE_STRIN
     user_unlock();
     return ret;
 }
+
+/***********************************************************************
+ *	     NtUserGetIconSize (win32u.@)
+ */
+BOOL WINAPI NtUserGetIconSize( HICON handle, UINT step, LONG *width, LONG *height )
+{
+    struct cursoricon_object *obj;
+
+    if (!(obj = get_icon_frame_ptr( handle, step )))
+    {
+        SetLastError( ERROR_INVALID_CURSOR_HANDLE );
+        return FALSE;
+    }
+
+    *width  = obj->frame.width;
+    *height = obj->frame.height * 2;
+    release_user_handle_ptr( obj );
+    return TRUE;
+}
diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c
index b4255449b83..54d9d6ea754 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -117,6 +117,7 @@ static void * const syscalls[] =
     NtUserGetDoubleClickTime,
     NtUserGetDpiForMonitor,
     NtUserGetForegroundWindow,
+    NtUserGetIconSize,
     NtUserGetKeyState,
     NtUserGetKeyboardLayout,
     NtUserGetKeyboardLayoutName,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 20ee7a3cebd..dddc3a5b187 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -935,7 +935,7 @@
 @ stub NtUserGetHDevName
 @ stub NtUserGetHimetricScaleFactorFromPixelLocation
 @ stub NtUserGetIconInfo
-@ stub NtUserGetIconSize
+@ stdcall -syscall NtUserGetIconSize(long long ptr ptr)
 @ stub NtUserGetImeHotKey
 @ stub NtUserGetImeInfoEx
 @ stub NtUserGetInputContainerId
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index 0141a216ee9..0908c2db019 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -104,6 +104,7 @@
     SYSCALL_ENTRY( NtUserGetDoubleClickTime ) \
     SYSCALL_ENTRY( NtUserGetDpiForMonitor ) \
     SYSCALL_ENTRY( NtUserGetForegroundWindow ) \
+    SYSCALL_ENTRY( NtUserGetIconSize ) \
     SYSCALL_ENTRY( NtUserGetKeyState ) \
     SYSCALL_ENTRY( NtUserGetKeyboardLayout ) \
     SYSCALL_ENTRY( NtUserGetKeyboardLayoutName ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index cd345429af7..6b50f545948 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -279,6 +279,16 @@ NTSTATUS WINAPI wow64_NtUserFindExistingCursorIcon( UINT *args )
     return HandleToUlong( ret );
 }
 
+NTSTATUS WINAPI wow64_NtUserGetIconSize( UINT *args )
+{
+    HICON handle = get_handle( &args );
+    UINT step = get_ulong( &args );
+    LONG *width = get_ptr( &args );
+    LONG *height = get_ptr( &args );
+
+    return NtUserGetIconSize( handle, step, width, height );
+}
+
 NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
 {
     DWORD from = get_ulong( &args );
diff --git a/include/ntuser.h b/include/ntuser.h
index f385f91f8ce..6c6e6518297 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -204,6 +204,7 @@ LONG    WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path
 UINT    WINAPI NtUserGetDoubleClickTime(void);
 BOOL    WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y );
 HWND    WINAPI NtUserGetForegroundWindow(void);
+BOOL    WINAPI NtUserGetIconSize( HICON handle, UINT step, LONG *width, LONG *height );
 INT     WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
 SHORT   WINAPI NtUserGetKeyState( INT vkey );
 HKL     WINAPI NtUserGetKeyboardLayout( DWORD thread_id );




More information about the wine-cvs mailing list