From: Zhiyi Zhang zzhang@codeweavers.com
This is an undocumented behavior needed by React Native apps, based on Nikolay's findings. --- dlls/user32/tests/msg.c | 10 ++++------ dlls/win32u/message.c | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 24be627a78d..696cf41505e 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -16532,18 +16532,18 @@ static void test_nullCallback(void) flush_sequence(); ret = SendMessageCallbackA(hwnd, WM_USER, 0, 0, NULL, 1); ok(ret, "SendMessageCallbackA failed, error %ld.", GetLastError()); - ok_sequence(WmEmptySeq, "WM_USER with NULL callback", TRUE); + ok_sequence(WmEmptySeq, "WM_USER with NULL callback", FALSE); flush_events(); - ok_sequence(WmUserSeq, "WM_USER with NULL callback after flushing events", TRUE); + ok_sequence(WmUserSeq, "WM_USER with NULL callback after flushing events", FALSE);
/* NULL callback and data being 1 with SendMessageCallbackW(). The result suggests that the * message is not directly sent to the window */ flush_sequence(); ret = SendMessageCallbackW(hwnd, WM_USER, 0, 0, NULL, 1); ok(ret, "SendMessageCallbackW failed, error %ld.", GetLastError()); - ok_sequence(WmEmptySeq, "WM_USER with NULL callback", TRUE); + ok_sequence(WmEmptySeq, "WM_USER with NULL callback", FALSE); flush_events(); - ok_sequence(WmUserSeq, "WM_USER with NULL callback after flushing events", TRUE); + ok_sequence(WmUserSeq, "WM_USER with NULL callback after flushing events", FALSE);
/* NULL callback and data being 2 with SendMessageCallbackA() */ flush_sequence(); @@ -16562,7 +16562,6 @@ static void test_nullCallback(void) ret = SendMessageCallbackA(hwnd, WM_USER, 0, 0, NULL, 1); ok(ret, "SendMessageCallbackA failed, error %ld.", GetLastError()); status = GetQueueStatus(QS_ALLINPUT); - todo_wine ok(HIWORD(status) & QS_SENDMESSAGE && LOWORD(status) & QS_SENDMESSAGE, "Got unexpected status %#lx.\n", status);
@@ -16571,7 +16570,6 @@ static void test_nullCallback(void) ret = SendMessageCallbackW(hwnd, WM_USER, 0, 0, NULL, 1); ok(ret, "SendMessageCallbackW failed, error %ld.", GetLastError()); status = GetQueueStatus(QS_ALLINPUT); - todo_wine ok(HIWORD(status) & QS_SENDMESSAGE && LOWORD(status) & QS_SENDMESSAGE, "Got unexpected status %#lx.\n", status);
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 2a824dbdab3..e64e8213f93 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -4189,7 +4189,9 @@ static BOOL process_message( struct send_message_info *info, DWORD_PTR *res_ptr, thread_info->msg_source = msg_source_unavailable; spy_enter_message( SPY_SENDMESSAGE, info->hwnd, info->msg, info->wparam, info->lparam );
- if (info->dest_tid != GetCurrentThreadId()) + if (info->dest_tid != GetCurrentThreadId() || + /* undocumented behavior when callback pointer is NULL and data is 1. See test_nullCallback(). */ + (info->type == MSG_CALLBACK && !info->callback && info->data == 1)) { if (dest_pid != GetCurrentProcessId() && (info->type == MSG_ASCII || info->type == MSG_UNICODE)) info->type = MSG_OTHER_PROCESS;