mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:52:56 +00:00
[FASTFAT]
When un/locking a volume, also handle VPB state svn path=/trunk/; revision=74047
This commit is contained in:
parent
a2bf0e2023
commit
3676af8656
1 changed files with 11 additions and 0 deletions
|
@ -1058,12 +1058,14 @@ VfatLockOrUnlockVolume(
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
PDEVICE_EXTENSION DeviceExt;
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
PVFATFCB Fcb;
|
PVFATFCB Fcb;
|
||||||
|
PVPB Vpb;
|
||||||
|
|
||||||
DPRINT("VfatLockOrUnlockVolume(%p, %d)\n", IrpContext, Lock);
|
DPRINT("VfatLockOrUnlockVolume(%p, %d)\n", IrpContext, Lock);
|
||||||
|
|
||||||
DeviceExt = IrpContext->DeviceExt;
|
DeviceExt = IrpContext->DeviceExt;
|
||||||
FileObject = IrpContext->FileObject;
|
FileObject = IrpContext->FileObject;
|
||||||
Fcb = FileObject->FsContext;
|
Fcb = FileObject->FsContext;
|
||||||
|
Vpb = DeviceExt->FATFileObject->Vpb;
|
||||||
|
|
||||||
/* Only allow locking with the volume open */
|
/* Only allow locking with the volume open */
|
||||||
if (!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME))
|
if (!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME))
|
||||||
|
@ -1078,6 +1080,13 @@ VfatLockOrUnlockVolume(
|
||||||
return STATUS_ACCESS_DENIED;
|
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 */
|
/* Deny locking if we're not alone */
|
||||||
if (Lock && DeviceExt->OpenHandleCount != 1)
|
if (Lock && DeviceExt->OpenHandleCount != 1)
|
||||||
{
|
{
|
||||||
|
@ -1088,10 +1097,12 @@ VfatLockOrUnlockVolume(
|
||||||
if (Lock)
|
if (Lock)
|
||||||
{
|
{
|
||||||
DeviceExt->Flags |= VCB_VOLUME_LOCKED;
|
DeviceExt->Flags |= VCB_VOLUME_LOCKED;
|
||||||
|
Vpb->Flags |= VPB_LOCKED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DeviceExt->Flags &= ~VCB_VOLUME_LOCKED;
|
DeviceExt->Flags &= ~VCB_VOLUME_LOCKED;
|
||||||
|
Vpb->Flags &= ~VPB_LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue