Commit 6e2ea185 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserInternalGetWindowIcon implementation from user32.

parent a8ed1c94
...@@ -445,7 +445,7 @@ ...@@ -445,7 +445,7 @@
@ stdcall InsertMenuItemA(long long long ptr) @ stdcall InsertMenuItemA(long long long ptr)
@ stdcall InsertMenuItemW(long long long ptr) @ stdcall InsertMenuItemW(long long long ptr)
@ stdcall InsertMenuW(long long long long ptr) @ stdcall InsertMenuW(long long long long ptr)
@ stdcall InternalGetWindowIcon(ptr long) @ stdcall InternalGetWindowIcon(ptr long) NtUserInternalGetWindowIcon
@ stdcall InternalGetWindowText(long ptr long) NtUserInternalGetWindowText @ stdcall InternalGetWindowText(long ptr long) NtUserInternalGetWindowText
@ stdcall IntersectRect(ptr ptr ptr) @ stdcall IntersectRect(ptr ptr ptr)
@ stdcall InvalidateRect(long ptr long) @ stdcall InvalidateRect(long ptr long)
......
...@@ -164,6 +164,13 @@ static NTSTATUS WINAPI User32CopyImage( const struct copy_image_params *params, ...@@ -164,6 +164,13 @@ static NTSTATUS WINAPI User32CopyImage( const struct copy_image_params *params,
return HandleToUlong( ret ); return HandleToUlong( ret );
} }
static NTSTATUS WINAPI User32LoadImage( const struct load_image_params *params, ULONG size )
{
HANDLE ret = LoadImageW( params->hinst, params->name, params->type,
params->dx, params->dy, params->flags );
return HandleToUlong( ret );
}
static NTSTATUS WINAPI User32FreeCachedClipboardData( const struct free_cached_data_params *params, static NTSTATUS WINAPI User32FreeCachedClipboardData( const struct free_cached_data_params *params,
ULONG size ) ULONG size )
{ {
...@@ -193,6 +200,7 @@ static const void *kernel_callback_table[NtUserCallCount] = ...@@ -193,6 +200,7 @@ static const void *kernel_callback_table[NtUserCallCount] =
User32CopyImage, User32CopyImage,
User32FreeCachedClipboardData, User32FreeCachedClipboardData,
User32LoadDriver, User32LoadDriver,
User32LoadImage,
User32RegisterBuiltinClasses, User32RegisterBuiltinClasses,
User32RenderSsynthesizedFormat, User32RenderSsynthesizedFormat,
}; };
......
...@@ -1794,50 +1794,3 @@ BOOL WINAPI SetWindowCompositionAttribute(HWND hwnd, void *data) ...@@ -1794,50 +1794,3 @@ BOOL WINAPI SetWindowCompositionAttribute(HWND hwnd, void *data)
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE; return FALSE;
} }
/***********************************************************************
* InternalGetWindowIcon (USER32.@)
*/
HICON WINAPI InternalGetWindowIcon( HWND hwnd, UINT type )
{
WND *win = WIN_GetPtr( hwnd );
HICON ret;
TRACE( "hwnd %p, type %#x\n", hwnd, type );
if (!win)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{
if (IsWindow( hwnd )) FIXME( "not supported on other process window %p\n", hwnd );
return 0;
}
switch (type)
{
case ICON_BIG:
ret = win->hIcon;
if (!ret) ret = (HICON)GetClassLongPtrW( hwnd, GCLP_HICON );
break;
case ICON_SMALL:
case ICON_SMALL2:
ret = win->hIconSmall ? win->hIconSmall : win->hIconSmall2;
if (!ret) ret = (HICON)GetClassLongPtrW( hwnd, GCLP_HICONSM );
if (!ret) ret = (HICON)GetClassLongPtrW( hwnd, GCLP_HICON );
break;
default:
SetLastError( ERROR_INVALID_PARAMETER );
WIN_ReleasePtr( win );
return 0;
}
if (!ret) ret = LoadIconW( 0, (const WCHAR *)IDI_APPLICATION );
WIN_ReleasePtr( win );
return CopyIcon( ret );
}
...@@ -801,3 +801,24 @@ HANDLE WINAPI CopyImage( HANDLE hwnd, UINT type, INT dx, INT dy, UINT flags ) ...@@ -801,3 +801,24 @@ HANDLE WINAPI CopyImage( HANDLE hwnd, UINT type, INT dx, INT dy, UINT flags )
ret = KeUserModeCallback( NtUserCopyImage, &params, sizeof(params), &ret_ptr, &ret_len ); ret = KeUserModeCallback( NtUserCopyImage, &params, sizeof(params), &ret_ptr, &ret_len );
return UlongToHandle( ret ); return UlongToHandle( ret );
} }
/******************************************************************************
* LoadImage (win32u.so)
*/
HANDLE WINAPI LoadImageW( HINSTANCE hinst, const WCHAR *name, UINT type,
INT dx, INT dy, UINT flags )
{
void *ret_ptr;
ULONG ret_len;
NTSTATUS ret;
struct load_image_params params =
{ .hinst = hinst, .name = name, .type = type, .dx = dx, .dy = dy, .flags = flags };
if (HIWORD(name))
{
ERR( "name %s not supported in Unix modules\n", debugstr_w( name ));
return 0;
}
ret = KeUserModeCallback( NtUserLoadImage, &params, sizeof(params), &ret_ptr, &ret_len );
return UlongToHandle( ret );
}
...@@ -1187,6 +1187,7 @@ static struct unix_funcs unix_funcs = ...@@ -1187,6 +1187,7 @@ static struct unix_funcs unix_funcs =
NtUserGetUpdatedClipboardFormats, NtUserGetUpdatedClipboardFormats,
NtUserGetWindowPlacement, NtUserGetWindowPlacement,
NtUserHideCaret, NtUserHideCaret,
NtUserInternalGetWindowIcon,
NtUserIsClipboardFormatAvailable, NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx, NtUserMapVirtualKeyEx,
NtUserMessageCall, NtUserMessageCall,
......
...@@ -1044,7 +1044,7 @@ ...@@ -1044,7 +1044,7 @@
@ stub NtUserInjectPointerInput @ stub NtUserInjectPointerInput
@ stub NtUserInjectTouchInput @ stub NtUserInjectTouchInput
@ stub NtUserInteractiveControlQueryUsage @ stub NtUserInteractiveControlQueryUsage
@ stub NtUserInternalGetWindowIcon @ stdcall NtUserInternalGetWindowIcon(ptr long)
@ stdcall -syscall NtUserInternalGetWindowText(long ptr long) @ stdcall -syscall NtUserInternalGetWindowText(long ptr long)
@ stub NtUserInternalToUnicode @ stub NtUserInternalToUnicode
@ stub NtUserInvalidateRect @ stub NtUserInvalidateRect
......
...@@ -249,6 +249,7 @@ struct unix_funcs ...@@ -249,6 +249,7 @@ struct unix_funcs
BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size ); BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size );
BOOL (WINAPI *pNtUserGetWindowPlacement)( HWND hwnd, WINDOWPLACEMENT *placement ); BOOL (WINAPI *pNtUserGetWindowPlacement)( HWND hwnd, WINDOWPLACEMENT *placement );
BOOL (WINAPI *pNtUserHideCaret)( HWND hwnd ); BOOL (WINAPI *pNtUserHideCaret)( HWND hwnd );
HICON (WINAPI *pNtUserInternalGetWindowIcon)( HWND hwnd, UINT type );
BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
LRESULT (WINAPI *pNtUserMessageCall)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, LRESULT (WINAPI *pNtUserMessageCall)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
......
...@@ -4555,6 +4555,54 @@ static BOOL set_window_context_help_id( HWND hwnd, DWORD id ) ...@@ -4555,6 +4555,54 @@ static BOOL set_window_context_help_id( HWND hwnd, DWORD id )
} }
/*********************************************************************** /***********************************************************************
* NtUserInternalGetWindowIcon (win32u.@)
*/
HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type )
{
WND *win = get_win_ptr( hwnd );
HICON ret;
TRACE( "hwnd %p, type %#x\n", hwnd, type );
if (!win)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{
if (is_window( hwnd )) FIXME( "not supported on other process window %p\n", hwnd );
return 0;
}
switch (type)
{
case ICON_BIG:
ret = win->hIcon;
if (!ret) ret = (HICON)get_class_long_ptr( hwnd, GCLP_HICON, FALSE );
break;
case ICON_SMALL:
case ICON_SMALL2:
ret = win->hIconSmall ? win->hIconSmall : win->hIconSmall2;
if (!ret) ret = (HICON)get_class_long_ptr( hwnd, GCLP_HICONSM, FALSE );
if (!ret) ret = (HICON)get_class_long_ptr( hwnd, GCLP_HICON, FALSE );
break;
default:
SetLastError( ERROR_INVALID_PARAMETER );
release_win_ptr( win );
return 0;
}
release_win_ptr( win );
if (!ret) ret = LoadImageW( 0, (const WCHAR *)IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_SHARED | LR_DEFAULTSIZE );
return CopyImage( ret, IMAGE_ICON, 0, 0, 0 );
}
/***********************************************************************
* send_destroy_message * send_destroy_message
*/ */
static void send_destroy_message( HWND hwnd ) static void send_destroy_message( HWND hwnd )
......
...@@ -1029,12 +1029,19 @@ BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *ou ...@@ -1029,12 +1029,19 @@ BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *ou
return unix_funcs->pNtUserGetUpdatedClipboardFormats( formats, size, out_size ); return unix_funcs->pNtUserGetUpdatedClipboardFormats( formats, size, out_size );
} }
BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ) BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement )
{ {
if (!unix_funcs) return FALSE; if (!unix_funcs) return FALSE;
return unix_funcs->pNtUserGetWindowPlacement( hwnd, placement ); return unix_funcs->pNtUserGetWindowPlacement( hwnd, placement );
} }
HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type )
{
if (!unix_funcs) return 0;
return unix_funcs->pNtUserInternalGetWindowIcon( hwnd, type );
}
BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ) BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format )
{ {
if (!unix_funcs) return FALSE; if (!unix_funcs) return FALSE;
......
...@@ -35,6 +35,7 @@ enum ...@@ -35,6 +35,7 @@ enum
NtUserCopyImage, NtUserCopyImage,
NtUserFreeCachedClipboardData, NtUserFreeCachedClipboardData,
NtUserLoadDriver, NtUserLoadDriver,
NtUserLoadImage,
NtUserRegisterBuiltinClasses, NtUserRegisterBuiltinClasses,
NtUserRenderSynthesizedFormat, NtUserRenderSynthesizedFormat,
/* win16 hooks */ /* win16 hooks */
...@@ -147,7 +148,7 @@ struct win_hook_params ...@@ -147,7 +148,7 @@ struct win_hook_params
WCHAR module[MAX_PATH]; WCHAR module[MAX_PATH];
}; };
/* NtUserCopyMessage params */ /* NtUserCopyImage params */
struct copy_image_params struct copy_image_params
{ {
HANDLE hwnd; HANDLE hwnd;
...@@ -164,6 +165,17 @@ struct free_cached_data_params ...@@ -164,6 +165,17 @@ struct free_cached_data_params
HANDLE handle; HANDLE handle;
}; };
/* NtUserLoadImage params */
struct load_image_params
{
HINSTANCE hinst;
const WCHAR *name;
UINT type;
INT dx;
INT dy;
UINT flags;
};
/* NtUserRenderSynthesizedFormat params */ /* NtUserRenderSynthesizedFormat params */
struct render_synthesized_format_params struct render_synthesized_format_params
{ {
...@@ -589,6 +601,7 @@ BOOL WINAPI NtUserHideCaret( HWND hwnd ); ...@@ -589,6 +601,7 @@ BOOL WINAPI NtUserHideCaret( HWND hwnd );
NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs *client_procsA, NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const struct user_client_procs *client_procsA,
const struct user_client_procs *client_procsW, const struct user_client_procs *client_procsW,
const void *client_workers, HINSTANCE user_module ); const void *client_workers, HINSTANCE user_module );
HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type );
INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count ); INT WINAPI NtUserInternalGetWindowText( HWND hwnd, WCHAR *text, INT count );
BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ); BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format );
BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id ); BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment