[AUTOCHK][CHKDSK]: Minor fixes / formatting. Really add chkdsk to build.
[reactos.git] / reactos / dll / win32 / fmifs / chkdsk.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: File Management IFS Utility functions
4 * FILE: reactos/dll/win32/fmifs/chkdsk.c
5 * PURPOSE: Disk Checker
6 *
7 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 #include "precomp.h"
11
12 #define NDEBUG
13 #include <debug.h>
14
15 /* FMIFS.1 */
16 VOID
17 NTAPI
18 Chkdsk(
19 IN PWCHAR DriveRoot,
20 IN PWCHAR Format,
21 IN BOOLEAN CorrectErrors,
22 IN BOOLEAN Verbose,
23 IN BOOLEAN CheckOnlyIfDirty,
24 IN BOOLEAN ScanDrive,
25 IN PVOID Unused2,
26 IN PVOID Unused3,
27 IN PFMIFSCALLBACK Callback)
28 {
29 PIFS_PROVIDER Provider;
30 UNICODE_STRING usDriveRoot;
31 BOOLEAN Argument = FALSE;
32 WCHAR VolumeName[MAX_PATH];
33 //CURDIR CurDir;
34
35 Provider = GetProvider(Format);
36 if (!Provider)
37 {
38 /* Unknown file system */
39 Callback(DONE, 0, &Argument);
40 return;
41 }
42
43 #if 1
44 DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
45 swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
46 RtlCreateUnicodeString(&usDriveRoot, VolumeName);
47 /* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
48 #else
49 if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) ||
50 !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
51 {
52 /* Report an error. */
53 Callback(DONE, 0, &Argument);
54 return;
55 }
56 #endif
57
58 DPRINT("ChkdskEx - %S\n", Format);
59 Provider->ChkdskEx(&usDriveRoot,
60 CorrectErrors,
61 Verbose,
62 CheckOnlyIfDirty,
63 ScanDrive,
64 Callback);
65
66 RtlFreeUnicodeString(&usDriveRoot);
67 }
68
69 /* EOF */