[ros-diffs] [cgutman] 47417: [NTOSKRNL] - Fix stack skipping logic in IofCompleteRequest - Fixes displaying MULTIPLE_IRP_COMPLETE_REQUESTS bug check - Patch by lassy with a typo fix by me

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sat May 29 18:00:44 CEST 2010


Author: cgutman
Date: Sat May 29 18:00:43 2010
New Revision: 47417

URL: http://svn.reactos.org/svn/reactos?rev=47417&view=rev
Log:
[NTOSKRNL]
- Fix stack skipping logic in IofCompleteRequest
- Fixes displaying MULTIPLE_IRP_COMPLETE_REQUESTS bug check
- Patch by lassy with a typo fix by me

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/irp.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?rev=47417&r1=47416&r2=47417&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Sat May 29 18:00:43 2010
@@ -1217,15 +1217,22 @@
         ErrorCode = PtrToUlong(LastStackPtr->Parameters.Others.Argument4);
     }
 
-    /* Get the Current Stack */
-    StackPtr = IoGetCurrentIrpStackLocation(Irp);
-
-    /* Loop the Stacks and complete the IRPs */
-    do
-    {
-        /* Skip current stack location */
-        IoSkipCurrentIrpStackLocation(Irp);
-
+    /*
+     * Start the loop with the current stack and point the IRP to the next stack
+     * and then keep incrementing the stack as we loop through. The IRP should
+     * always point to the next stack location w.r.t the one currently being
+     * analyzed, so completion routine code will see the appropriate value.
+     * Because of this, we must loop until the current stack location is +1 of
+     * the stack count, because when StackPtr is at the end, CurrentLocation is +1.
+     */
+    for (StackPtr = IoGetCurrentIrpStackLocation(Irp),
+         Irp->CurrentLocation++,
+         Irp->Tail.Overlay.CurrentStackLocation++;
+         Irp->CurrentLocation <= (Irp->StackCount + 1);
+         StackPtr++,
+         Irp->CurrentLocation++,
+         Irp->Tail.Overlay.CurrentStackLocation++)
+    {
         /* Set Pending Returned */
         Irp->PendingReturned = StackPtr->Control & SL_PENDING_RETURNED;
 
@@ -1287,10 +1294,7 @@
             /* Clear the stack location */
             IopClearStackLocation(StackPtr);
         }
-
-        /* Move pointer to next stack location */
-        StackPtr++;
-    } while (Irp->CurrentLocation <= Irp->StackCount);
+    }
 
     /* Check if the IRP is an associated IRP */
     if (Irp->Flags & IRP_ASSOCIATED_IRP)




More information about the Ros-diffs mailing list