From 54f383d9965463bf036f92affcda6c44b0dc4ffa Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 5 Jun 2018 19:30:11 +0200 Subject: [PATCH] [VFATLIB] Only check volume if full scan or if allowed to fix it This allows doing a quick probe about whether a volume needs to be fixed by checking its dirty bit. CORE-14692 --- sdk/lib/fslib/vfatlib/vfatlib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk/lib/fslib/vfatlib/vfatlib.c b/sdk/lib/fslib/vfatlib/vfatlib.c index 8db6e8a11af..82c1282fbf0 100644 --- a/sdk/lib/fslib/vfatlib/vfatlib.c +++ b/sdk/lib/fslib/vfatlib/vfatlib.c @@ -428,6 +428,14 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, /* No need to check FS */ return (fs_close(FALSE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR); } + else if (CheckOnlyIfDirty && fs_isdirty()) + { + if (!(FsCheckFlags & FSCHECK_READ_WRITE) && !(FsCheckFlags & FSCHECK_INTERACTIVE)) + { + fs_close(FALSE); + return STATUS_DISK_CORRUPT_ERROR; + } + } read_boot(&fs);