Author: pschweitzer
Date: Sat Mar 4 11:34:13 2017
New Revision: 74047
URL:
http://svn.reactos.org/svn/reactos?rev=74047&view=rev
Log:
[FASTFAT]
When un/locking a volume, also handle VPB state
Modified:
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Sat Mar 4 11:34:13
2017
@@ -1058,12 +1058,14 @@
PFILE_OBJECT FileObject;
PDEVICE_EXTENSION DeviceExt;
PVFATFCB Fcb;
+ PVPB Vpb;
DPRINT("VfatLockOrUnlockVolume(%p, %d)\n", IrpContext, Lock);
DeviceExt = IrpContext->DeviceExt;
FileObject = IrpContext->FileObject;
Fcb = FileObject->FsContext;
+ Vpb = DeviceExt->FATFileObject->Vpb;
/* Only allow locking with the volume open */
if (!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME))
@@ -1078,6 +1080,13 @@
return STATUS_ACCESS_DENIED;
}
+ /* Bail out if it's already in the demanded state */
+ if ((BooleanFlagOn(Vpb->Flags, VPB_LOCKED) && Lock) ||
+ (!BooleanFlagOn(Vpb->Flags, VPB_LOCKED) && !Lock))
+ {
+ return STATUS_ACCESS_DENIED;
+ }
+
/* Deny locking if we're not alone */
if (Lock && DeviceExt->OpenHandleCount != 1)
{
@@ -1088,10 +1097,12 @@
if (Lock)
{
DeviceExt->Flags |= VCB_VOLUME_LOCKED;
+ Vpb->Flags |= VPB_LOCKED;
}
else
{
DeviceExt->Flags &= ~VCB_VOLUME_LOCKED;
+ Vpb->Flags &= ~VPB_LOCKED;
}
return STATUS_SUCCESS;