Author: hbelusca
Date: Thu Mar 3 00:36:25 2016
New Revision: 70869
URL:
http://svn.reactos.org/svn/reactos?rev=70869&view=rev
Log:
[AUTOCHK][CHKDSK]: Minor fixes / formatting. Really add chkdsk to build.
[FMIFS]: Quickly implement the chkdsk function, the same way as it is done for the
formatting function.
Modified:
trunk/reactos/base/system/CMakeLists.txt
trunk/reactos/base/system/autochk/autochk.c
trunk/reactos/base/system/chkdsk/chkdsk.c
trunk/reactos/dll/win32/fmifs/chkdsk.c
trunk/reactos/dll/win32/fmifs/format.c
trunk/reactos/dll/win32/fmifs/init.c
Modified: trunk/reactos/base/system/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/CMakeLists.txt…
==============================================================================
--- trunk/reactos/base/system/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/system/CMakeLists.txt [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -1,6 +1,7 @@
add_subdirectory(autochk)
add_subdirectory(bootok)
+add_subdirectory(chkdsk)
add_subdirectory(diskpart)
add_subdirectory(expand)
add_subdirectory(format)
Modified: trunk/reactos/base/system/autochk/autochk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/autochk/autoch…
==============================================================================
--- trunk/reactos/base/system/autochk/autochk.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/autochk/autochk.c [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -1,4 +1,5 @@
-/* PROJECT: ReactOS Kernel
+/*
+ * PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/autochk/autochk.c
* PURPOSE: Filesystem checker
Modified: trunk/reactos/base/system/chkdsk/chkdsk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/chkdsk/chkdsk.…
==============================================================================
--- trunk/reactos/base/system/chkdsk/chkdsk.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/chkdsk/chkdsk.c [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -4,7 +4,7 @@
//
// Copyright (c) 1998 Mark Russinovich
// Systems Internals
-//
http://www.sysinternals.com/
+//
http://www.sysinternals.com
//
// Chkdsk clone that demonstrates the use of the FMIFS file system
// utility library.
@@ -43,10 +43,14 @@
/* PSDK/NDK Headers */
#define WIN32_NO_STATUS
-#include <windows.h>
+#include <windef.h>
+#include <winbase.h>
+#include <wincon.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
+
+/* FMIFS Public Header */
#include <fmifs/fmifs.h>
#define FMIFS_IMPORT_DLL
@@ -118,9 +122,8 @@
//
// Tell the user how to use the program
//
-// 19990216 EA Missing printf %s argument
-//----------------------------------------------------------------------
-VOID
+//----------------------------------------------------------------------
+static VOID
Usage(PWCHAR ProgramName)
{
wprintf(L"Usage: %s [drive:] [-F] [-V] [-R] [-C]\n\n"
@@ -140,7 +143,7 @@
// Get the switches.
//
//----------------------------------------------------------------------
-int
+static int
ParseCommandLine(
int argc,
WCHAR *argv[]
@@ -160,9 +163,9 @@
switch (argv[i][1])
{
- case L'?':
- Usage(argv[0]);
- break;
+ // case L'?':
+ // Usage(argv[0]);
+ // return i;
case L'F': case L'f':
{
@@ -309,7 +312,7 @@
case DONE:
status = (PBOOLEAN)Argument;
- if (*status == TRUE)
+ if (*status == FALSE)
{
wprintf(L"Chkdsk was unable to complete successfully.\n\n");
Error = TRUE;
@@ -329,7 +332,7 @@
// 19990216 EA Used wide functions
//
//----------------------------------------------------------------------
-BOOLEAN
+static BOOLEAN
LoadFMIFSEntryPoints(VOID)
{
HMODULE hFmifs = LoadLibraryW(L"fmifs.dll");
Modified: trunk/reactos/dll/win32/fmifs/chkdsk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fmifs/chkdsk.c?r…
==============================================================================
--- trunk/reactos/dll/win32/fmifs/chkdsk.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/fmifs/chkdsk.c [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -2,12 +2,15 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: File Management IFS Utility functions
* FILE: reactos/dll/win32/fmifs/chkdsk.c
- * PURPOSE: Chkdsk
+ * PURPOSE: Disk Checker
*
- * PROGRAMMERS: (none)
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#include "precomp.h"
+
+#define NDEBUG
+#include <debug.h>
/* FMIFS.1 */
VOID
@@ -23,12 +26,44 @@
IN PVOID Unused3,
IN PFMIFSCALLBACK Callback)
{
+ PIFS_PROVIDER Provider;
+ UNICODE_STRING usDriveRoot;
BOOLEAN Argument = FALSE;
+ WCHAR VolumeName[MAX_PATH];
+ //CURDIR CurDir;
- /* FAIL immediately */
- Callback(DONE, /* Command */
- 0, /* DWORD Modifier */
- &Argument);/* Argument */
+ Provider = GetProvider(Format);
+ if (!Provider)
+ {
+ /* Unknown file system */
+ Callback(DONE, 0, &Argument);
+ return;
+ }
+
+#if 1
+ DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
+ swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
+ RtlCreateUnicodeString(&usDriveRoot, VolumeName);
+ /* Code disabled as long as our storage stack doesn't understand
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
+#else
+ if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) ||
+ !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
+ {
+ /* Report an error. */
+ Callback(DONE, 0, &Argument);
+ return;
+ }
+#endif
+
+ DPRINT("ChkdskEx - %S\n", Format);
+ Provider->ChkdskEx(&usDriveRoot,
+ CorrectErrors,
+ Verbose,
+ CheckOnlyIfDirty,
+ ScanDrive,
+ Callback);
+
+ RtlFreeUnicodeString(&usDriveRoot);
}
/* EOF */
Modified: trunk/reactos/dll/win32/fmifs/format.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fmifs/format.c?r…
==============================================================================
--- trunk/reactos/dll/win32/fmifs/format.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/fmifs/format.c [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -55,9 +55,7 @@
if (!Provider)
{
/* Unknown file system */
- Callback(DONE, /* Command */
- 0, /* DWORD Modifier */
- &Argument); /* Argument */
+ Callback(DONE, 0, &Argument);
return;
}
@@ -71,9 +69,7 @@
!RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
{
/* Report an error. */
- Callback(DONE, /* Command */
- 0, /* DWORD Modifier */
- &Argument); /* Argument */
+ Callback(DONE, 0, &Argument);
return;
}
#endif
Modified: trunk/reactos/dll/win32/fmifs/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fmifs/init.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/fmifs/init.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/fmifs/init.c [iso-8859-1] Thu Mar 3 00:36:25 2016
@@ -167,9 +167,7 @@
if (FmIfsInitialized == FALSE)
{
if (InitializeFmIfsOnce() == FALSE)
- {
- return FALSE;
- }
+ return FALSE;
FmIfsInitialized = TRUE;
}