Commit dae11519 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Introduce inline helpers for NtUserCallTwoParam calls.

parent 322ee793
...@@ -300,7 +300,7 @@ static HICON store_icon_32( HICON16 icon16, HICON icon ) ...@@ -300,7 +300,7 @@ static HICON store_icon_32( HICON16 icon16, HICON icon )
{ {
memcpy( &ret, (char *)(ptr + 1) + and_size + xor_size, sizeof(ret) ); memcpy( &ret, (char *)(ptr + 1) + and_size + xor_size, sizeof(ret) );
memcpy( (char *)(ptr + 1) + and_size + xor_size, &icon, sizeof(icon) ); memcpy( (char *)(ptr + 1) + and_size + xor_size, &icon, sizeof(icon) );
NtUserCallTwoParam( HandleToUlong(icon), icon16, NtUserSetIconParam ); NtUserSetIconParam( icon, icon16 );
} }
release_icon_ptr( icon16, ptr ); release_icon_ptr( icon16, ptr );
} }
...@@ -342,7 +342,7 @@ HICON get_icon_32( HICON16 icon16 ) ...@@ -342,7 +342,7 @@ HICON get_icon_32( HICON16 icon16 )
DeleteObject( iinfo.hbmMask ); DeleteObject( iinfo.hbmMask );
DeleteObject( iinfo.hbmColor ); DeleteObject( iinfo.hbmColor );
memcpy( (char *)(ptr + 1) + xor_size + and_size, &ret, sizeof(ret) ); memcpy( (char *)(ptr + 1) + xor_size + and_size, &ret, sizeof(ret) );
NtUserCallTwoParam( HandleToUlong(ret), icon16, NtUserSetIconParam ); NtUserSetIconParam( ret, icon16 );
} }
} }
release_icon_ptr( icon16, ptr ); release_icon_ptr( icon16, ptr );
......
...@@ -379,7 +379,7 @@ HHOOK WINAPI SetWindowsHookExW( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid ...@@ -379,7 +379,7 @@ HHOOK WINAPI SetWindowsHookExW( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid
*/ */
BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc ) BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc )
{ {
return NtUserCallTwoParam( id, (UINT_PTR)proc, NtUserUnhookWindowsHook ); return NtUserUnhookWindowsHook( id, proc );
} }
......
...@@ -694,7 +694,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa ...@@ -694,7 +694,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
*/ */
BOOL WINAPI ReplyMessage( LRESULT result ) BOOL WINAPI ReplyMessage( LRESULT result )
{ {
return NtUserCallTwoParam( result, 0, NtUserReplyMessage ); return NtUserReplyMessage( result, NULL );
} }
......
...@@ -453,7 +453,7 @@ INT WINAPI GetSystemMetrics( INT index ) ...@@ -453,7 +453,7 @@ INT WINAPI GetSystemMetrics( INT index )
*/ */
INT WINAPI GetSystemMetricsForDpi( INT index, UINT dpi ) INT WINAPI GetSystemMetricsForDpi( INT index, UINT dpi )
{ {
return NtUserCallTwoParam( index, dpi, NtUserGetSystemMetricsForDpi ); return NtUserGetSystemMetricsForDpi( index, dpi );
} }
...@@ -994,7 +994,7 @@ BOOL WINAPI PhysicalToLogicalPointForPerMonitorDPI( HWND hwnd, POINT *pt ) ...@@ -994,7 +994,7 @@ BOOL WINAPI PhysicalToLogicalPointForPerMonitorDPI( HWND hwnd, POINT *pt )
*/ */
HMONITOR WINAPI MonitorFromRect( const RECT *rect, DWORD flags ) HMONITOR WINAPI MonitorFromRect( const RECT *rect, DWORD flags )
{ {
return UlongToHandle( NtUserCallTwoParam( (LONG_PTR)rect, flags, NtUserMonitorFromRect )); return NtUserMonitorFromRect( rect, flags );
} }
/*********************************************************************** /***********************************************************************
...@@ -1045,7 +1045,7 @@ BOOL WINAPI GetMonitorInfoA( HMONITOR monitor, LPMONITORINFO info ) ...@@ -1045,7 +1045,7 @@ BOOL WINAPI GetMonitorInfoA( HMONITOR monitor, LPMONITORINFO info )
*/ */
BOOL WINAPI GetMonitorInfoW( HMONITOR monitor, LPMONITORINFO info ) BOOL WINAPI GetMonitorInfoW( HMONITOR monitor, LPMONITORINFO info )
{ {
return NtUserCallTwoParam( HandleToUlong(monitor), (ULONG_PTR)info, NtUserGetMonitorInfo ); return NtUserGetMonitorInfo( monitor, info );
} }
#ifdef __i386__ #ifdef __i386__
......
...@@ -1268,7 +1268,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) ...@@ -1268,7 +1268,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
msg.lParam = params->lparam; msg.lParam = params->lparam;
dispatch_win_proc_params( params ); dispatch_win_proc_params( params );
NtUserCallTwoParam( result, (UINT_PTR)&msg, NtUserReplyMessage ); NtUserReplyMessage( result, &msg );
if (buffer != stack_buffer && buffer != params + 1) if (buffer != stack_buffer && buffer != params + 1)
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
} }
......
...@@ -4762,23 +4762,31 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code ...@@ -4762,23 +4762,31 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
{ {
switch(code) switch(code)
{ {
case NtUserGetMonitorInfo: case NtUserCallTwoParam_GetMonitorInfo:
return get_monitor_info( UlongToHandle(arg1), (MONITORINFO *)arg2 ); return get_monitor_info( UlongToHandle(arg1), (MONITORINFO *)arg2 );
case NtUserGetSystemMetricsForDpi:
case NtUserCallTwoParam_GetSystemMetricsForDpi:
return get_system_metrics_for_dpi( arg1, arg2 ); return get_system_metrics_for_dpi( arg1, arg2 );
case NtUserMonitorFromRect:
case NtUserCallTwoParam_MonitorFromRect:
return HandleToUlong( monitor_from_rect( (const RECT *)arg1, arg2, get_thread_dpi() )); return HandleToUlong( monitor_from_rect( (const RECT *)arg1, arg2, get_thread_dpi() ));
case NtUserReplyMessage:
case NtUserCallTwoParam_ReplyMessage:
return reply_message_result( arg1, (MSG *)arg2 ); return reply_message_result( arg1, (MSG *)arg2 );
case NtUserSetIconParam:
case NtUserCallTwoParam_SetIconParam:
return set_icon_param( UlongToHandle(arg1), arg2 ); return set_icon_param( UlongToHandle(arg1), arg2 );
case NtUserUnhookWindowsHook:
case NtUserCallTwoParam_UnhookWindowsHook:
return unhook_windows_hook( arg1, (HOOKPROC)arg2 ); return unhook_windows_hook( arg1, (HOOKPROC)arg2 );
/* temporary exports */ /* temporary exports */
case NtUserAllocWinProc: case NtUserAllocWinProc:
return (UINT_PTR)alloc_winproc( (WNDPROC)arg1, arg2 ); return (UINT_PTR)alloc_winproc( (WNDPROC)arg1, arg2 );
case NtUserGetHandlePtr: case NtUserGetHandlePtr:
return (UINT_PTR)get_user_handle_ptr( UlongToHandle(arg1), arg2 ); return (UINT_PTR)get_user_handle_ptr( UlongToHandle(arg1), arg2 );
default: default:
FIXME( "invalid code %u\n", code ); FIXME( "invalid code %u\n", code );
return 0; return 0;
......
...@@ -131,20 +131,6 @@ struct win_hook_params ...@@ -131,20 +131,6 @@ struct win_hook_params
#define NTUSER_DPI_PER_MONITOR_AWARE_V2 0x00000022 #define NTUSER_DPI_PER_MONITOR_AWARE_V2 0x00000022
#define NTUSER_DPI_PER_UNAWARE_GDISCALED 0x40006010 #define NTUSER_DPI_PER_UNAWARE_GDISCALED 0x40006010
/* NtUserCallTwoParam codes, not compatible with Windows */
enum
{
NtUserGetMonitorInfo,
NtUserGetSystemMetricsForDpi,
NtUserMonitorFromRect,
NtUserReplyMessage,
NtUserSetIconParam,
NtUserUnhookWindowsHook,
/* temporary exports */
NtUserAllocWinProc,
NtUserGetHandlePtr,
};
/* NtUserCallHwnd codes, not compatible with Windows */ /* NtUserCallHwnd codes, not compatible with Windows */
enum enum
{ {
...@@ -778,4 +764,50 @@ static inline UINT NtUserRealizePalette( HDC hdc ) ...@@ -778,4 +764,50 @@ static inline UINT NtUserRealizePalette( HDC hdc )
return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette ); return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette );
} }
/* NtUserCallTwoParam codes, not compatible with Windows */
enum
{
NtUserCallTwoParam_GetMonitorInfo,
NtUserCallTwoParam_GetSystemMetricsForDpi,
NtUserCallTwoParam_MonitorFromRect,
NtUserCallTwoParam_ReplyMessage,
NtUserCallTwoParam_SetIconParam,
NtUserCallTwoParam_UnhookWindowsHook,
/* temporary exports */
NtUserAllocWinProc,
NtUserGetHandlePtr,
};
static inline BOOL NtUserGetMonitorInfo( HMONITOR monitor, MONITORINFO *info )
{
return NtUserCallTwoParam( HandleToUlong(monitor), (ULONG_PTR)info,
NtUserCallTwoParam_GetMonitorInfo );
}
static inline INT NtUserGetSystemMetricsForDpi( INT index, UINT dpi )
{
return NtUserCallTwoParam( index, dpi, NtUserCallTwoParam_GetSystemMetricsForDpi );
}
static inline HMONITOR NtUserMonitorFromRect( const RECT *rect, DWORD flags )
{
ULONG ret = NtUserCallTwoParam( (LONG_PTR)rect, flags, NtUserCallTwoParam_MonitorFromRect );
return UlongToHandle( ret );
}
static inline BOOL NtUserReplyMessage( LRESULT result, MSG *msg )
{
return NtUserCallTwoParam( result, (UINT_PTR)msg, NtUserCallTwoParam_ReplyMessage );
}
static inline UINT_PTR NtUserSetIconParam( HICON icon, ULONG_PTR param )
{
return NtUserCallTwoParam( HandleToUlong(icon), param, NtUserCallTwoParam_SetIconParam );
}
static inline BOOL NtUserUnhookWindowsHook( INT id, HOOKPROC proc )
{
return NtUserCallTwoParam( id, (UINT_PTR)proc, NtUserCallTwoParam_UnhookWindowsHook );
}
#endif /* _NTUSER_ */ #endif /* _NTUSER_ */
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