Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/user32/tests/msg.c | 90 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 2705914..fab3221 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -18521,6 +18521,12 @@ static void test_SendMessage_other_thread(int thread_n) CloseHandle(wnd_event.stop_event); }
+static void CALLBACK msg_callback_nested( HWND hwnd, UINT msg, ULONG_PTR arg, LRESULT result ) +{ + ok( msg == WM_USER + 10, "wrong msg %x\n", msg ); + ok( result == 0, "wrong result %Ix\n", result ); +} + static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) { DWORD flags = InSendMessageEx( NULL ); @@ -18561,6 +18567,80 @@ static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp, ret = ReplyMessage( msg ); ok( !ret, "ReplyMessage succeeded\n" ); break; + case WM_USER + 4: + ok( flags == ISMEX_SEND, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + SendMessageCallbackA( hwnd, WM_USER + 10, 0, 0, msg_callback_nested, 0 ); + flags = InSendMessageEx( NULL ); + ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %lx\n", flags ); + ret = ReplyMessage( msg ); + todo_wine + ok( !ret, "ReplyMessage returned %u\n", ret ); + flags = InSendMessageEx( NULL ); + ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + break; + case WM_USER + 5: + ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + SendMessageA( hwnd, WM_USER + 11, 0, 0 ); + flags = InSendMessageEx( NULL ); + ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags ); + ret = ReplyMessage( msg ); + ok( ret, "ReplyMessage failed err %lu\n", GetLastError() ); + flags = InSendMessageEx( NULL ); + ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + break; + case WM_USER + 6: + ok( flags == ISMEX_CALLBACK, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + SendMessageW( hwnd, WM_USER + 12, 0, 0 ); + flags = InSendMessageEx( NULL ); + ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + ret = ReplyMessage( msg ); + todo_wine + ok( !ret, "ReplyMessage returned %u\n", ret ); + flags = InSendMessageEx( NULL ); + ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + break; + case WM_USER + 7: + ok( flags == ISMEX_NOSEND, "wrong flags %lx\n", flags ); + ok( !InSendMessage(), "InSendMessage returned true\n" ); + SendNotifyMessageW( hwnd, WM_USER + 13, 0, 0 ); + flags = InSendMessageEx( NULL ); + ok( flags == ISMEX_NOSEND, "wrong flags %lx\n", flags ); + ok( !InSendMessage(), "InSendMessage returned true\n" ); + ret = ReplyMessage( msg ); + ok( !ret, "ReplyMessage succeeded\n" ); + break; + + case WM_USER + 10: + ok( flags == ISMEX_SEND, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + ret = ReplyMessage( msg ); + ok( ret, "ReplyMessage failed err %lu\n", GetLastError() ); + break; + case WM_USER + 11: + ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + ret = ReplyMessage( msg ); + ok( ret, "ReplyMessage failed err %lu\n", GetLastError() ); + break; + case WM_USER + 12: + ok( flags == ISMEX_CALLBACK, "wrong flags %lx\n", flags ); + ok( InSendMessage(), "InSendMessage returned false\n" ); + ret = ReplyMessage( msg ); + ok( ret, "ReplyMessage failed err %lu\n", GetLastError() ); + break; + case WM_USER + 13: + ok( flags == ISMEX_NOSEND, "wrong flags %lx\n", flags ); + ok( !InSendMessage(), "InSendMessage returned false\n" ); + ret = ReplyMessage( msg ); + ok( !ret, "ReplyMessage returned %u\n", ret ); + break; }
return DefWindowProcA( hwnd, msg, wp, lp ); @@ -18572,6 +18652,12 @@ static void CALLBACK msg_callback( HWND hwnd, UINT msg, ULONG_PTR arg, LRESULT r ok( result == WM_USER + 2, "wrong result %Ix\n", result ); }
+static void CALLBACK msg_callback2( HWND hwnd, UINT msg, ULONG_PTR arg, LRESULT result ) +{ + ok( msg == WM_USER + 6, "wrong msg %x\n", msg ); + ok( result == WM_USER + 6, "wrong result %Ix\n", result ); +} + static DWORD WINAPI send_message_thread( void *arg ) { HWND win = arg; @@ -18580,6 +18666,10 @@ static DWORD WINAPI send_message_thread( void *arg ) SendNotifyMessageA( win, WM_USER + 1, 0, 0 ); SendMessageCallbackA( win, WM_USER + 2, 0, 0, msg_callback, 0 ); PostMessageA( win, WM_USER + 3, 0, 0 ); + SendMessageA( win, WM_USER + 4, 0, 0 ); + SendNotifyMessageA( win, WM_USER + 5, 0, 0 ); + SendMessageCallbackA( win, WM_USER + 6, 0, 0, msg_callback2, 0 ); + PostMessageA( win, WM_USER + 7, 0, 0 ); PostMessageA( win, WM_QUIT, 0, 0 ); return 0; }
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/user32/tests/msg.c | 2 -- dlls/win32u/message.c | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index fab3221..e1add5e 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -18574,7 +18574,6 @@ static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp, flags = InSendMessageEx( NULL ); ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %lx\n", flags ); ret = ReplyMessage( msg ); - todo_wine ok( !ret, "ReplyMessage returned %u\n", ret ); flags = InSendMessageEx( NULL ); ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %lx\n", flags ); @@ -18600,7 +18599,6 @@ static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp, ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %lx\n", flags ); ok( InSendMessage(), "InSendMessage returned false\n" ); ret = ReplyMessage( msg ); - todo_wine ok( !ret, "ReplyMessage returned %u\n", ret ); flags = InSendMessageEx( NULL ); ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %lx\n", flags ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index b41d252..d717dfb 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1032,14 +1032,14 @@ static void unpack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, * * Send a reply to a sent message. */ -static void reply_message( struct received_message_info *info, LRESULT result, MSG *msg ) +static BOOL reply_message( struct received_message_info *info, LRESULT result, MSG *msg ) { struct packed_message data; int i, replied = info->flags & ISMEX_REPLIED; BOOL remove = msg != NULL;
- if (info->flags & ISMEX_NOTIFY) return; /* notify messages don't get replies */ - if (!remove && replied) return; /* replied already */ + if (info->flags & ISMEX_NOTIFY) return TRUE; /* notify messages don't get replies */ + if (!remove && replied) return FALSE; /* replied already */
memset( &data, 0, sizeof(data) ); info->flags |= ISMEX_REPLIED; @@ -1058,6 +1058,8 @@ static void reply_message( struct received_message_info *info, LRESULT result, M wine_server_call( req ); } SERVER_END_REQ; + + return TRUE; }
/*********************************************************************** @@ -1068,11 +1070,12 @@ static void reply_message( struct received_message_info *info, LRESULT result, M BOOL reply_message_result( LRESULT result, MSG *msg ) { struct received_message_info *info = get_user_thread_info()->receive_info; + BOOL ret;
if (!info) return FALSE; - reply_message( info, result, msg ); + ret = reply_message( info, result, msg ); if (msg) get_user_thread_info()->receive_info = info->prev; - return TRUE; + return ret; }
/***********************************************************************
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116584
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
user32: msg.c:12861: Test failed: message time not advanced: 1655c 1655c msg.c:12862: Test failed: coords not changed: (101 101) (101 101) msg.c:12879: Test failed: message time not advanced: 1655c 1655c msg.c:12880: Test failed: coords not changed: (101 101) (101 101)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116583
Your paranoid android.
=== w10pro64_en_AE_u8 (64 bit report) ===
user32: msg.c:12861: Test failed: message time not advanced: 2e7242 2e7242 msg.c:12862: Test failed: coords not changed: (101 101) (101 101) msg.c:12879: Test failed: message time not advanced: 2e7242 2e7242 msg.c:12880: Test failed: coords not changed: (101 101) (101 101)
=== w10pro64_ar (64 bit report) ===
user32: msg.c:18575: Test failed: wrong flags a msg.c:18580: Test failed: wrong flags a