https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d4c0b87b1eccecbdd220ef9dea6512bbeb2fcd8

commit 2d4c0b87b1eccecbdd220ef9dea6512bbeb2fcd8
Author:     Timo Kreuzer <timo.kreu...@reactos.org>
AuthorDate: Tue Dec 10 17:26:00 2024 +0200
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Sun Dec 22 10:19:01 2024 +0200

    [WIN32K:NTUSER] Check for NULL desktop window in co_IntProcessMouseMessage
---
 win32ss/user/ntuser/msgqueue.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c
index 3a8b60704ff..13a3a106d7d 100644
--- a/win32ss/user/ntuser/msgqueue.c
+++ b/win32ss/user/ntuser/msgqueue.c
@@ -1487,6 +1487,12 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* 
RemoveMessages, BOOL* NotForUs, L
 
     pti = PsGetCurrentThreadWin32Thread();
     pwndDesktop = UserGetDesktopWindow();
+    if (pwndDesktop == NULL)
+    {
+        ERR("No desktop window!\n");
+        return FALSE;
+    }
+
     MessageQueue = pti->MessageQueue;
     CurInfo = IntGetSysCursorInfo();
     pwndMsg = ValidateHwndNoErr(msg->hwnd);
@@ -2001,7 +2007,7 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
 
          UpdateKeyStateFromMsg(MessageQueue, &msg);
          AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, 
&NotForUs, ExtraInfo, MsgFilterLow, MsgFilterHigh);
-         
+
          if (!NotForUs && (MsgFilterLow != 0 || MsgFilterHigh != 0))
          {
              /* Don't return message if not in range */

Reply via email to