Use FAT12 or FAT16 CHS for small partitions even if the drive supports LBA.

svn path=/trunk/; revision=5754
This commit is contained in:
Eric Kohl 2003-08-22 13:55:36 +00:00
parent b5984d7099
commit 8773b1104e

View file

@ -1583,31 +1583,42 @@ FormatPartitionPage (PINPUT_RECORD Ir)
switch (FileSystemList->CurrentFileSystem) switch (FileSystemList->CurrentFileSystem)
{ {
case FsFat: 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) */ /* FAT16 CHS partition (disk is smaller than 32MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16; PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
} }
else else if (DiskEntry->UseLba == FALSE)
{ {
/* FAT16 CHS partition (disk is smaller than 8.4GB) */ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
{
/* FAT16 CHS partition (disk is smaller than 512MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE; PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
} }
else
{
/* FAT32 CHS partition (partition size 512MB or larger) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32;
} }
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL)) }
else
{
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
{ {
/* FAT16 LBA partition (partition size is smaller than 512MB) */ /* FAT16 LBA partition (partition size is smaller than 512MB) */
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13; PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
} }
else else
{ {
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
/* FAT32 LBA partition (partition size 512MB or larger) */ /* FAT32 LBA partition (partition size 512MB or larger) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13; PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
} }
}
break; break;
case FsKeep: case FsKeep:
@ -1689,7 +1700,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber); PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
RtlCreateUnicodeString (&DestinationRootPath, RtlCreateUnicodeString (&DestinationRootPath,
PathBuffer); PathBuffer);
DPRINT1 ("DestinationRootPath: %wZ\n", &DestinationRootPath); DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath);
/* Set SystemRootPath */ /* Set SystemRootPath */
@ -1700,7 +1711,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber); PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
RtlCreateUnicodeString (&SystemRootPath, RtlCreateUnicodeString (&SystemRootPath,
PathBuffer); PathBuffer);
DPRINT1 ("SystemRootPath: %wZ\n", &SystemRootPath); DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath);
switch (FileSystemList->CurrentFileSystem) switch (FileSystemList->CurrentFileSystem)
@ -2036,7 +2047,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue)) if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue))
break; break;
DPRINT1("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
/* Lookup target directory */ /* Lookup target directory */
if (!InfFindFirstLine (SetupInf, L"Directories", FileKeyValue, &DirContext)) if (!InfFindFirstLine (SetupInf, L"Directories", FileKeyValue, &DirContext))