mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:26:17 +00:00
[FORMATTING]
Fix indentation. No code changes. svn path=/trunk/; revision=47764
This commit is contained in:
parent
78b0fb4a21
commit
0c8457631d
9 changed files with 1644 additions and 1617 deletions
|
@ -798,9 +798,9 @@ Ext2TotalBlocks(PEXT2_FILESYS Ext2Sys, ULONG DataBlocks)
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS NTAPI
|
||||
Ext2Format(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
Ext2Format(IN PUNICODE_STRING DriveRoot,
|
||||
IN FMIFS_MEDIA_FLAG MediaFlag,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN BOOLEAN QuickFormat,
|
||||
|
@ -1002,9 +1002,9 @@ clean_up:
|
|||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI
|
||||
Ext2Chkdsk(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
NTSTATUS
|
||||
WINAPI
|
||||
Ext2Chkdsk(IN PUNICODE_STRING DriveRoot,
|
||||
IN BOOLEAN FixErrors,
|
||||
IN BOOLEAN Verbose,
|
||||
IN BOOLEAN CheckOnlyIfDirty,
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include <debug.h>
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NtfsFormat(PUNICODE_STRING DriveRoot,
|
||||
FMIFS_MEDIA_FLAG MediaFlag,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFMIFSCALLBACK Callback)
|
||||
NtfsFormat(IN PUNICODE_STRING DriveRoot,
|
||||
IN FMIFS_MEDIA_FLAG MediaFlag,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN ULONG ClusterSize,
|
||||
IN PFMIFSCALLBACK Callback)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -14,14 +14,16 @@
|
|||
#include <debug.h>
|
||||
|
||||
static ULONG
|
||||
GetShiftCount(ULONG Value)
|
||||
GetShiftCount(IN ULONG Value)
|
||||
{
|
||||
ULONG i = 1;
|
||||
|
||||
while (Value > 0)
|
||||
{
|
||||
i++;
|
||||
Value /= 2;
|
||||
}
|
||||
|
||||
return i - 2;
|
||||
}
|
||||
|
||||
|
@ -62,7 +64,7 @@ Fat12WriteBootSector (IN HANDLE FileHandle,
|
|||
0,
|
||||
SECTORSIZE);
|
||||
if (NewBootSector == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the new bootsector */
|
||||
memset(NewBootSector, 0, SECTORSIZE);
|
||||
|
@ -87,7 +89,7 @@ Fat12WriteBootSector (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NewBootSector);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Free the new boot sector */
|
||||
|
@ -95,7 +97,7 @@ Fat12WriteBootSector (IN HANDLE FileHandle,
|
|||
|
||||
UpdateProgress(Context, 1);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,7 +120,7 @@ Fat12WriteFAT (IN HANDLE FileHandle,
|
|||
0,
|
||||
32 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 32 * 1024);
|
||||
|
@ -143,7 +145,7 @@ Fat12WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, 1);
|
||||
|
@ -176,7 +178,7 @@ Fat12WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, Sectors);
|
||||
|
@ -185,7 +187,7 @@ Fat12WriteFAT (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,7 +224,7 @@ Fat12WriteRootDirectory (IN HANDLE FileHandle,
|
|||
0,
|
||||
32 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 32 * 1024);
|
||||
|
@ -237,6 +239,7 @@ Fat12WriteRootDirectory (IN HANDLE FileHandle,
|
|||
{
|
||||
Sectors = RootDirSectors - i;
|
||||
}
|
||||
|
||||
Size = Sectors * BootSector->BytesPerSector;
|
||||
|
||||
Status = NtWriteFile(FileHandle,
|
||||
|
@ -252,26 +255,27 @@ Fat12WriteRootDirectory (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, Sectors);
|
||||
}
|
||||
|
||||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
Fat12Format (HANDLE FileHandle,
|
||||
PPARTITION_INFORMATION PartitionInfo,
|
||||
PDISK_GEOMETRY DiskGeometry,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFORMAT_CONTEXT Context)
|
||||
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)
|
||||
{
|
||||
FAT16_BOOT_SECTOR BootSector;
|
||||
OEM_STRING VolumeLabel;
|
||||
|
@ -323,6 +327,7 @@ Fat12Format (HANDLE FileHandle,
|
|||
VolumeLabel.Length < 11 ? VolumeLabel.Length : 11);
|
||||
RtlFreeOemString(&VolumeLabel);
|
||||
}
|
||||
|
||||
memcpy(&BootSector.SysType[0], "FAT12 ", 8);
|
||||
|
||||
RootDirSectors = ((BootSector.RootEntries * 32) +
|
||||
|
|
|
@ -14,14 +14,16 @@
|
|||
#include <debug.h>
|
||||
|
||||
static ULONG
|
||||
GetShiftCount(ULONG Value)
|
||||
GetShiftCount(IN ULONG Value)
|
||||
{
|
||||
ULONG i = 1;
|
||||
|
||||
while (Value > 0)
|
||||
{
|
||||
i++;
|
||||
Value /= 2;
|
||||
}
|
||||
|
||||
return i - 2;
|
||||
}
|
||||
|
||||
|
@ -62,7 +64,7 @@ Fat16WriteBootSector (IN HANDLE FileHandle,
|
|||
0,
|
||||
SECTORSIZE);
|
||||
if (NewBootSector == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the new bootsector */
|
||||
memset(NewBootSector, 0, SECTORSIZE);
|
||||
|
@ -117,7 +119,7 @@ Fat16WriteFAT (IN HANDLE FileHandle,
|
|||
0,
|
||||
32 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 32 * 1024);
|
||||
|
@ -145,7 +147,7 @@ Fat16WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, 1);
|
||||
|
@ -178,7 +180,7 @@ Fat16WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, Sectors);
|
||||
|
@ -187,7 +189,7 @@ Fat16WriteFAT (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,7 +225,7 @@ Fat16WriteRootDirectory (IN HANDLE FileHandle,
|
|||
0,
|
||||
32 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 32 * 1024);
|
||||
|
@ -252,7 +254,7 @@ Fat16WriteRootDirectory (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, Sectors);
|
||||
|
@ -261,18 +263,18 @@ Fat16WriteRootDirectory (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
Fat16Format (HANDLE FileHandle,
|
||||
PPARTITION_INFORMATION PartitionInfo,
|
||||
PDISK_GEOMETRY DiskGeometry,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFORMAT_CONTEXT Context)
|
||||
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)
|
||||
{
|
||||
FAT16_BOOT_SECTOR BootSector;
|
||||
OEM_STRING VolumeLabel;
|
||||
|
@ -340,6 +342,7 @@ Fat16Format (HANDLE FileHandle,
|
|||
VolumeLabel.Length < 11 ? VolumeLabel.Length : 11);
|
||||
RtlFreeOemString(&VolumeLabel);
|
||||
}
|
||||
|
||||
memcpy(&BootSector.SysType[0], "FAT16 ", 8);
|
||||
|
||||
DPRINT("BootSector.SectorsHuge = %lx\n", BootSector.SectorsHuge);
|
||||
|
|
|
@ -14,14 +14,16 @@
|
|||
#include <debug.h>
|
||||
|
||||
static ULONG
|
||||
GetShiftCount(ULONG Value)
|
||||
GetShiftCount(IN ULONG Value)
|
||||
{
|
||||
ULONG i = 1;
|
||||
|
||||
while (Value > 0)
|
||||
{
|
||||
i++;
|
||||
Value /= 2;
|
||||
}
|
||||
|
||||
return i - 2;
|
||||
}
|
||||
|
||||
|
@ -62,7 +64,7 @@ Fat32WriteBootSector (IN HANDLE FileHandle,
|
|||
0,
|
||||
SECTORSIZE);
|
||||
if (NewBootSector == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the new bootsector */
|
||||
memset(NewBootSector, 0, SECTORSIZE);
|
||||
|
@ -137,7 +139,7 @@ Fat32WriteFsInfo (IN HANDLE FileHandle,
|
|||
0,
|
||||
BootSector->BytesPerSector);
|
||||
if (FsInfo == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the new sector */
|
||||
memset(FsInfo, 0, BootSector->BytesPerSector);
|
||||
|
@ -163,7 +165,7 @@ Fat32WriteFsInfo (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, FsInfo);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, 1);
|
||||
|
@ -171,7 +173,7 @@ Fat32WriteFsInfo (IN HANDLE FileHandle,
|
|||
/* Free the new sector buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, FsInfo);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,7 +195,7 @@ Fat32WriteFAT (IN HANDLE FileHandle,
|
|||
0,
|
||||
64 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 64 * 1024);
|
||||
|
@ -203,11 +205,13 @@ Fat32WriteFAT (IN HANDLE FileHandle,
|
|||
Buffer[1] = 0xff;
|
||||
Buffer[2] = 0xff;
|
||||
Buffer[3] = 0x0f;
|
||||
|
||||
/* FAT cluster 1 */
|
||||
Buffer[4] = 0xff; /* Clean shutdown, no disk read/write errors, end-of-cluster (EOC) mark */
|
||||
Buffer[5] = 0xff;
|
||||
Buffer[6] = 0xff;
|
||||
Buffer[7] = 0x0f;
|
||||
|
||||
/* FAT cluster 2 */
|
||||
Buffer[8] = 0xff; /* End of root directory */
|
||||
Buffer[9] = 0xff;
|
||||
|
@ -229,7 +233,7 @@ Fat32WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, 1);
|
||||
|
@ -262,7 +266,7 @@ Fat32WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, Sectors);
|
||||
|
@ -271,7 +275,7 @@ Fat32WriteFAT (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -292,7 +296,7 @@ Fat32WriteRootDirectory (IN HANDLE FileHandle,
|
|||
0,
|
||||
BootSector->SectorsPerCluster * BootSector->BytesPerSector);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, BootSector->SectorsPerCluster * BootSector->BytesPerSector);
|
||||
|
@ -327,7 +331,7 @@ Fat32WriteRootDirectory (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
UpdateProgress(Context, (ULONG)BootSector->SectorsPerCluster);
|
||||
|
@ -335,18 +339,18 @@ Fat32WriteRootDirectory (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
Fat32Format (HANDLE FileHandle,
|
||||
PPARTITION_INFORMATION PartitionInfo,
|
||||
PDISK_GEOMETRY DiskGeometry,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFORMAT_CONTEXT Context)
|
||||
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)
|
||||
{
|
||||
FAT32_BOOT_SECTOR BootSector;
|
||||
OEM_STRING VolumeLabel;
|
||||
|
@ -416,6 +420,7 @@ Fat32Format (HANDLE FileHandle,
|
|||
VolumeLabel.Length < 11 ? VolumeLabel.Length : 11);
|
||||
RtlFreeOemString(&VolumeLabel);
|
||||
}
|
||||
|
||||
memcpy(&BootSector.SysType[0], "FAT32 ", 8);
|
||||
|
||||
RootDirSectors = ((BootSector.RootEntries * 32) +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VFAT filesystem library
|
||||
* FILE: vfatlib.c
|
||||
* FILE: lib\fslib\vfatlib\vfatlib.c
|
||||
* PURPOSE: Main API
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* REVISIONS:
|
||||
|
@ -17,13 +17,14 @@ PVOID FsCheckMemQueue;
|
|||
ULONG FsCheckFlags;
|
||||
ULONG FsCheckTotalFiles;
|
||||
|
||||
NTSTATUS NTAPI
|
||||
VfatFormat (PUNICODE_STRING DriveRoot,
|
||||
FMIFS_MEDIA_FLAG MediaFlag,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFMIFSCALLBACK Callback)
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
VfatFormat(IN PUNICODE_STRING DriveRoot,
|
||||
IN FMIFS_MEDIA_FLAG MediaFlag,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN ULONG ClusterSize,
|
||||
IN PFMIFSCALLBACK Callback)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
DISK_GEOMETRY DiskGeometry;
|
||||
|
@ -208,6 +209,7 @@ UpdateProgress (PFORMAT_CONTEXT Context,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
VfatPrint(PCHAR Format, ...)
|
||||
{
|
||||
|
@ -224,12 +226,14 @@ VfatPrint(PCHAR Format, ...)
|
|||
TextOut.Output = TextBuf;
|
||||
|
||||
/* Do the callback */
|
||||
if (ChkdskCallback) ChkdskCallback(OUTPUT, 0, &TextOut);
|
||||
if (ChkdskCallback)
|
||||
ChkdskCallback(OUTPUT, 0, &TextOut);
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI
|
||||
VfatChkdsk(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
|
||||
NTSTATUS
|
||||
WINAPI
|
||||
VfatChkdsk(IN PUNICODE_STRING DriveRoot,
|
||||
IN BOOLEAN FixErrors,
|
||||
IN BOOLEAN Verbose,
|
||||
IN BOOLEAN CheckOnlyIfDirty,
|
||||
|
@ -246,7 +250,8 @@ VfatChkdsk(
|
|||
|
||||
/* Set parameters */
|
||||
FsCheckFlags = 0;
|
||||
if (Verbose) FsCheckFlags |= FSCHECK_VERBOSE;
|
||||
if (Verbose)
|
||||
FsCheckFlags |= FSCHECK_VERBOSE;
|
||||
|
||||
FsCheckTotalFiles = 0;
|
||||
|
||||
|
@ -263,13 +268,20 @@ VfatChkdsk(
|
|||
}
|
||||
|
||||
read_boot(&fs);
|
||||
if (verify) VfatPrint("Starting check/repair pass.\n");
|
||||
while (read_fat(&fs), scan_root(&fs)) qfree(&FsCheckMemQueue);
|
||||
if (ScanDrive) fix_bad(&fs);
|
||||
if (verify)
|
||||
VfatPrint("Starting check/repair pass.\n");
|
||||
|
||||
while (read_fat(&fs), scan_root(&fs))
|
||||
qfree(&FsCheckMemQueue);
|
||||
|
||||
if (ScanDrive)
|
||||
fix_bad(&fs);
|
||||
|
||||
if (salvage_files)
|
||||
reclaim_file(&fs);
|
||||
else
|
||||
reclaim_free(&fs);
|
||||
|
||||
free_clusters = update_free(&fs);
|
||||
file_unused();
|
||||
qfree(&FsCheckMemQueue);
|
||||
|
|
|
@ -12,14 +12,16 @@
|
|||
#include <debug.h>
|
||||
|
||||
static ULONG
|
||||
GetShiftCount(ULONG Value)
|
||||
GetShiftCount(IN ULONG Value)
|
||||
{
|
||||
ULONG i = 1;
|
||||
|
||||
while (Value > 0)
|
||||
{
|
||||
i++;
|
||||
Value /= 2;
|
||||
}
|
||||
|
||||
return i - 2;
|
||||
}
|
||||
|
||||
|
@ -60,7 +62,7 @@ FatxWriteBootSector (IN HANDLE FileHandle,
|
|||
0,
|
||||
sizeof(FATX_BOOT_SECTOR));
|
||||
if (NewBootSector == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the new bootsector */
|
||||
memset(NewBootSector, 0, sizeof(FATX_BOOT_SECTOR));
|
||||
|
@ -113,7 +115,7 @@ Fatx16WriteFAT (IN HANDLE FileHandle,
|
|||
0,
|
||||
32 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 32 * 1024);
|
||||
|
@ -141,7 +143,7 @@ Fatx16WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VfatxUpdateProgress(Context, 1);
|
||||
|
@ -173,7 +175,7 @@ Fatx16WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VfatxUpdateProgress(Context, Sectors);
|
||||
|
@ -182,7 +184,7 @@ Fatx16WriteFAT (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
|
@ -203,7 +205,7 @@ Fatx32WriteFAT (IN HANDLE FileHandle,
|
|||
0,
|
||||
64 * 1024);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0, 64 * 1024);
|
||||
|
@ -213,6 +215,7 @@ Fatx32WriteFAT (IN HANDLE FileHandle,
|
|||
Buffer[1] = 0xff;
|
||||
Buffer[2] = 0xff;
|
||||
Buffer[3] = 0x0f;
|
||||
|
||||
/* FAT cluster 1 */
|
||||
Buffer[4] = 0xff; /* Clean shutdown, no disk read/write errors, end-of-cluster (EOC) mark */
|
||||
Buffer[5] = 0xff;
|
||||
|
@ -234,7 +237,7 @@ Fatx32WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VfatxUpdateProgress(Context, 1);
|
||||
|
@ -267,7 +270,7 @@ Fatx32WriteFAT (IN HANDLE FileHandle,
|
|||
{
|
||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VfatxUpdateProgress(Context, Sectors);
|
||||
|
@ -276,7 +279,7 @@ Fatx32WriteFAT (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
|
@ -303,7 +306,7 @@ FatxWriteRootDirectory (IN HANDLE FileHandle,
|
|||
0,
|
||||
RootDirSectors * 512);
|
||||
if (Buffer == NULL)
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Zero the buffer */
|
||||
memset(Buffer, 0xff, RootDirSectors * 512);
|
||||
|
@ -328,23 +331,22 @@ FatxWriteRootDirectory (IN HANDLE FileHandle,
|
|||
/* Free the buffer */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
||||
|
||||
return(Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatxFormat (HANDLE FileHandle,
|
||||
PPARTITION_INFORMATION PartitionInfo,
|
||||
PDISK_GEOMETRY DiskGeometry,
|
||||
BOOLEAN QuickFormat,
|
||||
PFORMAT_CONTEXT Context)
|
||||
FatxFormat(IN HANDLE FileHandle,
|
||||
IN PPARTITION_INFORMATION PartitionInfo,
|
||||
IN PDISK_GEOMETRY DiskGeometry,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN OUT PFORMAT_CONTEXT Context)
|
||||
{
|
||||
FATX_BOOT_SECTOR BootSector;
|
||||
ULONGLONG SectorCount;
|
||||
ULONG ClusterCount;
|
||||
ULONG RootDirSectors;
|
||||
ULONG FATSectors;
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
SectorCount = PartitionInfo->PartitionLength.QuadPart >> GetShiftCount(512); /* Use shifting to avoid 64-bit division */
|
||||
|
@ -404,6 +406,7 @@ FatxFormat (HANDLE FileHandle,
|
|||
FATSectors,
|
||||
Context);
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("FatxWriteFAT() failed with status 0x%.08x\n", Status);
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#include <debug.h>
|
||||
|
||||
NTSTATUS NTAPI
|
||||
VfatxFormat (PUNICODE_STRING DriveRoot,
|
||||
FMIFS_MEDIA_FLAG MediaFlag,
|
||||
PUNICODE_STRING Label,
|
||||
BOOLEAN QuickFormat,
|
||||
ULONG ClusterSize,
|
||||
PFMIFSCALLBACK Callback)
|
||||
VfatxFormat(IN PUNICODE_STRING DriveRoot,
|
||||
IN FMIFS_MEDIA_FLAG MediaFlag,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN ULONG ClusterSize,
|
||||
IN PFMIFSCALLBACK Callback)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
DISK_GEOMETRY DiskGeometry;
|
||||
|
@ -157,14 +157,13 @@ VfatxFormat (PUNICODE_STRING DriveRoot,
|
|||
|
||||
|
||||
VOID
|
||||
VfatxUpdateProgress (PFORMAT_CONTEXT Context,
|
||||
ULONG Increment)
|
||||
VfatxUpdateProgress(IN PFORMAT_CONTEXT Context,
|
||||
IN ULONG Increment)
|
||||
{
|
||||
ULONG NewPercent;
|
||||
|
||||
Context->CurrentSectorCount += (ULONGLONG)Increment;
|
||||
|
||||
|
||||
NewPercent = (Context->CurrentSectorCount * 100ULL) / Context->TotalSectorCount;
|
||||
|
||||
if (NewPercent > Context->Percent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue