[CHKDSK] Don't continue repair if volume is in use
authorPierre Schweitzer <pierre@reactos.org>
Sat, 9 Dec 2017 20:10:32 +0000 (21:10 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 9 Dec 2017 20:12:09 +0000 (21:12 +0100)
This makes use of previous commit vfatlib improvements that allow
caller to stop chkdsk if locking fail, which will happen if volume is in use.
That way, ReactOS users won't be able any longer to f*** up their C:\ volume
by attempting to chkdsk -f it!

CORE-14087

base/system/chkdsk/chkdsk.c

index 57a7b26..76dc975 100644 (file)
@@ -228,6 +228,7 @@ ChkdskCallback(
     DWORD       Modifier,
     PVOID       Argument)
 {
+    BOOLEAN     Ret;
     PDWORD      percent;
     PBOOLEAN    status;
     PTEXTOUTPUT output;
@@ -236,6 +237,7 @@ ChkdskCallback(
     // We get other types of commands,
     // but we don't have to pay attention to them
     //
+    Ret = TRUE;
     switch (Command)
     {
         case UNKNOWN2:
@@ -259,7 +261,8 @@ ChkdskCallback(
             break;
 
         case VOLUMEINUSE:
-            ConPuts(StdOut, L"VOLUMEINUSE\n");
+            ConPuts(StdOut, L"Volume is in use and cannot be locked\n");
+            Ret = FALSE;
             break;
 
         case UNKNOWN9:
@@ -313,7 +316,7 @@ ChkdskCallback(
             }
             break;
     }
-    return TRUE;
+    return Ret;
 }
 
 #ifndef FMIFS_IMPORT_DLL