Commit 40dbc849 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Use NtUserCallMessage for passing packed winproc result.

parent 484f0283
...@@ -700,7 +700,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa ...@@ -700,7 +700,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
*/ */
BOOL WINAPI ReplyMessage( LRESULT result ) BOOL WINAPI ReplyMessage( LRESULT result )
{ {
return NtUserReplyMessage( result, NULL ); return NtUserReplyMessage( result );
} }
......
...@@ -1236,7 +1236,6 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) ...@@ -1236,7 +1236,6 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
char stack_buffer[128]; char stack_buffer[128];
void *buffer; void *buffer;
LRESULT result; LRESULT result;
MSG msg;
if (size > sizeof(*params)) if (size > sizeof(*params))
{ {
...@@ -1253,13 +1252,11 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) ...@@ -1253,13 +1252,11 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
return 0; return 0;
params->result = &result; params->result = &result;
msg.hwnd = params->hwnd;
msg.message = params->msg;
msg.wParam = params->wparam;
msg.lParam = params->lparam;
dispatch_win_proc_params( params ); dispatch_win_proc_params( params );
NtUserReplyMessage( result, &msg ); NtUserMessageCall( params->hwnd, params->msg, params->wparam, params->lparam,
(void *)result, NtUserWinProcResult, FALSE );
if (buffer != stack_buffer && buffer != params + 1) if (buffer != stack_buffer && buffer != params + 1)
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
} }
......
...@@ -1069,18 +1069,37 @@ static void reply_message( struct received_message_info *info, LRESULT result, M ...@@ -1069,18 +1069,37 @@ static void reply_message( struct received_message_info *info, LRESULT result, M
* *
* Send a reply to a sent message and update thread receive info. * Send a reply to a sent message and update thread receive info.
*/ */
BOOL reply_message_result( LRESULT result, MSG *msg ) BOOL reply_message_result( LRESULT result )
{ {
struct user_thread_info *thread_info = get_user_thread_info(); struct user_thread_info *thread_info = get_user_thread_info();
struct received_message_info *info = thread_info->receive_info; struct received_message_info *info = thread_info->receive_info;
if (!info) return FALSE; if (!info) return FALSE;
reply_message( info, result, msg ); reply_message( info, result, NULL );
if (msg) return TRUE;
{ }
/***********************************************************************
* reply_winproc_result
*
* Send a reply to a sent message and update thread receive info.
*/
static BOOL reply_winproc_result( LRESULT result, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam )
{
struct user_thread_info *thread_info = get_user_thread_info();
struct received_message_info *info = thread_info->receive_info;
MSG msg;
if (!info) return FALSE;
msg.hwnd = hwnd;
msg.message = message;
msg.wParam = wparam;
msg.lParam = lparam;
reply_message( info, result, &msg );
thread_info->receive_info = info->prev; thread_info->receive_info = info->prev;
thread_info->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND; thread_info->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND;
}
return TRUE; return TRUE;
} }
...@@ -1877,7 +1896,8 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, ...@@ -1877,7 +1896,8 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
info.msg.lParam, (info.type != MSG_ASCII), FALSE, info.msg.lParam, (info.type != MSG_ASCII), FALSE,
WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size ); WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size );
if (thread_info->receive_info == &info) if (thread_info->receive_info == &info)
reply_message_result( result, &info.msg ); reply_winproc_result( result, info.msg.hwnd, info.msg.message,
info.msg.wParam, info.msg.lParam );
/* if some PM_QS* flags were specified, only handle sent messages from now on */ /* if some PM_QS* flags were specified, only handle sent messages from now on */
if (HIWORD(flags) && !changed_mask) flags = PM_QS_SENDMESSAGE | LOWORD(flags); if (HIWORD(flags) && !changed_mask) flags = PM_QS_SENDMESSAGE | LOWORD(flags);
...@@ -2965,6 +2985,9 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa ...@@ -2965,6 +2985,9 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
case NtUserClipboardWindowProc: case NtUserClipboardWindowProc:
return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam ); return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam );
case NtUserWinProcResult:
return reply_winproc_result( (LRESULT)result_info, hwnd, msg, wparam, lparam );
case NtUserGetDispatchParams: case NtUserGetDispatchParams:
if (!hwnd) return FALSE; if (!hwnd) return FALSE;
if (init_window_call_params( result_info, hwnd, msg, wparam, lparam, if (init_window_call_params( result_info, hwnd, msg, wparam, lparam,
......
...@@ -5027,6 +5027,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) ...@@ -5027,6 +5027,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case NtUserCallOneParam_MessageBeep: case NtUserCallOneParam_MessageBeep:
return message_beep( arg ); return message_beep( arg );
case NtUserCallOneParam_ReplyMessage:
return reply_message_result( arg );
case NtUserCallOneParam_SetCaretBlinkTime: case NtUserCallOneParam_SetCaretBlinkTime:
return set_caret_blink_time( arg ); return set_caret_blink_time( arg );
...@@ -5063,9 +5066,6 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code ...@@ -5063,9 +5066,6 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
case NtUserCallTwoParam_MonitorFromRect: 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 NtUserCallTwoParam_ReplyMessage:
return reply_message_result( arg1, (MSG *)arg2 );
case NtUserCallTwoParam_SetCaretPos: case NtUserCallTwoParam_SetCaretPos:
return set_caret_pos( arg1, arg2 ); return set_caret_pos( arg1, arg2 );
......
...@@ -300,7 +300,7 @@ extern void track_mouse_menu_bar( HWND hwnd, INT ht, int x, int y ) DECLSPEC_HID ...@@ -300,7 +300,7 @@ extern void track_mouse_menu_bar( HWND hwnd, INT ht, int x, int y ) DECLSPEC_HID
/* message.c */ /* message.c */
extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN; extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN;
extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN; extern BOOL reply_message_result( LRESULT result ) DECLSPEC_HIDDEN;
extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput,
UINT flags ) DECLSPEC_HIDDEN; UINT flags ) DECLSPEC_HIDDEN;
extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam, extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam,
......
...@@ -300,6 +300,7 @@ enum ...@@ -300,6 +300,7 @@ enum
NtUserSpyGetMsgName = 0x3002, NtUserSpyGetMsgName = 0x3002,
NtUserSpyEnter = 0x0303, NtUserSpyEnter = 0x0303,
NtUserSpyExit = 0x0304, NtUserSpyExit = 0x0304,
NtUserWinProcResult = 0x0305,
}; };
/* NtUserThunkedMenuItemInfo codes */ /* NtUserThunkedMenuItemInfo codes */
...@@ -941,6 +942,7 @@ enum ...@@ -941,6 +942,7 @@ enum
NtUserCallOneParam_IsWindowRectFullScreen, NtUserCallOneParam_IsWindowRectFullScreen,
NtUserCallOneParam_MessageBeep, NtUserCallOneParam_MessageBeep,
NtUserCallOneParam_RealizePalette, NtUserCallOneParam_RealizePalette,
NtUserCallOneParam_ReplyMessage,
NtUserCallOneParam_SetCaretBlinkTime, NtUserCallOneParam_SetCaretBlinkTime,
NtUserCallOneParam_SetProcessDefaultLayout, NtUserCallOneParam_SetProcessDefaultLayout,
/* temporary exports */ /* temporary exports */
...@@ -1051,6 +1053,11 @@ static inline UINT NtUserRealizePalette( HDC hdc ) ...@@ -1051,6 +1053,11 @@ static inline UINT NtUserRealizePalette( HDC hdc )
return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette ); return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette );
} }
static inline BOOL NtUserReplyMessage( LRESULT result )
{
return NtUserCallOneParam( result, NtUserCallOneParam_ReplyMessage );
}
static inline UINT NtUserSetProcessDefaultLayout( DWORD layout ) static inline UINT NtUserSetProcessDefaultLayout( DWORD layout )
{ {
return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout ); return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout );
...@@ -1063,7 +1070,6 @@ enum ...@@ -1063,7 +1070,6 @@ enum
NtUserCallTwoParam_GetMonitorInfo, NtUserCallTwoParam_GetMonitorInfo,
NtUserCallTwoParam_GetSystemMetricsForDpi, NtUserCallTwoParam_GetSystemMetricsForDpi,
NtUserCallTwoParam_MonitorFromRect, NtUserCallTwoParam_MonitorFromRect,
NtUserCallTwoParam_ReplyMessage,
NtUserCallTwoParam_SetCaretPos, NtUserCallTwoParam_SetCaretPos,
NtUserCallTwoParam_SetIconParam, NtUserCallTwoParam_SetIconParam,
NtUserCallTwoParam_UnhookWindowsHook, NtUserCallTwoParam_UnhookWindowsHook,
...@@ -1094,11 +1100,6 @@ static inline HMONITOR NtUserMonitorFromRect( const RECT *rect, DWORD flags ) ...@@ -1094,11 +1100,6 @@ static inline HMONITOR NtUserMonitorFromRect( const RECT *rect, DWORD flags )
return UlongToHandle( ret ); return UlongToHandle( ret );
} }
static inline BOOL NtUserReplyMessage( LRESULT result, MSG *msg )
{
return NtUserCallTwoParam( result, (UINT_PTR)msg, NtUserCallTwoParam_ReplyMessage );
}
static inline BOOL NtUserSetCaretPos( int x, int y ) static inline BOOL NtUserSetCaretPos( int x, int y )
{ {
return NtUserCallTwoParam( x, y, NtUserCallTwoParam_SetCaretPos ); return NtUserCallTwoParam( x, y, NtUserCallTwoParam_SetCaretPos );
......
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