[ros-diffs] [cgutman] 36100: - Set ContextSize when we allocate it - Remove the context size check so we always create a new one now - Now we succeed regardless of the current context size

cgutman at svn.reactos.org cgutman at svn.reactos.org
Wed Sep 10 04:52:23 CEST 2008


Author: cgutman
Date: Tue Sep  9 21:52:22 2008
New Revision: 36100

URL: http://svn.reactos.org/svn/reactos?rev=36100&view=rev
Log:
 - Set ContextSize when we allocate it
 - Remove the context size check so we always create a new one now
 - Now we succeed regardless of the current context size

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

Modified: branches/aicom-network-fixes/drivers/network/afd/afd/context.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/network/afd/afd/context.c?rev=36100&r1=36099&r2=36100&view=diff
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/context.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/context.c [iso-8859-1] Tue Sep  9 21:52:22 2008
@@ -39,7 +39,6 @@
 NTSTATUS STDCALL
 AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
 	       PIO_STACK_LOCATION IrpSp ) {
-    NTSTATUS Status = STATUS_BUFFER_TOO_SMALL;
     PFILE_OBJECT FileObject = IrpSp->FileObject;
     PAFD_FCB FCB = FileObject->FsContext;
 
@@ -47,25 +46,19 @@
 
     if( FCB->Context ) {
 	ExFreePool( FCB->Context );
-	FCB->Context = NULL;
+	FCB->ContextSize = 0;
     }
 
-    if( FCB->ContextSize <
-	IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
-	FCB->Context =
-	    ExAllocatePool
-	    ( PagedPool,
-	      IrpSp->Parameters.DeviceIoControl.InputBufferLength );
+    FCB->Context = ExAllocatePool( PagedPool,
+	                           IrpSp->Parameters.DeviceIoControl.InputBufferLength );
 
-	if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
+    if( !FCB->Context ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
 
-	RtlCopyMemory( FCB->Context,
-		       IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
-		       IrpSp->Parameters.DeviceIoControl.InputBufferLength );
-	Status = STATUS_SUCCESS;
-    }
+    FCB->ContextSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
 
-    AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
+    RtlCopyMemory( FCB->Context,
+		   IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
+		   FCB->ContextSize );
 
-    return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
+    return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0, NULL );
 }



More information about the Ros-diffs mailing list