diff --git a/reactos/win32ss/user/ntuser/message.c b/reactos/win32ss/user/ntuser/message.c index 44b1cc38f49..90ec8365c98 100644 --- a/reactos/win32ss/user/ntuser/message.c +++ b/reactos/win32ss/user/ntuser/message.c @@ -848,8 +848,8 @@ co_IntPeekMessage( PMSG Msg, return TRUE; } - /* Now look for a quit message. */ - if (pti->QuitPosted) + /* Only check for quit messages if not posted messages pending. */ + if (ProcessMask & QS_POSTMESSAGE && pti->QuitPosted) { /* According to the PSDK, WM_QUIT messages are always returned, regardless of the filter specified */ @@ -1222,14 +1222,7 @@ UserPostMessage( HWND Wnd, Message.lParam = lParam; } - if (WM_QUIT == Msg) - { - MsqPostQuitMessage(pti, wParam); - } - else - { - MsqPostMessage(pti, &Message, FALSE, QS_POSTMESSAGE, 0, ExtraInfo); - } + MsqPostMessage(pti, &Message, FALSE, QS_POSTMESSAGE, 0, ExtraInfo); } return TRUE; } diff --git a/reactos/win32ss/user/ntuser/msgqueue.c b/reactos/win32ss/user/ntuser/msgqueue.c index 6f4141cdc1a..2b6a3ab08de 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.c +++ b/reactos/win32ss/user/ntuser/msgqueue.c @@ -932,6 +932,11 @@ MsqRemoveWindowMessagesFromQueue(PWND Window) ListEntry); if (PostedMessage->Msg.hwnd == Window->head.h) { + if (PostedMessage->Msg.message == WM_QUIT && pti->QuitPosted == 0) + { + pti->QuitPosted = 1; + pti->exitCode = PostedMessage->Msg.wParam; + } RemoveEntryList(&PostedMessage->ListEntry); ClearMsgBitsMask(pti, PostedMessage->QS_Flags); MsqDestroyMessage(PostedMessage);