[FASTFAT]
authorPierre Schweitzer <pierre@reactos.org>
Mon, 10 Nov 2014 17:42:51 +0000 (17:42 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 10 Nov 2014 17:42:51 +0000 (17:42 +0000)
- Store IO VPB in our VCB for later use
- Prepare a spare VPB in our VCB for dismount swapout

svn path=/trunk/; revision=65361

reactos/drivers/filesystems/fastfat/fsctl.c
reactos/drivers/filesystems/fastfat/vfat.h

index bc722f8..43e582a 100644 (file)
@@ -521,6 +521,14 @@ VfatMount(
     /* Initialize this resource early ... it's used in VfatCleanup */
     ExInitializeResourceLite(&DeviceExt->DirResource);
 
+    DeviceExt->IoVPB = DeviceObject->Vpb;
+    DeviceExt->SpareVPB = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VFAT);
+    if (DeviceExt->SpareVPB == NULL)
+    {
+        Status = STATUS_INSUFFICIENT_RESOURCES;
+        goto ByeBye;
+    }
+
     DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
     Fcb = vfatNewFCB(DeviceExt, &NameU);
     if (Fcb == NULL)
@@ -622,6 +630,8 @@ ByeBye:
         /* Cleanup */
         if (DeviceExt && DeviceExt->FATFileObject)
             ObDereferenceObject (DeviceExt->FATFileObject);
+        if (DeviceExt && DeviceExt->SpareVPB)
+            ExFreePoolWithTag(DeviceExt->SpareVPB, TAG_VFAT);
         if (Fcb)
             vfatDestroyFCB(Fcb);
         if (Ccb)
index c35b735..b02d4b4 100644 (file)
@@ -299,6 +299,10 @@ typedef struct DEVICE_EXTENSION
 
     /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
     ULONG OpenHandleCount;
+
+    /* VPBs for dismount */
+    PVPB IoVPB;
+    PVPB SpareVPB;
 } DEVICE_EXTENSION, VCB, *PVCB;
 
 typedef struct