From: "Gabriel Ivăncescu" Subject: [PATCH 2/2] win32u: Return FALSE from ReplyMessage if it was replied already. Message-Id: Date: Thu, 9 Jun 2022 21:40:35 +0300 In-Reply-To: <4ad1711e4f55cc48f4c477348720102d2da2a854.1654799960.git.gabrielopcode@gmail.com> References: <4ad1711e4f55cc48f4c477348720102d2da2a854.1654799960.git.gabrielopcode@gmail.com> Signed-off-by: Gabriel Ivăncescu --- 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; } /*********************************************************************** -- 2.34.1