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