ReactOS  0.4.15-dev-3207-ga415bd4
chkdsk.c
Go to the documentation of this file.
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
19  IN PWCHAR DriveRoot,
21  IN BOOLEAN CorrectErrors,
23  IN BOOLEAN CheckOnlyIfDirty,
24  IN BOOLEAN ScanDrive,
25  IN PVOID Unused2,
26  IN PVOID Unused3,
28 {
30  UNICODE_STRING usDriveRoot;
34  //CURDIR CurDir;
35 
37  if (!Provider)
38  {
39  /* Unknown file system */
40  Callback(DONE, 0, &Success);
41  return;
42  }
43 
44 #if 1
45  DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
46  swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
47  RtlCreateUnicodeString(&usDriveRoot, VolumeName);
48  /* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
49 #else
51  !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
52  {
53  /* Report an error */
54  Callback(DONE, 0, &Success);
55  return;
56  }
57 #endif
58 
59  DPRINT("Chkdsk() - %S\n", Format);
61  Success = Provider->Chkdsk(&usDriveRoot,
62  Callback,
63  CorrectErrors,
64  Verbose,
65  CheckOnlyIfDirty,
66  ScanDrive,
67  NULL,
68  NULL,
69  NULL,
70  NULL,
71  (PULONG)&Status);
72  if (!Success)
73  DPRINT1("Chkdsk() failed with Status 0x%lx\n", Status);
74 
75  /* Report success */
76  Callback(DONE, 0, &Success);
77 
78  RtlFreeUnicodeString(&usDriveRoot);
79 }
80 
81 /* EOF */
#define IN
Definition: typedefs.h:39
BOOL Verbose
Definition: chkdsk.c:72
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:56
#define swprintf
Definition: precomp.h:40
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
VOID NTAPI Chkdsk(IN PWCHAR DriveRoot, IN PWCHAR Format, IN BOOLEAN CorrectErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID Unused2, IN PVOID Unused3, IN PFMIFSCALLBACK Callback)
Definition: chkdsk.c:18
BOOLEAN(NTAPI * PFMIFSCALLBACK)(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
Definition: fmifs.h:89
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
Definition: fltkernel.h:1117
#define DONE
Definition: rnr20lib.h:14
#define STATUS_SUCCESS
Definition: shellext.h:65
#define towupper(c)
Definition: wctype.h:99
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
#define DPRINT
Definition: sndvol32.h:71
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
PIFS_PROVIDER GetProvider(IN PWCHAR FileSystem)
Definition: init.c:23