From b99778a531ed3dc2c5bb069d9351b0979c08414f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 4 Apr 2022 16:59:02 +0200 Subject: [PATCH] win32u: Move SendMessageCallbackW implementation from user32. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/message.c | 20 ++------------------ dlls/win32u/message.c | 27 +++++++++++++++++++++++++++ dlls/win32u/tests/win32u.c | 1 - 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index cdf84523be0..00a2a89e08a 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2296,24 +2296,8 @@ BOOL WINAPI SendMessageCallbackA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, SENDASYNCPROC callback, ULONG_PTR data ) { - struct send_message_info info; - - if (is_pointer_message( msg, wparam )) - { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); - return FALSE; - } - - info.type = MSG_CALLBACK; - info.hwnd = hwnd; - info.msg = msg; - info.wparam = wparam; - info.lparam = lparam; - info.callback = callback; - info.data = data; - info.flags = 0; - - return send_message( &info, NULL, TRUE ); + struct send_message_callback_params params = { .callback = callback, .data = data }; + return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, FNID_SENDMESSAGECALLBACK, FALSE ); } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index a8db3016358..67008dcd2b5 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2372,6 +2372,31 @@ static BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar return process_message( &info, NULL, ansi ); } +/* see SendMessageCallbackW */ +static BOOL send_message_callback( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, + const struct send_message_callback_params *params, BOOL ansi ) +{ + struct send_message_info info; + + if (is_pointer_message( msg, wparam )) + { + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + return FALSE; + } + + info.type = MSG_CALLBACK; + info.hwnd = hwnd; + info.msg = msg; + info.wparam = wparam; + info.lparam = lparam; + info.callback = params->callback; + info.data = params->data; + info.flags = 0; + info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + + return process_message( &info, NULL, ansi ); +} + /*********************************************************************** * NtUserPostMessage (win32u.@) */ @@ -2402,6 +2427,8 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa } case FNID_SENDNOTIFYMESSAGE: return send_notify_message( hwnd, msg, wparam, lparam, ansi ); + case FNID_SENDMESSAGECALLBACK: + return send_message_callback( hwnd, msg, wparam, lparam, (void *)result_info, ansi ); case FNID_SPYENTER: spy_enter_message( ansi, hwnd, msg, wparam, lparam ); return 0; diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index e93ad416d2b..a463b6269a6 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -466,7 +466,6 @@ static void test_message_call(void) res = NtUserMessageCall( hwnd, WM_USER, 1, 2, &callback_params, FNID_SENDMESSAGECALLBACK, FALSE ); - todo_wine ok( res == 1, "res = %Iu\n", res ); DestroyWindow( hwnd ); -- 2.11.4.GIT