mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[FASTFAT] Deny dismounting system volume or a volume with a pagefile
This commit is contained in:
parent
7c3cff3a68
commit
d37280efaa
3 changed files with 13 additions and 0 deletions
|
@ -778,6 +778,7 @@ VfatCreateFile(
|
|||
if (PagingFileCreate)
|
||||
{
|
||||
pFcb->Flags |= FCB_IS_PAGE_FILE;
|
||||
SetFlag(DeviceExt->Flags, VCB_IS_SYS_OR_HAS_PAGE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -897,6 +898,7 @@ VfatCreateFile(
|
|||
else
|
||||
{
|
||||
pFcb->Flags |= FCB_IS_PAGE_FILE;
|
||||
SetFlag(DeviceExt->Flags, VCB_IS_SYS_OR_HAS_PAGE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -777,6 +777,10 @@ VfatMount(
|
|||
}
|
||||
|
||||
VolumeFcb->Flags |= VCB_IS_DIRTY;
|
||||
if (BooleanFlagOn(Vpb->RealDevice->Flags, DO_SYSTEM_BOOT_PARTITION))
|
||||
{
|
||||
SetFlag(DeviceExt->Flags, VCB_IS_SYS_OR_HAS_PAGE);
|
||||
}
|
||||
|
||||
FsRtlNotifyVolumeEvent(DeviceExt->FATFileObject, FSRTL_VOLUME_MOUNT);
|
||||
FsRtlNotifyInitializeSync(&DeviceExt->NotifySync);
|
||||
|
@ -1174,6 +1178,12 @@ VfatDismountVolume(
|
|||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/* Deny dismount of boot volume */
|
||||
if (BooleanFlagOn(DeviceExt->Flags, VCB_IS_SYS_OR_HAS_PAGE))
|
||||
{
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/* Race condition? */
|
||||
if (BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING))
|
||||
{
|
||||
|
|
|
@ -239,6 +239,7 @@ typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
|
|||
#define VCB_VOLUME_LOCKED 0x0001
|
||||
#define VCB_DISMOUNT_PENDING 0x0002
|
||||
#define VCB_IS_FATX 0x0004
|
||||
#define VCB_IS_SYS_OR_HAS_PAGE 0x0008
|
||||
#define VCB_IS_DIRTY 0x4000 /* Volume is dirty */
|
||||
#define VCB_CLEAR_DIRTY 0x8000 /* Clean dirty flag at shutdown */
|
||||
|
||||
|
|
Loading…
Reference in a new issue