2005-07-31 12:11:56 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS VFATX filesystem library
|
|
|
|
* FILE: fatx.c
|
|
|
|
* PURPOSE: Fatx support
|
2006-01-17 23:11:13 +00:00
|
|
|
* PROGRAMMERS:
|
2005-07-31 12:11:56 +00:00
|
|
|
* REVISIONS:
|
|
|
|
*/
|
|
|
|
#include "vfatxlib.h"
|
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
static ULONG
|
2010-06-12 10:25:18 +00:00
|
|
|
GetShiftCount(IN ULONG Value)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
ULONG i = 1;
|
|
|
|
|
|
|
|
while (Value > 0)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
i++;
|
|
|
|
Value /= 2;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
2010-06-12 10:25:18 +00:00
|
|
|
|
|
|
|
return i - 2;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ULONG
|
|
|
|
CalcVolumeSerialNumber(VOID)
|
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
LARGE_INTEGER SystemTime;
|
|
|
|
TIME_FIELDS TimeFields;
|
|
|
|
ULONG Serial;
|
|
|
|
PUCHAR Buffer;
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
NtQuerySystemTime (&SystemTime);
|
|
|
|
RtlTimeToTimeFields (&SystemTime, &TimeFields);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
Buffer = (PUCHAR)&Serial;
|
|
|
|
Buffer[0] = (UCHAR)(TimeFields.Year & 0xFF) + (UCHAR)(TimeFields.Hour & 0xFF);
|
|
|
|
Buffer[1] = (UCHAR)(TimeFields.Year >> 8) + (UCHAR)(TimeFields.Minute & 0xFF);
|
|
|
|
Buffer[2] = (UCHAR)(TimeFields.Month & 0xFF) + (UCHAR)(TimeFields.Second & 0xFF);
|
|
|
|
Buffer[3] = (UCHAR)(TimeFields.Day & 0xFF) + (UCHAR)(TimeFields.Milliseconds & 0xFF);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Serial;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
FatxWriteBootSector(IN HANDLE FileHandle,
|
|
|
|
IN PFATX_BOOT_SECTOR BootSector,
|
|
|
|
IN OUT PFORMAT_CONTEXT Context)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PUCHAR NewBootSector;
|
|
|
|
LARGE_INTEGER FileOffset;
|
|
|
|
|
|
|
|
/* Allocate buffer for new bootsector */
|
|
|
|
NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
|
|
|
|
0,
|
|
|
|
sizeof(FATX_BOOT_SECTOR));
|
|
|
|
if (NewBootSector == NULL)
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
/* Zero the new bootsector */
|
|
|
|
memset(NewBootSector, 0, sizeof(FATX_BOOT_SECTOR));
|
|
|
|
|
|
|
|
/* Copy FAT16 BPB to new bootsector */
|
|
|
|
memcpy(NewBootSector, BootSector, 18); /* FAT16 BPB length (up to (not including) Res2) */
|
|
|
|
|
|
|
|
/* Write sector 0 */
|
|
|
|
FileOffset.QuadPart = 0ULL;
|
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
NewBootSector,
|
|
|
|
sizeof(FATX_BOOT_SECTOR),
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NewBootSector);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
VfatxUpdateProgress(Context, 1);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Free the new boot sector */
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NewBootSector);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
Fatx16WriteFAT(IN HANDLE FileHandle,
|
|
|
|
IN ULONG SectorOffset,
|
|
|
|
IN ULONG FATSectors,
|
|
|
|
IN OUT PFORMAT_CONTEXT Context)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PUCHAR Buffer;
|
|
|
|
LARGE_INTEGER FileOffset;
|
|
|
|
ULONG i;
|
|
|
|
ULONG Sectors;
|
|
|
|
|
|
|
|
/* Allocate buffer */
|
|
|
|
Buffer = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
|
|
|
|
0,
|
|
|
|
32 * 1024);
|
|
|
|
if (Buffer == NULL)
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
/* Zero the buffer */
|
|
|
|
memset(Buffer, 0, 32 * 1024);
|
|
|
|
|
|
|
|
/* FAT cluster 0 */
|
|
|
|
Buffer[0] = 0xf8; /* Media type */
|
|
|
|
Buffer[1] = 0xff;
|
|
|
|
|
|
|
|
/* FAT cluster 1 */
|
|
|
|
Buffer[2] = 0xff; /* Clean shutdown, no disk read/write errors, end-of-cluster (EOC) mark */
|
|
|
|
Buffer[3] = 0xff;
|
|
|
|
|
|
|
|
/* Write first sector of the FAT */
|
|
|
|
FileOffset.QuadPart = (SectorOffset * 512) + sizeof(FATX_BOOT_SECTOR);
|
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
512,
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
VfatxUpdateProgress(Context, 1);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero the begin of the buffer */
|
|
|
|
memset(Buffer, 0, 4);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero the rest of the FAT */
|
|
|
|
Sectors = 32 * 1024 / 512;
|
|
|
|
for (i = 1; i < FATSectors; i += Sectors)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero some sectors of the FAT */
|
|
|
|
FileOffset.QuadPart = (SectorOffset + i) * 512 + sizeof(FATX_BOOT_SECTOR) ;
|
|
|
|
if ((FATSectors - i) <= Sectors)
|
|
|
|
{
|
|
|
|
Sectors = FATSectors - i;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
Sectors * 512,
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
VfatxUpdateProgress(Context, Sectors);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Free the buffer */
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
Fatx32WriteFAT(IN HANDLE FileHandle,
|
|
|
|
IN ULONG SectorOffset,
|
|
|
|
IN ULONG FATSectors,
|
|
|
|
IN OUT PFORMAT_CONTEXT Context)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PUCHAR Buffer;
|
|
|
|
LARGE_INTEGER FileOffset;
|
|
|
|
ULONG i;
|
|
|
|
ULONG Sectors;
|
|
|
|
|
|
|
|
/* Allocate buffer */
|
|
|
|
Buffer = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
|
|
|
|
0,
|
|
|
|
64 * 1024);
|
|
|
|
if (Buffer == NULL)
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
/* Zero the buffer */
|
|
|
|
memset(Buffer, 0, 64 * 1024);
|
|
|
|
|
|
|
|
/* FAT cluster 0 */
|
|
|
|
Buffer[0] = 0xf8; /* Media type */
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* Write first sector of the FAT */
|
|
|
|
FileOffset.QuadPart = (SectorOffset * 512) + sizeof(FATX_BOOT_SECTOR);
|
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
512,
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
VfatxUpdateProgress(Context, 1);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero the begin of the buffer */
|
|
|
|
memset(Buffer, 0, 8);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero the rest of the FAT */
|
|
|
|
Sectors = 64 * 1024 / 512;
|
|
|
|
for (i = 1; i < FATSectors; i += Sectors)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Zero some sectors of the FAT */
|
|
|
|
FileOffset.QuadPart = (SectorOffset + i) * 512 + sizeof(FATX_BOOT_SECTOR);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
if ((FATSectors - i) <= Sectors)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
Sectors = FATSectors - i;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
Sectors * 512,
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
VfatxUpdateProgress(Context, Sectors);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Free the buffer */
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
FatxWriteRootDirectory(IN HANDLE FileHandle,
|
|
|
|
IN ULONG FATSectors,
|
|
|
|
IN OUT PFORMAT_CONTEXT Context)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PUCHAR Buffer;
|
|
|
|
LARGE_INTEGER FileOffset;
|
|
|
|
ULONG FirstRootDirSector;
|
|
|
|
ULONG RootDirSectors;
|
|
|
|
|
|
|
|
/* Write cluster */
|
|
|
|
RootDirSectors = 256 * 64 / 512;
|
|
|
|
FirstRootDirSector = sizeof(FATX_BOOT_SECTOR) / 512 + FATSectors;
|
|
|
|
|
|
|
|
DPRINT("RootDirSectors = %lu\n", RootDirSectors);
|
|
|
|
DPRINT("FirstRootDirSector = %lu\n", FirstRootDirSector);
|
|
|
|
|
|
|
|
/* Allocate buffer for the cluster */
|
|
|
|
Buffer = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(),
|
|
|
|
0,
|
|
|
|
RootDirSectors * 512);
|
|
|
|
if (Buffer == NULL)
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
/* Zero the buffer */
|
|
|
|
memset(Buffer, 0xff, RootDirSectors * 512);
|
|
|
|
|
|
|
|
/* Zero some sectors of the root directory */
|
|
|
|
FileOffset.QuadPart = FirstRootDirSector * 512;
|
|
|
|
|
|
|
|
Status = NtWriteFile(FileHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&IoStatusBlock,
|
|
|
|
Buffer,
|
|
|
|
RootDirSectors * 512,
|
|
|
|
&FileOffset,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Free the buffer */
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
FatxFormat(IN HANDLE FileHandle,
|
|
|
|
IN PPARTITION_INFORMATION PartitionInfo,
|
|
|
|
IN PDISK_GEOMETRY DiskGeometry,
|
|
|
|
IN BOOLEAN QuickFormat,
|
|
|
|
IN OUT PFORMAT_CONTEXT Context)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
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 */
|
|
|
|
|
|
|
|
memset(&BootSector, 0, sizeof(FATX_BOOT_SECTOR));
|
|
|
|
memcpy(&BootSector.SysType[0], "FATX", 4);
|
|
|
|
BootSector.SectorsPerCluster = 32;
|
|
|
|
BootSector.FATCount = 1;
|
|
|
|
BootSector.VolumeID = CalcVolumeSerialNumber();
|
|
|
|
RootDirSectors = 256 * 64 / 512;
|
|
|
|
|
|
|
|
/* Calculate number of FAT sectors */
|
|
|
|
ClusterCount = SectorCount >> GetShiftCount(32);
|
|
|
|
|
|
|
|
if (ClusterCount > 65525)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
FATSectors = (((ClusterCount * 4) + 4095) & ~4095) >> GetShiftCount(512);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
2010-06-12 10:25:18 +00:00
|
|
|
else
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
FATSectors = (((ClusterCount * 2) + 4095) & ~4095) >> GetShiftCount(512);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("FATSectors = %hu\n", FATSectors);
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
/* Init context data */
|
|
|
|
if (QuickFormat)
|
|
|
|
{
|
|
|
|
Context->TotalSectorCount =
|
|
|
|
1 + FATSectors + RootDirSectors;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Context->TotalSectorCount = SectorCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = FatxWriteBootSector(FileHandle,
|
|
|
|
&BootSector,
|
|
|
|
Context);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT("FatxWriteBootSector() failed with status 0x%.08x\n", Status);
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write first FAT copy */
|
|
|
|
if (ClusterCount > 65525)
|
|
|
|
{
|
|
|
|
Status = Fatx32WriteFAT(FileHandle,
|
|
|
|
0,
|
|
|
|
FATSectors,
|
|
|
|
Context);
|
|
|
|
}
|
|
|
|
else
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
Status = Fatx16WriteFAT(FileHandle,
|
|
|
|
0,
|
|
|
|
FATSectors,
|
|
|
|
Context);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("FatxWriteFAT() failed with status 0x%.08x\n", Status);
|
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
Status = FatxWriteRootDirectory(FileHandle,
|
|
|
|
FATSectors,
|
|
|
|
Context);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
DPRINT("FatxWriteRootDirectory() failed with status 0x%.08x\n", Status);
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
if (!QuickFormat)
|
2005-07-31 12:11:56 +00:00
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
/* FIXME: Fill remaining sectors */
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|
|
|
|
|
2010-06-12 10:25:18 +00:00
|
|
|
return Status;
|
2005-07-31 12:11:56 +00:00
|
|
|
}
|