win32u: Move NtUserGetIconSize implementation 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>
This commit is contained in:
Jacek Caban 2022-02-23 13:39:47 +01:00 committed by Alexandre Julliard
parent 744853fd56
commit 9e4be5467c
7 changed files with 52 additions and 11 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -117,6 +117,7 @@ static void * const syscalls[] =
NtUserGetDoubleClickTime,
NtUserGetDpiForMonitor,
NtUserGetForegroundWindow,
NtUserGetIconSize,
NtUserGetKeyState,
NtUserGetKeyboardLayout,
NtUserGetKeyboardLayoutName,

View File

@ -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

View File

@ -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 ) \

View File

@ -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 );

View File

@ -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 );