Support partition-less disks

svn path=/trunk/; revision=15334
This commit is contained in:
Gé van Geldorp 2005-05-16 11:06:57 +00:00
parent ca8a9b2dff
commit 9190f5135f
2 changed files with 31 additions and 12 deletions

View file

@ -205,9 +205,27 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON
{ {
// Partition requested was zero which means the boot partition // Partition requested was zero which means the boot partition
if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry)) if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
{
/* Try partition-less disk */
*StartSector = 0;
*SectorCount = 0;
}
/* Check for valid partition */
else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
{ {
return FALSE; return FALSE;
} }
else
{
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
}
}
else if (0xff == i386BootPartition)
{
/* Partition-less disk */
*StartSector = 0;
*SectorCount = 0;
} }
else else
{ {
@ -216,25 +234,26 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON
{ {
return FALSE; return FALSE;
} }
} /* Check for valid partition */
else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
// Check for valid partition {
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) return FALSE;
{ }
return FALSE; else
{
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
}
} }
// Try to recognize the file system // Try to recognize the file system
if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) if (!FsRecognizeVolume(i386BootDrive, *StartSector, &VolumeType))
{ {
return FALSE; return FALSE;
} }
*DriveNumber = i386BootDrive; *DriveNumber = i386BootDrive;
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
*SectorCount = PartitionTableEntry.PartitionSectorCount;
//switch (PartitionTableEntry.SystemIndicator)
switch (VolumeType) switch (VolumeType)
{ {
case PARTITION_FAT_12: case PARTITION_FAT_12:

View file

@ -63,12 +63,12 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
// Make sure there was only one bootable partition // Make sure there was only one bootable partition
if (BootablePartitionCount == 0) if (BootablePartitionCount == 0)
{ {
DiskError("No bootable (active) partitions found.", 0); DbgPrint((DPRINT_DISK, "No bootable (active) partitions found.\n"));
return FALSE; return FALSE;
} }
else if (BootablePartitionCount != 1) else if (BootablePartitionCount != 1)
{ {
DiskError("Too many bootable (active) partitions found.", 0); DbgPrint((DPRINT_DISK, "Too many bootable (active) partitions found.\n"));
return FALSE; return FALSE;
} }