[ros-diffs] [cgutman] 35053: - We must assign values to Irp->IoStatus.Status and Irp->IoStatus.Information because the function that called us might not call UnlockAndMaybeComplete to assign those values

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Aug 3 03:38:06 CEST 2008


Author: cgutman
Date: Sat Aug  2 20:38:05 2008
New Revision: 35053

URL: http://svn.reactos.org/svn/reactos?rev=35053&view=rev
Log:
 - We must assign values to Irp->IoStatus.Status and Irp->IoStatus.Information because the function that called us might not call UnlockAndMaybeComplete to assign those values

Modified:
    branches/aicom-network-fixes/drivers/network/afd/afd/read.c

Modified: branches/aicom-network-fixes/drivers/network/afd/afd/read.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/network/afd/afd/read.c?rev=35053&r1=35052&r2=35053&view=diff
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/read.c [iso-8859-1] Sat Aug  2 20:38:05 2008
@@ -129,7 +129,7 @@
     PIRP NextIrp;
     PIO_STACK_LOCATION NextIrpSp;
     PAFD_RECV_INFO RecvReq;
-    UINT TotalBytesCopied = 0;
+    UINT TotalBytesCopied = 0, RetBytesCopied = 0;
     NTSTATUS Status = STATUS_SUCCESS, RetStatus = STATUS_PENDING;
 
     AFD_DbgPrint(MID_TRACE,("%x %x\n", FCB, Irp));
@@ -197,7 +197,10 @@
 			       RecvReq->BufferCount, FALSE );
 		NextIrp->IoStatus.Status = Status;
 		NextIrp->IoStatus.Information = TotalBytesCopied;
-                if( NextIrp == Irp ) RetStatus = Status;
+		if( NextIrp == Irp ) { 
+		    RetStatus = Status;
+		    RetBytesCopied = TotalBytesCopied;
+		}
 		if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
 		IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
 	    }
@@ -212,6 +215,12 @@
     PollReeval( FCB->DeviceExt, FCB->FileObject );
 
     AFD_DbgPrint(MID_TRACE,("RetStatus for irp %x is %x\n", Irp, RetStatus));
+
+    /* Sometimes we're called with a NULL Irp */
+    if( Irp ) {
+        Irp->IoStatus.Status = RetStatus;
+        Irp->IoStatus.Information = RetBytesCopied;
+    }
 
     return RetStatus;
 }



More information about the Ros-diffs mailing list