ReactOS 0.4.16-dev-197-g92996da
chkdsk.c File Reference
#include "precomp.h"
#include <ntstrsafe.h>
#include <debug.h>
Include dependency graph for chkdsk.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file chkdsk.c.

Function Documentation

◆ Chkdsk()

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 at line 19 of file chkdsk.c.

29{
31 UNICODE_STRING usDriveRoot;
34 WCHAR DriveName[MAX_PATH];
36
38 if (!Provider)
39 {
40 /* Unknown file system */
41 goto Quit;
42 }
43
44 if (!NT_SUCCESS(RtlStringCchCopyW(DriveName, ARRAYSIZE(DriveName), DriveRoot)))
45 goto Quit;
46
47 if (DriveName[wcslen(DriveName) - 1] != L'\\')
48 {
49 /* Append the trailing backslash for GetVolumeNameForVolumeMountPointW */
50 if (!NT_SUCCESS(RtlStringCchCatW(DriveName, ARRAYSIZE(DriveName), L"\\")))
51 goto Quit;
52 }
53
55 {
56 /* Couldn't get a volume GUID path, try checking using a parameter provided path */
57 DPRINT1("Couldn't get a volume GUID path for drive %S\n", DriveName);
58 wcscpy(VolumeName, DriveName);
59 }
60
62 goto Quit;
63
64 /* Trim the trailing backslash since we will work with a device object */
65 usDriveRoot.Length -= sizeof(WCHAR);
66
67 DPRINT("Chkdsk() - %S\n", Format);
69 Success = Provider->Chkdsk(&usDriveRoot,
71 CorrectErrors,
72 Verbose,
73 CheckOnlyIfDirty,
74 ScanDrive,
75 NULL,
76 NULL,
77 NULL,
78 NULL,
79 (PULONG)&Status);
80 if (!Success)
81 DPRINT1("Chkdsk() failed with Status 0x%lx\n", Status);
82
83 RtlFreeUnicodeString(&usDriveRoot);
84
85Quit:
86 /* Report result */
87 Callback(DONE, 0, &Success);
88}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Verbose
Definition: chkdsk.c:72
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
@ Success
Definition: eventcreate.c:712
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
Definition: fltkernel.h:1117
return pInstance GetProvider() -> GetHandle()
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
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)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
NTSTRSAFEAPI RtlStringCchCatW(_Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:601
#define L(x)
Definition: ntvdm.h:50
#define DONE
Definition: rnr20lib.h:14
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
uint32_t * PULONG
Definition: typedefs.h:59
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ChkDskNow(), and wmain().