393{
399 ULONG UsableFatEntries;
400 ULONG FirstDataSector;
402
403
405 {
406 if (
PartitionInfo->PartitionLength.QuadPart < 8LL * 1024LL * 1024LL * 1024LL)
407 {
408
410 }
411 else if (
PartitionInfo->PartitionLength.QuadPart < 16LL * 1024LL * 1024LL * 1024LL)
412 {
413
415 }
416 else if (
PartitionInfo->PartitionLength.QuadPart < 32LL * 1024LL * 1024LL * 1024LL)
417 {
418
420 }
421 else
422 {
423
425 }
426 }
427
430
457 {
459 }
460 else
461 {
465 VolumeLabel.Length < 11 ? VolumeLabel.Length : 11);
467 }
468
470
471
472
475 BootSector.FATSectors32 = (TmpVal1 + (TmpVal2 - 1)) / TmpVal2;
477
478
482 if (DataClusters > UsableFatEntries)
483 {
484
485 BootSector.FATSectors32 += (DataClusters - UsableFatEntries);
486
487 DPRINT(
"UsableFatEntries = %lu\n", UsableFatEntries);
488 DPRINT(
"DataClusters = %lu\n", DataClusters);
489 DPRINT(
"BootSector.FATSectors32 incremented to %lu\n",
BootSector.FATSectors32);
490 }
491
492
495
497 {
499
506 {
507 DPRINT(
"FatWipeSectors() failed with status 0x%.08x\n",
Status);
509 }
510 }
511
516 {
517 DPRINT(
"Fat32WriteBootSector() failed with status 0x%.08x\n",
Status);
519 }
520
525 {
526 DPRINT(
"Fat32WriteFsInfo() failed with status 0x%.08x\n",
Status);
528 }
529
530
532 0,
536 {
537 DPRINT(
"Fat32WriteFAT() failed with status 0x%.08x\n",
Status);
539 }
540
541
547 {
548 DPRINT(
"Fat32WriteFAT() failed with status 0x%.08x.\n",
Status);
550 }
551
556 {
557 DPRINT(
"Fat32WriteRootDirectory() failed with status 0x%.08x\n",
Status);
558 }
559
561}
#define NT_SUCCESS(StatCode)
static NTSTATUS Fat32WriteFAT(IN HANDLE FileHandle, IN ULONG SectorOffset, IN PFAT32_BOOT_SECTOR BootSector, IN OUT PFORMAT_CONTEXT Context)
static NTSTATUS Fat32WriteFsInfo(IN HANDLE FileHandle, IN PFAT32_BOOT_SECTOR BootSector, IN OUT PFORMAT_CONTEXT Context)
static NTSTATUS Fat32WriteBootSector(IN HANDLE FileHandle, IN PFAT32_BOOT_SECTOR BootSector, IN OUT PFORMAT_CONTEXT Context)
static NTSTATUS Fat32WriteRootDirectory(IN HANDLE FileHandle, IN PFAT32_BOOT_SECTOR BootSector, IN OUT PFORMAT_CONTEXT Context)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
VOID NTAPI RtlFreeOemString(POEM_STRING OemString)
#define RtlFillMemory(Dest, Length, Fill)
#define memcpy(s1, s2, n)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
ULONG GetShiftCount(IN ULONG Value)
NTSTATUS FatWipeSectors(IN HANDLE FileHandle, IN ULONG TotalSectors, IN ULONG SectorsPerCluster, IN ULONG BytesPerSector, IN OUT PFORMAT_CONTEXT Context)
ULONG CalcVolumeSerialNumber(VOID)
#define RtlZeroMemory(Destination, Length)
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo