From 8773b1104ea5ad4b97993023cad8afa0cec5252e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 22 Aug 2003 13:55:36 +0000 Subject: [PATCH] Use FAT12 or FAT16 CHS for small partitions even if the drive supports LBA. svn path=/trunk/; revision=5754 --- reactos/subsys/system/usetup/usetup.c | 47 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/reactos/subsys/system/usetup/usetup.c b/reactos/subsys/system/usetup/usetup.c index 5765eb73af4..e1b7037d0a1 100644 --- a/reactos/subsys/system/usetup/usetup.c +++ b/reactos/subsys/system/usetup/usetup.c @@ -1583,30 +1583,41 @@ FormatPartitionPage (PINPUT_RECORD Ir) switch (FileSystemList->CurrentFileSystem) { case FsFat: - if (DiskEntry->UseLba == FALSE) + if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200ULL * 1024ULL)) { - if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL)) + /* FAT12 CHS partition (disk is smaller than 4.1MB) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12; + } + else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL)) + { + /* FAT16 CHS partition (disk is smaller than 32MB) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16; + } + else if (DiskEntry->UseLba == FALSE) + { + if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL)) { - /* FAT16 CHS partition (disk is smaller than 32MB) */ - PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16; + /* FAT16 CHS partition (disk is smaller than 512MB) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE; } else { - /* FAT16 CHS partition (disk is smaller than 8.4GB) */ - PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE; + /* FAT32 CHS partition (partition size 512MB or larger) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32; } } - else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL)) - { - /* FAT16 LBA partition (partition size is smaller than 512MB) */ - DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType); - PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13; - } else { - DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType); - /* FAT32 LBA partition (partition size 512MB or larger) */ - PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13; + if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL)) + { + /* FAT16 LBA partition (partition size is smaller than 512MB) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13; + } + else + { + /* FAT32 LBA partition (partition size 512MB or larger) */ + PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13; + } } break; @@ -1689,7 +1700,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) PartitionList->CurrentPartition->PartInfo[0].PartitionNumber); RtlCreateUnicodeString (&DestinationRootPath, PathBuffer); - DPRINT1 ("DestinationRootPath: %wZ\n", &DestinationRootPath); + DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath); /* Set SystemRootPath */ @@ -1700,7 +1711,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber); RtlCreateUnicodeString (&SystemRootPath, PathBuffer); - DPRINT1 ("SystemRootPath: %wZ\n", &SystemRootPath); + DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath); switch (FileSystemList->CurrentFileSystem) @@ -2036,7 +2047,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue)) break; - DPRINT1("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); + DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); /* Lookup target directory */ if (!InfFindFirstLine (SetupInf, L"Directories", FileKeyValue, &DirContext))