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
*/
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 )
char stack_buffer[128];
void *buffer;
LRESULT result;
MSG msg;
if (size > sizeof(*params))
{
......@@ -1253,13 +1252,11 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
return 0;
params->result = &result;
msg.hwnd = params->hwnd;
msg.message = params->msg;
msg.wParam = params->wparam;
msg.lParam = params->lparam;
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)
HeapFree( GetProcessHeap(), 0, buffer );
}
......
......@@ -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.
*/
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 received_message_info *info = thread_info->receive_info;
if (!info) return FALSE;
reply_message( info, result, msg );
if (msg)
{
reply_message( info, result, NULL );
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->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND;
}
return TRUE;
}
......@@ -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,
WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size );
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 (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
case NtUserClipboardWindowProc:
return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam );
case NtUserWinProcResult:
return reply_winproc_result( (LRESULT)result_info, hwnd, msg, wparam, lparam );
case NtUserGetDispatchParams:
if (!hwnd) return FALSE;
if (init_window_call_params( result_info, hwnd, msg, wparam, lparam,
......
......@@ -5027,6 +5027,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case NtUserCallOneParam_MessageBeep:
return message_beep( arg );
case NtUserCallOneParam_ReplyMessage:
return reply_message_result( arg );
case NtUserCallOneParam_SetCaretBlinkTime:
return set_caret_blink_time( arg );
......@@ -5063,9 +5066,6 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
case NtUserCallTwoParam_MonitorFromRect:
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:
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
/* message.c */
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,
UINT flags ) DECLSPEC_HIDDEN;
extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam,
......
......@@ -300,6 +300,7 @@ enum
NtUserSpyGetMsgName = 0x3002,
NtUserSpyEnter = 0x0303,
NtUserSpyExit = 0x0304,
NtUserWinProcResult = 0x0305,
};
/* NtUserThunkedMenuItemInfo codes */
......@@ -941,6 +942,7 @@ enum
NtUserCallOneParam_IsWindowRectFullScreen,
NtUserCallOneParam_MessageBeep,
NtUserCallOneParam_RealizePalette,
NtUserCallOneParam_ReplyMessage,
NtUserCallOneParam_SetCaretBlinkTime,
NtUserCallOneParam_SetProcessDefaultLayout,
/* temporary exports */
......@@ -1051,6 +1053,11 @@ static inline UINT NtUserRealizePalette( HDC hdc )
return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette );
}
static inline BOOL NtUserReplyMessage( LRESULT result )
{
return NtUserCallOneParam( result, NtUserCallOneParam_ReplyMessage );
}
static inline UINT NtUserSetProcessDefaultLayout( DWORD layout )
{
return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout );
......@@ -1063,7 +1070,6 @@ enum
NtUserCallTwoParam_GetMonitorInfo,
NtUserCallTwoParam_GetSystemMetricsForDpi,
NtUserCallTwoParam_MonitorFromRect,
NtUserCallTwoParam_ReplyMessage,
NtUserCallTwoParam_SetCaretPos,
NtUserCallTwoParam_SetIconParam,
NtUserCallTwoParam_UnhookWindowsHook,
......@@ -1094,11 +1100,6 @@ static inline HMONITOR NtUserMonitorFromRect( const RECT *rect, DWORD flags )
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 )
{
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