Author: jimtabor
Date: Fri Nov  8 02:17:05 2013
New Revision: 60883

URL: http://svn.reactos.org/svn/reactos?rev=60883&view=rev
Log:
[Win32k]
- Add support for receiving message thread death, no real tests are available 
at this time.

Modified:
    trunk/reactos/win32ss/user/ntuser/msgqueue.c

Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgqueue.c?rev=60883&r1=60882&r2=60883&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/msgqueue.c        [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/msgqueue.c        [iso-8859-1] Fri Nov  8 
02:17:05 2013
@@ -1102,15 +1102,19 @@
    }
    else
    {
-      PVOID WaitObjects[2];
-
-      WaitObjects[0] = &CompletionEvent;
-      WaitObjects[1] = pti->pEventQueueServer;
+      PVOID WaitObjects[3];
+
+      ObReferenceObject(ptirec->pEThread);
+
+      WaitObjects[0] = &CompletionEvent;       // Wait 0
+      WaitObjects[1] = pti->pEventQueueServer; // Wait 1
+      WaitObjects[2] = ptirec->pEThread;       // Wait 2
+
       do
       {
          UserLeaveCo();
 
-         WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, 
UserRequest,
+         WaitStatus = KeWaitForMultipleObjects(3, WaitObjects, WaitAny, 
UserRequest,
                                                UserMode, FALSE, (uTimeout ? 
&Timeout : NULL), NULL);
 
          UserEnterCo();
@@ -1158,10 +1162,34 @@
             TRACE("MsqSendMessage timed out 2\n");
             break;
          }
+         /*if (WaitStatus == STATUS_WAIT_1)
+         {
+            ERR("Event hit\n");
+         }*/
+         // Receiving thread passed on and left us hanging with issues still 
pending.
+         if (WaitStatus == STATUS_WAIT_2)
+         {
+            ERR("Thread woken up dead!\n");
+            Entry = pti->DispatchingMessagesHead.Flink;
+            while (Entry != &pti->DispatchingMessagesHead)
+            {
+               if ((PUSER_SENT_MESSAGE) CONTAINING_RECORD(Entry, 
USER_SENT_MESSAGE, DispatchingListEntry)
+                     == Message)
+               {
+                  Message->CompletionEvent = NULL;
+                  Message->Result = NULL;
+                  RemoveEntryList(&Message->DispatchingListEntry);
+                  Message->DispatchingListEntry.Flink = NULL;
+                  break;
+               }
+               Entry = Entry->Flink;
+            }
+         }
          while (co_MsqDispatchOneSentMessage(pti))
             ;
       }
-      while (NT_SUCCESS(WaitStatus) && STATUS_WAIT_0 != WaitStatus);
+      while (NT_SUCCESS(WaitStatus) && WaitStatus == STATUS_WAIT_1);
+      ObDereferenceObject(ptirec->pEThread);
    }
 
    if(WaitStatus != STATUS_TIMEOUT)


Reply via email to