Commit 7f64eead authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Introduce inline helpers for NtUserCallOneParam calls.

parent dcca0460
...@@ -2092,7 +2092,7 @@ BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom, ...@@ -2092,7 +2092,7 @@ BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
static UINT WINAPI realize_palette( HDC hdc ) static UINT WINAPI realize_palette( HDC hdc )
{ {
return NtUserCallOneParam( HandleToUlong(hdc), NtUserRealizePalette ); return NtUserRealizePalette( hdc );
} }
/* Pointers to USER implementation of SelectPalette/RealizePalette */ /* Pointers to USER implementation of SelectPalette/RealizePalette */
......
...@@ -2615,7 +2615,7 @@ void register_wow_handlers(void) ...@@ -2615,7 +2615,7 @@ void register_wow_handlers(void)
callback_table[NtUserCallFreeIcon] = User16CallFreeIcon; callback_table[NtUserCallFreeIcon] = User16CallFreeIcon;
callback_table[NtUserThunkLock] = User16ThunkLock; callback_table[NtUserThunkLock] = User16ThunkLock;
NtUserCallOneParam( TRUE, NtUserEnableThunkLock ); NtUserEnableThunkLock( TRUE );
UserRegisterWowHandlers( &handlers16, &wow_handlers32 ); UserRegisterWowHandlers( &handlers16, &wow_handlers32 );
} }
...@@ -353,7 +353,7 @@ HICON get_icon_32( HICON16 icon16 ) ...@@ -353,7 +353,7 @@ HICON get_icon_32( HICON16 icon16 )
/* retrieve the 16-bit counterpart of a 32-bit icon, creating it if needed */ /* retrieve the 16-bit counterpart of a 32-bit icon, creating it if needed */
HICON16 get_icon_16( HICON icon ) HICON16 get_icon_16( HICON icon )
{ {
HICON16 ret = NtUserCallOneParam( HandleToUlong(icon), NtUserGetIconParam ); HICON16 ret = NtUserGetIconParam( icon );
if (!ret) if (!ret)
{ {
......
...@@ -675,7 +675,7 @@ HDC16 WINAPI GetWindowDC16( HWND16 hwnd ) ...@@ -675,7 +675,7 @@ HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc ) INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
{ {
INT16 ret = (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) ); INT16 ret = (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
NtUserCallOneParam( HandleToUlong( HDC_32(hdc) ), NtUserEnableDC ); NtUserEnableDC( HDC_32(hdc) );
return ret; return ret;
} }
......
...@@ -964,7 +964,7 @@ static HICON create_cursoricon_object( struct cursoricon_desc *desc, BOOL is_ico ...@@ -964,7 +964,7 @@ static HICON create_cursoricon_object( struct cursoricon_desc *desc, BOOL is_ico
UNICODE_STRING res_str = { 0 }; UNICODE_STRING res_str = { 0 };
HICON handle; HICON handle;
if (!(handle = UlongToHandle( NtUserCallOneParam( is_icon, NtUserCreateCursorIcon )))) return 0; if (!(handle = NtUserCreateCursorIcon( is_icon ))) return 0;
if (module) LdrGetDllFullName( module, &module_name ); if (module) LdrGetDllFullName( module, &module_name );
...@@ -1610,7 +1610,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon ) ...@@ -1610,7 +1610,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect ) BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect )
{ {
return NtUserCallOneParam( (UINT_PTR)rect, NtUserGetClipCursor ); return NtUserGetClipCursor( rect );
} }
......
...@@ -164,7 +164,7 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, ...@@ -164,7 +164,7 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt ) BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
{ {
return NtUserCallOneParam( (UINT_PTR)pt, NtUserGetCursorPos ); return NtUserGetCursorPos( pt );
} }
......
...@@ -937,7 +937,7 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) ...@@ -937,7 +937,7 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg )
return retval; return retval;
} }
} }
return NtUserCallOneParam( (UINT_PTR)msg, NtUserDispatchMessageA ); return NtUserDispatchMessageA( msg );
} }
...@@ -1315,7 +1315,7 @@ BOOL WINAPI SetMessageQueue( INT size ) ...@@ -1315,7 +1315,7 @@ BOOL WINAPI SetMessageQueue( INT size )
*/ */
BOOL WINAPI MessageBeep( UINT i ) BOOL WINAPI MessageBeep( UINT i )
{ {
return NtUserCallOneParam( i, NtUserMessageBeep ); return NtUserMessageBeep( i );
} }
......
...@@ -444,7 +444,7 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam, ...@@ -444,7 +444,7 @@ BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
*/ */
INT WINAPI GetSystemMetrics( INT index ) INT WINAPI GetSystemMetrics( INT index )
{ {
return NtUserCallOneParam( index, NtUserGetSystemMetrics ); return NtUserGetSystemMetrics( index );
} }
...@@ -486,7 +486,7 @@ BOOL WINAPI SetDoubleClickTime( UINT interval ) ...@@ -486,7 +486,7 @@ BOOL WINAPI SetDoubleClickTime( UINT interval )
*/ */
COLORREF WINAPI DECLSPEC_HOTPATCH GetSysColor( INT index ) COLORREF WINAPI DECLSPEC_HOTPATCH GetSysColor( INT index )
{ {
return NtUserCallOneParam( index, NtUserGetSysColor ); return NtUserGetSysColor( index );
} }
...@@ -505,7 +505,7 @@ DWORD_PTR WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes ...@@ -505,7 +505,7 @@ DWORD_PTR WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes
*/ */
HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index ) HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index )
{ {
return UlongToHandle( NtUserCallOneParam( index, NtUserGetSysColorBrush )); return NtUserGetSysColorBrush( index );
} }
...@@ -514,7 +514,7 @@ HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index ) ...@@ -514,7 +514,7 @@ HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index )
*/ */
HPEN SYSCOLOR_GetPen( INT index ) HPEN SYSCOLOR_GetPen( INT index )
{ {
return UlongToHandle( NtUserCallOneParam( index, NtUserGetSysColorPen )); return NtUserGetSysColorPen( index );
} }
...@@ -523,7 +523,7 @@ HPEN SYSCOLOR_GetPen( INT index ) ...@@ -523,7 +523,7 @@ HPEN SYSCOLOR_GetPen( INT index )
*/ */
HBRUSH SYSCOLOR_Get55AABrush(void) HBRUSH SYSCOLOR_Get55AABrush(void)
{ {
return UlongToHandle( NtUserCallOneParam( COLOR_55AA_BRUSH, NtUserGetSysColorBrush )); return NtUserGetSysColorBrush( COLOR_55AA_BRUSH );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -75,7 +75,7 @@ void USER_CheckNotLock(void) ...@@ -75,7 +75,7 @@ void USER_CheckNotLock(void)
*/ */
UINT WINAPI UserRealizePalette( HDC hdc ) UINT WINAPI UserRealizePalette( HDC hdc )
{ {
return NtUserCallOneParam( HandleToUlong(hdc), NtUserRealizePalette ); return NtUserRealizePalette( hdc );
} }
......
...@@ -867,7 +867,7 @@ LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos ) ...@@ -867,7 +867,7 @@ LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
*/ */
HDWP WINAPI BeginDeferWindowPos( INT count ) HDWP WINAPI BeginDeferWindowPos( INT count )
{ {
return UlongToHandle( NtUserCallOneParam( count, NtUserBeginDeferWindowPos )); return NtUserBeginDeferWindowPos( count );
} }
......
...@@ -4670,41 +4670,57 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) ...@@ -4670,41 +4670,57 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
{ {
switch(code) switch(code)
{ {
case NtUserBeginDeferWindowPos: case NtUserCallOneParam_BeginDeferWindowPos:
return HandleToUlong( begin_defer_window_pos( arg )); return HandleToUlong( begin_defer_window_pos( arg ));
case NtUserCreateCursorIcon:
case NtUserCallOneParam_CreateCursorIcon:
return HandleToUlong( alloc_cursoricon_handle( arg )); return HandleToUlong( alloc_cursoricon_handle( arg ));
case NtUserDispatchMessageA:
case NtUserCallOneParam_DispatchMessageA:
return dispatch_message( (const MSG *)arg, TRUE ); return dispatch_message( (const MSG *)arg, TRUE );
case NtUserEnableDC:
case NtUserCallOneParam_EnableDC:
return set_dce_flags( UlongToHandle(arg), DCHF_ENABLEDC ); return set_dce_flags( UlongToHandle(arg), DCHF_ENABLEDC );
case NtUserEnableThunkLock:
case NtUserCallOneParam_EnableThunkLock:
enable_thunk_lock = arg; enable_thunk_lock = arg;
return 0; return 0;
case NtUserGetClipCursor:
case NtUserCallOneParam_GetClipCursor:
return get_clip_cursor( (RECT *)arg ); return get_clip_cursor( (RECT *)arg );
case NtUserGetCursorPos:
case NtUserCallOneParam_GetCursorPos:
return get_cursor_pos( (POINT *)arg ); return get_cursor_pos( (POINT *)arg );
case NtUserGetIconParam:
case NtUserCallOneParam_GetIconParam:
return get_icon_param( UlongToHandle(arg) ); return get_icon_param( UlongToHandle(arg) );
case NtUserGetSysColor:
case NtUserCallOneParam_GetSysColor:
return get_sys_color( arg ); return get_sys_color( arg );
case NtUserRealizePalette:
case NtUserCallOneParam_RealizePalette:
return realize_palette( UlongToHandle(arg) ); return realize_palette( UlongToHandle(arg) );
case NtUserGetPrimaryMonitorRect:
case NtUserCallOneParam_GetPrimaryMonitorRect:
*(RECT *)arg = get_primary_monitor_rect( 0 ); *(RECT *)arg = get_primary_monitor_rect( 0 );
return 1; return 1;
case NtUserGetSysColorBrush:
case NtUserCallOneParam_GetSysColorBrush:
return HandleToUlong( get_sys_color_brush(arg) ); return HandleToUlong( get_sys_color_brush(arg) );
case NtUserGetSysColorPen:
case NtUserCallOneParam_GetSysColorPen:
return HandleToUlong( get_sys_color_pen(arg) ); return HandleToUlong( get_sys_color_pen(arg) );
case NtUserGetSystemMetrics:
case NtUserCallOneParam_GetSystemMetrics:
return get_system_metrics( arg ); return get_system_metrics( arg );
case NtUserGetVirtualScreenRect:
case NtUserCallOneParam_GetVirtualScreenRect:
*(RECT *)arg = get_virtual_screen_rect( 0 ); *(RECT *)arg = get_virtual_screen_rect( 0 );
return 1; return 1;
case NtUserMessageBeep:
case NtUserCallOneParam_MessageBeep:
return message_beep( arg ); return message_beep( arg );
/* temporary exports */ /* temporary exports */
case NtUserCallHooks: case NtUserCallHooks:
{ {
...@@ -4712,18 +4728,23 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) ...@@ -4712,18 +4728,23 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
return call_hooks( params->id, params->code, params->wparam, params->lparam, return call_hooks( params->id, params->code, params->wparam, params->lparam,
params->next_unicode ); params->next_unicode );
} }
case NtUserFlushWindowSurfaces: case NtUserFlushWindowSurfaces:
flush_window_surfaces( arg ); flush_window_surfaces( arg );
return 0; return 0;
case NtUserGetDeskPattern: case NtUserGetDeskPattern:
return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg ); return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg );
case NtUserGetWinProcPtr: case NtUserGetWinProcPtr:
return (UINT_PTR)get_winproc_ptr( UlongToHandle(arg) ); return (UINT_PTR)get_winproc_ptr( UlongToHandle(arg) );
case NtUserHandleInternalMessage: case NtUserHandleInternalMessage:
{ {
MSG *msg = (MSG *)arg; MSG *msg = (MSG *)arg;
return handle_internal_message( msg->hwnd, msg->message, msg->wParam, msg->lParam ); return handle_internal_message( msg->hwnd, msg->message, msg->wParam, msg->lParam );
} }
case NtUserLock: case NtUserLock:
switch( arg ) switch( arg )
{ {
...@@ -4731,10 +4752,13 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) ...@@ -4731,10 +4752,13 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case 1: user_unlock(); return 0; case 1: user_unlock(); return 0;
default: user_check_not_lock(); return 0; default: user_check_not_lock(); return 0;
} }
case NtUserSetCallbacks: case NtUserSetCallbacks:
return (UINT_PTR)InterlockedExchangePointer( (void **)&user_callbacks, (void *)arg ); return (UINT_PTR)InterlockedExchangePointer( (void **)&user_callbacks, (void *)arg );
case NtUserSpyGetVKeyName: case NtUserSpyGetVKeyName:
return (UINT_PTR)debugstr_vkey_name( arg ); return (UINT_PTR)debugstr_vkey_name( arg );
default: default:
FIXME( "invalid code %u\n", code ); FIXME( "invalid code %u\n", code );
return 0; return 0;
......
...@@ -64,16 +64,12 @@ POINT root_to_virtual_screen(INT x, INT y) ...@@ -64,16 +64,12 @@ POINT root_to_virtual_screen(INT x, INT y)
RECT get_virtual_screen_rect(void) RECT get_virtual_screen_rect(void)
{ {
RECT virtual; return NtUserGetVirtualScreenRect();
NtUserCallOneParam( (UINT_PTR)&virtual, NtUserGetVirtualScreenRect );
return virtual;
} }
RECT get_primary_monitor_rect(void) RECT get_primary_monitor_rect(void)
{ {
RECT primary; return NtUserGetPrimaryMonitorRect();
NtUserCallOneParam( (UINT_PTR)&primary, NtUserGetPrimaryMonitorRect );
return primary;
} }
/* Get the primary monitor rect from the host system */ /* Get the primary monitor rect from the host system */
......
...@@ -131,36 +131,6 @@ struct win_hook_params ...@@ -131,36 +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
/* NtUserCallOneParam codes, not compatible with Windows */
enum
{
NtUserBeginDeferWindowPos,
NtUserCreateCursorIcon,
NtUserDispatchMessageA,
NtUserEnableDC,
NtUserEnableThunkLock,
NtUserGetClipCursor,
NtUserGetCursorPos,
NtUserGetIconParam,
NtUserGetPrimaryMonitorRect,
NtUserGetSysColor,
NtUserGetSysColorBrush,
NtUserGetSysColorPen,
NtUserGetSystemMetrics,
NtUserGetVirtualScreenRect,
NtUserMessageBeep,
NtUserRealizePalette,
/* temporary exports */
NtUserCallHooks,
NtUserFlushWindowSurfaces,
NtUserGetDeskPattern,
NtUserGetWinProcPtr,
NtUserHandleInternalMessage,
NtUserLock,
NtUserSetCallbacks,
NtUserSpyGetVKeyName,
};
/* NtUserCallTwoParam codes, not compatible with Windows */ /* NtUserCallTwoParam codes, not compatible with Windows */
enum enum
{ {
...@@ -696,4 +666,118 @@ static inline BOOL NtUserReleaseCapture(void) ...@@ -696,4 +666,118 @@ static inline BOOL NtUserReleaseCapture(void)
return NtUserCallNoParam( NtUserCallNoParam_ReleaseCapture ); return NtUserCallNoParam( NtUserCallNoParam_ReleaseCapture );
} }
/* NtUserCallOneParam codes, not compatible with Windows */
enum
{
NtUserCallOneParam_BeginDeferWindowPos,
NtUserCallOneParam_CreateCursorIcon,
NtUserCallOneParam_DispatchMessageA,
NtUserCallOneParam_EnableDC,
NtUserCallOneParam_EnableThunkLock,
NtUserCallOneParam_GetClipCursor,
NtUserCallOneParam_GetCursorPos,
NtUserCallOneParam_GetIconParam,
NtUserCallOneParam_GetPrimaryMonitorRect,
NtUserCallOneParam_GetSysColor,
NtUserCallOneParam_GetSysColorBrush,
NtUserCallOneParam_GetSysColorPen,
NtUserCallOneParam_GetSystemMetrics,
NtUserCallOneParam_GetVirtualScreenRect,
NtUserCallOneParam_MessageBeep,
NtUserCallOneParam_RealizePalette,
/* temporary exports */
NtUserCallHooks,
NtUserFlushWindowSurfaces,
NtUserGetDeskPattern,
NtUserGetWinProcPtr,
NtUserHandleInternalMessage,
NtUserLock,
NtUserSetCallbacks,
NtUserSpyGetVKeyName,
};
static inline HDWP NtUserBeginDeferWindowPos( INT count )
{
return UlongToHandle( NtUserCallOneParam( count, NtUserCallOneParam_BeginDeferWindowPos ));
}
static inline HICON NtUserCreateCursorIcon( BOOL is_icon )
{
return UlongToHandle( NtUserCallOneParam( is_icon, NtUserCallOneParam_CreateCursorIcon ));
}
static inline LRESULT NtUserDispatchMessageA( const MSG *msg )
{
return NtUserCallOneParam( (UINT_PTR)msg, NtUserCallOneParam_DispatchMessageA );
}
static inline WORD NtUserEnableDC( HDC hdc )
{
return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_EnableDC );
}
static inline void NtUserEnableThunkLock( BOOL enable )
{
NtUserCallOneParam( enable, NtUserCallOneParam_EnableThunkLock );
}
static inline BOOL NtUserGetClipCursor( RECT *rect )
{
return NtUserCallOneParam( (UINT_PTR)rect, NtUserCallOneParam_GetClipCursor );
}
static inline BOOL NtUserGetCursorPos( POINT *pt )
{
return NtUserCallOneParam( (UINT_PTR)pt, NtUserCallOneParam_GetCursorPos );
}
static inline UINT_PTR NtUserGetIconParam( HICON icon )
{
return NtUserCallOneParam( HandleToUlong(icon), NtUserCallOneParam_GetIconParam );
}
static inline RECT NtUserGetPrimaryMonitorRect(void)
{
RECT primary;
NtUserCallOneParam( (UINT_PTR)&primary, NtUserCallOneParam_GetPrimaryMonitorRect );
return primary;
}
static inline COLORREF NtUserGetSysColor( INT index )
{
return NtUserCallOneParam( index, NtUserCallOneParam_GetSysColor );
}
static inline HBRUSH NtUserGetSysColorBrush( INT index )
{
return UlongToHandle( NtUserCallOneParam( index, NtUserCallOneParam_GetSysColorBrush ));
}
static inline HPEN NtUserGetSysColorPen( INT index )
{
return UlongToHandle( NtUserCallOneParam( index, NtUserCallOneParam_GetSysColorPen ));
}
static inline INT NtUserGetSystemMetrics( INT index )
{
return NtUserCallOneParam( index, NtUserCallOneParam_GetSystemMetrics );
}
static inline RECT NtUserGetVirtualScreenRect(void)
{
RECT virtual;
NtUserCallOneParam( (UINT_PTR)&virtual, NtUserCallOneParam_GetVirtualScreenRect );
return virtual;
}
static inline BOOL NtUserMessageBeep( UINT i )
{
return NtUserCallOneParam( i, NtUserCallOneParam_MessageBeep );
}
static inline UINT NtUserRealizePalette( HDC hdc )
{
return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette );
}
#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