https://git.reactos.org/?p=reactos.git;a=commitdiff;h=560671a784c1e0e0aa759…
commit 560671a784c1e0e0aa7590df5e0598c1e2f41f5a
Author: Thamatip Chitpong <tangaming123456(a)outlook.com>
AuthorDate: Tue Apr 25 01:11:46 2023 +0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Apr 24 20:11:46 2023 +0200
[NTUSER] Improve MsqPostMessage (#5225)
- MsqPostMessage: Fill Message structure before InsertTailList. For style
consistency.
- MsqPostMessage: Fix the use of MessageQueue variable
---
win32ss/user/ntuser/msgqueue.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c
index a674f806e8a..d35eb38cf9d 100644
--- a/win32ss/user/ntuser/msgqueue.c
+++ b/win32ss/user/ntuser/msgqueue.c
@@ -1344,18 +1344,25 @@ MsqPostMessage(PTHREADINFO pti,
PUSER_MESSAGE Message;
PUSER_MESSAGE_QUEUE MessageQueue;
- if ( pti->TIF_flags & TIF_INCLEANUP || pti->MessageQueue->QF_flags &
QF_INDESTROY )
+ MessageQueue = pti->MessageQueue;
+
+ if ((pti->TIF_flags & TIF_INCLEANUP) || (MessageQueue->QF_flags &
QF_INDESTROY))
{
ERR("Post Msg; Thread or Q is Dead!\n");
return;
}
- if(!(Message = MsqCreateMessage(Msg)))
- {
+ Message = MsqCreateMessage(Msg);
+ if (!Message)
return;
- }
- MessageQueue = pti->MessageQueue;
+ if (Msg->message == WM_HOTKEY)
+ MessageBits |= QS_HOTKEY;
+
+ Message->dwQEvent = dwQEvent;
+ Message->ExtraInfo = ExtraInfo;
+ Message->QS_Flags = MessageBits;
+ Message->pti = pti;
if (!HardwareMessage)
{
@@ -1366,13 +1373,8 @@ MsqPostMessage(PTHREADINFO pti,
InsertTailList(&MessageQueue->HardwareMessagesListHead,
&Message->ListEntry);
}
- if (Msg->message == WM_HOTKEY) MessageBits |= QS_HOTKEY; // Justin Case, just set
it.
- Message->dwQEvent = dwQEvent;
- Message->ExtraInfo = ExtraInfo;
- Message->QS_Flags = MessageBits;
- Message->pti = pti;
MsqWakeQueue(pti, MessageBits, TRUE);
- TRACE("Post Message %d\n",PostMsgCount);
+ TRACE("Post Message %d\n", PostMsgCount);
}
VOID FASTCALL