From 9190f5135ff31e14dbe62a389517b8f2c3fca525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 16 May 2005 11:06:57 +0000 Subject: [PATCH] Support partition-less disks svn path=/trunk/; revision=15334 --- .../boot/freeldr/freeldr/arch/i386/i386disk.c | 39 ++++++++++++++----- reactos/boot/freeldr/freeldr/disk/partition.c | 4 +- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c index 42bb8c82ed5..95f766d2e1b 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c @@ -205,9 +205,27 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON { // Partition requested was zero which means the boot partition 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; } + else + { + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + } + } + else if (0xff == i386BootPartition) + { + /* Partition-less disk */ + *StartSector = 0; + *SectorCount = 0; } else { @@ -216,25 +234,26 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON { return FALSE; } - } - - // Check for valid partition - if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) - { - return FALSE; + /* Check for valid partition */ + else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED) + { + return FALSE; + } + else + { + *StartSector = PartitionTableEntry.SectorCountBeforePartition; + *SectorCount = PartitionTableEntry.PartitionSectorCount; + } } // Try to recognize the file system - if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType)) + if (!FsRecognizeVolume(i386BootDrive, *StartSector, &VolumeType)) { return FALSE; } *DriveNumber = i386BootDrive; - *StartSector = PartitionTableEntry.SectorCountBeforePartition; - *SectorCount = PartitionTableEntry.PartitionSectorCount; - //switch (PartitionTableEntry.SystemIndicator) switch (VolumeType) { case PARTITION_FAT_12: diff --git a/reactos/boot/freeldr/freeldr/disk/partition.c b/reactos/boot/freeldr/freeldr/disk/partition.c index b33a9daa382..1589cff04eb 100644 --- a/reactos/boot/freeldr/freeldr/disk/partition.c +++ b/reactos/boot/freeldr/freeldr/disk/partition.c @@ -63,12 +63,12 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti // Make sure there was only one bootable partition if (BootablePartitionCount == 0) { - DiskError("No bootable (active) partitions found.", 0); + DbgPrint((DPRINT_DISK, "No bootable (active) partitions found.\n")); return FALSE; } else if (BootablePartitionCount != 1) { - DiskError("Too many bootable (active) partitions found.", 0); + DbgPrint((DPRINT_DISK, "Too many bootable (active) partitions found.\n")); return FALSE; }