This commit is contained in:
Bill Zissimopoulos 2015-11-30 10:14:16 -08:00
parent 427f8a20e6
commit 18091c65db
3 changed files with 9 additions and 3 deletions

View File

@ -150,6 +150,8 @@ VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject)
} }
ExDeleteResourceLite(&DeviceExtension->Resource); ExDeleteResourceLite(&DeviceExtension->Resource);
RtlZeroMemory(DeviceExtension, DeviceObject->Size - sizeof DEVICE_OBJECT);
IoDeleteDevice(DeviceObject); IoDeleteDevice(DeviceObject);
} }

View File

@ -269,6 +269,7 @@ typedef struct
FSP_FSCTL_VOLUME_PARAMS VolumeParams; FSP_FSCTL_VOLUME_PARAMS VolumeParams;
FSP_IOQ Ioq; FSP_IOQ Ioq;
PVPB SwapVpb; PVPB SwapVpb;
BOOLEAN Deleted;
UINT8 SecurityDescriptorBuf[]; UINT8 SecurityDescriptorBuf[];
} FSP_FSVRT_DEVICE_EXTENSION; } FSP_FSVRT_DEVICE_EXTENSION;
typedef struct typedef struct

View File

@ -118,7 +118,8 @@ static NTSTATUS FspFsctlMountVolume(
PVPB Vpb = IrpSp->Parameters.MountVolume.Vpb; PVPB Vpb = IrpSp->Parameters.MountVolume.Vpb;
PDEVICE_OBJECT FsvrtDeviceObject = Vpb->RealDevice; PDEVICE_OBJECT FsvrtDeviceObject = Vpb->RealDevice;
PDEVICE_OBJECT FsvolDeviceObject; PDEVICE_OBJECT FsvolDeviceObject;
FSP_FSVRT_DEVICE_EXTENSION *FsvrtDeviceExtension; FSP_FSVRT_DEVICE_EXTENSION *FsvrtDeviceExtension =
FspFsvrtDeviceExtension(FsvrtDeviceObject);
FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension; FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension;
/* check the passed in volume object; it must be one of our own */ /* check the passed in volume object; it must be one of our own */
@ -129,7 +130,7 @@ static NTSTATUS FspFsctlMountVolume(
Result = STATUS_UNRECOGNIZED_VOLUME; Result = STATUS_UNRECOGNIZED_VOLUME;
goto exit; goto exit;
} }
if (FspDeviceDeleted(FsvrtDeviceObject) || if (FspDeviceDeleted(FsvrtDeviceObject) || FsvrtDeviceExtension->Deleted ||
FILE_DEVICE_VIRTUAL_DISK != FsvrtDeviceObject->DeviceType) FILE_DEVICE_VIRTUAL_DISK != FsvrtDeviceObject->DeviceType)
{ {
Result = STATUS_UNRECOGNIZED_VOLUME; Result = STATUS_UNRECOGNIZED_VOLUME;
@ -142,7 +143,6 @@ static NTSTATUS FspFsctlMountVolume(
&FsvolDeviceObject); &FsvolDeviceObject);
if (NT_SUCCESS(Result)) if (NT_SUCCESS(Result))
{ {
FsvrtDeviceExtension = FspFsvrtDeviceExtension(FsvrtDeviceObject);
FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject); FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
#pragma prefast(suppress:28175, "We are a filesystem: ok to access SectorSize") #pragma prefast(suppress:28175, "We are a filesystem: ok to access SectorSize")
FsvolDeviceObject->SectorSize = FsvrtDeviceExtension->VolumeParams.SectorSize; FsvolDeviceObject->SectorSize = FsvrtDeviceExtension->VolumeParams.SectorSize;
@ -186,6 +186,9 @@ static NTSTATUS FspFsvrtDeleteVolume(
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; goto exit;
/* mark the virtual volume device as deleted */
FsvrtDeviceExtension->Deleted = TRUE;
/* stop the I/O queue */ /* stop the I/O queue */
FspIoqStop(&FsvrtDeviceExtension->Ioq); FspIoqStop(&FsvrtDeviceExtension->Ioq);