67 DPRINT(
"VfatFormat(DriveRoot '%wZ')\n", DriveRoot);
109 DPRINT(
"IOCTL_DISK_GET_DRIVE_GEOMETRY failed with status 0x%08x\n",
Status);
120 DPRINT(
"DiskSize %I64d\n",
138 DPRINT(
"IOCTL_DISK_GET_PARTITION_INFO failed with status 0x%08x\n",
Status);
169 if (
PartitionInfo.PartitionLength.QuadPart < (4200LL * 1024LL))
174 else if (
PartitionInfo.StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL))
178 if (
PartitionInfo.PartitionLength.QuadPart < (32LL * 1024LL * 1024LL))
183 else if (
PartitionInfo.PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
198 if (
PartitionInfo.PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
238 DPRINT1(
"WARNING: Failed to lock volume for formatting! Format may fail! (Status: 0x%x)\n", LockStatus);
295 DPRINT1(
"Failed to umount volume (Status: 0x%x)\n", LockStatus);
310 DPRINT1(
"Failed to unlock volume (Status: 0x%x)\n", LockStatus);
328 NewPercent = (
Context->CurrentSectorCount * 100ULL) /
Context->TotalSectorCount;
353 DPRINT1(
"VfatPrint -- %s", TextBuf);
414 salvage_files =
TRUE;
433 if (CheckOnlyIfDirty && !fs_isdirty())
444 else if (CheckOnlyIfDirty && fs_isdirty())
457 VfatPrint(
"Starting check/repair pass.\n");
476 VfatPrint(
"Starting verification pass.\n");
500 VfatPrint(
"Leaving filesystem unchanged.\n");
504 VfatPrint(
"%wZ: %u files, %lu/%lu clusters\n", DriveRoot,
#define PARTITION_FAT32_XINT13
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
NTSTATUS Fat12Format(IN HANDLE FileHandle, IN PPARTITION_INFORMATION PartitionInfo, IN PDISK_GEOMETRY DiskGeometry, IN PUNICODE_STRING Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN OUT PFORMAT_CONTEXT Context)
NTSTATUS Fat16Format(IN HANDLE FileHandle, IN PPARTITION_INFORMATION PartitionInfo, IN PDISK_GEOMETRY DiskGeometry, IN PUNICODE_STRING Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN OUT PFORMAT_CONTEXT Context)
NTSTATUS Fat32Format(IN HANDLE FileHandle, IN PPARTITION_INFORMATION PartitionInfo, IN PDISK_GEOMETRY DiskGeometry, IN PUNICODE_STRING Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN OUT PFORMAT_CONTEXT Context)
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
BOOLEAN(NTAPI * PFMIFSCALLBACK)(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
#define FILE_SYNCHRONOUS_IO_ALERT
int scan_root(DOS_FS *fs)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
#define FSCTL_LOCK_VOLUME
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FSCTL_UNLOCK_VOLUME
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define FSCTL_DISMOUNT_VOLUME
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_GENERIC_READ
#define FILE_GENERIC_WRITE
#define UNREFERENCED_PARAMETER(P)
enum _MEDIA_TYPE MEDIA_TYPE
#define IOCTL_DISK_GET_PARTITION_INFO
#define FSCHECK_READ_WRITE
#define FSCHECK_INTERACTIVE
void read_boot(DOS_FS *fs)
char get_key(const char *valid, const char *prompt)
void reclaim_free(DOS_FS *fs)
uint32_t update_free(DOS_FS *fs)
void read_fat(DOS_FS *fs)
void reclaim_file(DOS_FS *fs)
void fs_open(char *path, int rw)
#define RtlZeroMemory(Destination, Length)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_DISK_CORRUPT_ERROR
PFMIFSCALLBACK ChkdskCallback
BOOLEAN NTAPI VfatChkdsk(IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID pUnknown1, IN PVOID pUnknown2, IN PVOID pUnknown3, IN PVOID pUnknown4, IN PULONG ExitStatus)
VOID VfatPrint(PCHAR Format,...)
VOID UpdateProgress(PFORMAT_CONTEXT Context, ULONG Increment)
BOOLEAN NTAPI VfatFormat(IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN QuickFormat, IN BOOLEAN BackwardCompatible, IN MEDIA_TYPE MediaType, IN PUNICODE_STRING Label, IN ULONG ClusterSize)
VOID VfatPrintV(PCHAR Format, va_list args)
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo