https://git.reactos.org/?p=reactos.git;a=commitdiff;h=48250aef6e1fbc00822b3…
commit 48250aef6e1fbc00822b338322f8d5fe050fe138
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Dec 9 21:10:32 2017 +0100
[CHKDSK] Don't continue repair if volume is in use
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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/base/system/chkdsk/chkdsk.c b/base/system/chkdsk/chkdsk.c
index 57a7b26aef..76dc975098 100644
--- a/base/system/chkdsk/chkdsk.c
+++ b/base/system/chkdsk/chkdsk.c
@@ -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