IoSecondStageCompletion(): +Handle/set 'Irp->UserIosb'
authorshort <>
Thu, 30 Jan 2003 10:44:23 +0000 (10:44 +0000)
committershort <>
Thu, 30 Jan 2003 10:44:23 +0000 (10:44 +0000)
IoSecondStageCompletion(): +Handle subrequests 'IRP_ASSOCIATED_IRP' of MasterIrp

ntoskrnl/io/cleanup.c

index 6fd0302..4a22f38 100644 (file)
@@ -181,6 +181,34 @@ VOID IoSecondStageCompletion(PIRP Irp, CCHAR PriorityBoost)
    DPRINT("IoSecondStageCompletion(Irp %x, PriorityBoost %d)\n",
          Irp, PriorityBoost);
    
+   /* FIXME: Should we set 'Irp->UserIosb' only on MasterIrp finalization
+    * or we should set it for each subrequest?
+    */
+   if (Irp->UserIosb)
+      {
+        *Irp->UserIosb=Irp->IoStatus;
+      }
+   
+   /* Handling only subrequest of AssociatedIrp group from MasterIrp?
+    * Is it the last subrequest?
+    * FIXME: It appears to me as if 'Irp->AssociatedIrp.IrpCount' is +1 than expected. :-?
+    */
+   if (Irp->Flags & IRP_ASSOCIATED_IRP)
+      {
+        Irp=Irp->AssociatedIrp.MasterIrp;
+        if (!Irp)
+           KeBugCheck(0);
+        if (!Irp->AssociatedIrp.IrpCount)
+           KeBugCheck(0);      /* Completion of already completed MasterIrp? */
+        /* TODO:thread */
+        if (--Irp->AssociatedIrp.IrpCount)
+           return;     /* not yet fully completed MasterIrp */
+        if (Irp->UserIosb)
+           {
+              *Irp->UserIosb=Irp->IoStatus;
+           }
+      }
+   
    IoStack = &Irp->Stack[(ULONG)Irp->CurrentLocation];
    FileObject = IoStack->FileObject;