68 if (NewBootSector ==
NULL)
159 Sectors = 32 * 1024 / 512;
160 for (
i = 1;
i < FATSectors;
i += Sectors)
164 if ((FATSectors -
i) <= Sectors)
166 Sectors = FATSectors -
i;
253 Sectors = 64 * 1024 / 512;
254 for (
i = 1;
i < FATSectors;
i += Sectors)
259 if ((FATSectors -
i) <= Sectors)
261 Sectors = FATSectors -
i;
298 ULONG FirstRootDirSector;
299 ULONG RootDirSectors;
302 RootDirSectors = 256 * 64 / 512;
305 DPRINT(
"RootDirSectors = %lu\n", RootDirSectors);
306 DPRINT(
"FirstRootDirSector = %lu\n", FirstRootDirSector);
311 RootDirSectors * 512);
319 FileOffset.QuadPart = FirstRootDirSector * 512;
327 RootDirSectors * 512,
352 ULONG RootDirSectors;
363 RootDirSectors = 256 * 64 / 512;
368 if (ClusterCount > 65525)
370 FATSectors = (((ClusterCount * 4) + 4095) & ~4095) >>
GetShiftCount(512);
374 FATSectors = (((ClusterCount * 2) + 4095) & ~4095) >>
GetShiftCount(512);
376 DPRINT(
"FATSectors = %hu\n", FATSectors);
382 1 + FATSectors + RootDirSectors;
394 DPRINT(
"FatxWriteBootSector() failed with status 0x%.08x\n",
Status);
399 if (ClusterCount > 65525)
416 DPRINT(
"FatxWriteFAT() failed with status 0x%.08x\n",
Status);
425 DPRINT(
"FatxWriteRootDirectory() failed with status 0x%.08x\n",
Status);
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
_In_ PFCB _In_ LONGLONG FileOffset
#define NT_SUCCESS(StatCode)
struct _FATX_BOOT_SECTOR FATX_BOOT_SECTOR
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
static OUT PIO_STATUS_BLOCK IoStatusBlock
static PTIME_FIELDS TimeFields
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
static NTSTATUS FatxWriteRootDirectory(IN HANDLE FileHandle, IN ULONG FATSectors, IN OUT PFORMAT_CONTEXT Context)
static ULONG GetShiftCount(IN ULONG Value)
static NTSTATUS Fatx16WriteFAT(IN HANDLE FileHandle, IN ULONG SectorOffset, IN ULONG FATSectors, IN OUT PFORMAT_CONTEXT Context)
static NTSTATUS Fatx32WriteFAT(IN HANDLE FileHandle, IN ULONG SectorOffset, IN ULONG FATSectors, IN OUT PFORMAT_CONTEXT Context)
NTSTATUS FatxFormat(IN HANDLE FileHandle, IN PPARTITION_INFORMATION PartitionInfo, IN PDISK_GEOMETRY DiskGeometry, IN BOOLEAN QuickFormat, IN OUT PFORMAT_CONTEXT Context)
static ULONG CalcVolumeSerialNumber(VOID)
static NTSTATUS FatxWriteBootSector(IN HANDLE FileHandle, IN PFATX_BOOT_SECTOR BootSector, IN OUT PFORMAT_CONTEXT Context)
#define STATUS_INSUFFICIENT_RESOURCES
VOID VfatxUpdateProgress(IN PFORMAT_CONTEXT Context, IN ULONG Increment)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo