Author: tfaber
Date: Tue Jun 19 10:43:38 2012
New Revision: 56749

URL: http://svn.reactos.org/svn/reactos?rev=56749&view=rev
Log:
[NTOSKRNL]
- Fix wait asserts to account for the Thread->WaitNext case
- At least output a warning in place of the assertion failure in 
KeWaitForMultipleObjects
See issue #7129 for more details.

Modified:
    trunk/reactos/ntoskrnl/ke/wait.c

Modified: trunk/reactos/ntoskrnl/ke/wait.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/wait.c?rev=56749&r1=56748&r2=56749&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/wait.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/wait.c [iso-8859-1] Tue Jun 19 10:43:38 2012
@@ -417,9 +417,12 @@
     PLARGE_INTEGER OriginalDueTime = Timeout;
     ULONG Hand = 0;
 
-    ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL ||
-           (KeGetCurrentIrql() == DISPATCH_LEVEL &&
-            Timeout && Timeout->QuadPart == 0));
+    if (Thread->WaitNext)
+        ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+    else
+        ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL ||
+               (KeGetCurrentIrql() == DISPATCH_LEVEL &&
+                Timeout && Timeout->QuadPart == 0));
 
     /* Check if the lock is already held */
     if (!Thread->WaitNext) goto WaitStart;
@@ -587,10 +590,17 @@
     LARGE_INTEGER DueTime = {{0}}, NewDueTime, InterruptTime;
     ULONG Index, Hand = 0;
 
-    /* HACK: tcpip is broken and waits with spinlocks acquired (bug #7129) */
-    /*ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL ||
-           (KeGetCurrentIrql() == DISPATCH_LEVEL &&
-            Timeout && Timeout->QuadPart == 0));*/
+    if (Thread->WaitNext)
+        ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+    else if (KeGetCurrentIrql() == DISPATCH_LEVEL &&
+             (!Timeout || Timeout->QuadPart != 0))
+    {
+        /* HACK: tcpip is broken and waits with spinlocks acquired (bug #7129) 
*/
+        DPRINT1("%s called at DISPATCH_LEVEL with non-zero timeout!\n",
+                __FUNCTION__);
+    }
+    else
+        ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
 
     /* Make sure the Wait Count is valid */
     if (!WaitBlockArray)


Reply via email to