mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 18:25:52 +00:00
[VFATLIB]
- Lock the volume before formatting to prevent concurrent access during formatting - This should (in theory) fix our formatting issue on mounted devices but currently we don't support FSCTL_LOCK_VOLUME in our FS drivers svn path=/trunk/; revision=52435
This commit is contained in:
parent
a50aff948b
commit
a3b61053bc
1 changed files with 30 additions and 0 deletions
|
@ -195,6 +195,21 @@ VfatFormat(IN PUNICODE_STRING DriveRoot,
|
||||||
Callback (PROGRESS, 0, (PVOID)&Context.Percent);
|
Callback (PROGRESS, 0, (PVOID)&Context.Percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = NtFsControlFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&Iosb,
|
||||||
|
FSCTL_LOCK_VOLUME,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("WARNING: Failed to lock volume for formatting! Format may fail! (Status: 0x%x)\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
if (PartitionInfo.PartitionType == PARTITION_FAT_12)
|
if (PartitionInfo.PartitionType == PARTITION_FAT_12)
|
||||||
{
|
{
|
||||||
/* FAT12 */
|
/* FAT12 */
|
||||||
|
@ -236,6 +251,21 @@ VfatFormat(IN PUNICODE_STRING DriveRoot,
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = NtFsControlFile(FileHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&Iosb,
|
||||||
|
FSCTL_UNLOCK_VOLUME,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to unlock volume (Status: 0x%x)\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
NtClose(FileHandle);
|
||||||
|
|
||||||
if (Callback != NULL)
|
if (Callback != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue