From 3676af8656e0c8048646e27ab4af832c33b072bf Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 4 Mar 2017 11:34:13 +0000 Subject: [PATCH] [FASTFAT] When un/locking a volume, also handle VPB state svn path=/trunk/; revision=74047 --- reactos/drivers/filesystems/fastfat/fsctl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/reactos/drivers/filesystems/fastfat/fsctl.c b/reactos/drivers/filesystems/fastfat/fsctl.c index 876e7f8a23d..16b3f2cf441 100644 --- a/reactos/drivers/filesystems/fastfat/fsctl.c +++ b/reactos/drivers/filesystems/fastfat/fsctl.c @@ -1058,12 +1058,14 @@ VfatLockOrUnlockVolume( 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 @@ VfatLockOrUnlockVolume( 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 @@ VfatLockOrUnlockVolume( if (Lock) { DeviceExt->Flags |= VCB_VOLUME_LOCKED; + Vpb->Flags |= VPB_LOCKED; } else { DeviceExt->Flags &= ~VCB_VOLUME_LOCKED; + Vpb->Flags &= ~VPB_LOCKED; } return STATUS_SUCCESS; -- 2.17.1