From b3f11cfb38ec8872c3ad22cdc1f3952dde2d60ca Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Tue, 23 Aug 2005 17:42:12 +0000 Subject: [PATCH] Fixed the calculation of the boot disk number in i386DiskGetSystemVolume. We have to count all used partititions instead of the known one. svn path=/trunk/; revision=17484 --- .../boot/freeldr/freeldr/arch/i386/i386disk.c | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c index 95f766d2e1b..a0669a060be 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c @@ -165,6 +165,36 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff memcpy(Buffer, Ptr, BufferSize); + DbgPrint((DPRINT_DISK, "size of buffer: %x\n", Ptr[0])); + DbgPrint((DPRINT_DISK, "information flags: %x\n", Ptr[1])); + DbgPrint((DPRINT_DISK, "number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2])); + DbgPrint((DPRINT_DISK, "number of physical heads on drive: %u\n", *(PULONG)&Ptr[4])); + DbgPrint((DPRINT_DISK, "number of physical sectors per track: %u\n", *(PULONG)&Ptr[6])); + DbgPrint((DPRINT_DISK, "total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8])); + DbgPrint((DPRINT_DISK, "bytes per sector: %u\n", Ptr[12])); + if (Ptr[0] >= 0x1e) + { + DbgPrint((DPRINT_HB, "EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14])); + if (Ptr[13] != 0xffff && Ptr[14] != 0xffff) + { + PUCHAR SpecPtr = (PUCHAR)((Ptr[13] << 4) + Ptr[14]); + DbgPrint((DPRINT_DISK, "SpecPtr: %x\n", SpecPtr)); + DbgPrint((DPRINT_DISK, "physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0])); + DbgPrint((DPRINT_DISK, "disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2])); + DbgPrint((DPRINT_DISK, "drive flags: %x\n", SpecPtr[4])); + DbgPrint((DPRINT_DISK, "proprietary information: %x\n", SpecPtr[5])); + DbgPrint((DPRINT_DISK, "IRQ for drive: %u\n", SpecPtr[6])); + DbgPrint((DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7])); + DbgPrint((DPRINT_DISK, "DMA control: %x\n", SpecPtr[8])); + DbgPrint((DPRINT_DISK, "programmed I/O control: %x\n", SpecPtr[9])); + DbgPrint((DPRINT_DISK, "drive options: %x\n", *(PUSHORT)&SpecPtr[10])); + } + } + if (Ptr[0] >= 0x42) + { + DbgPrint((DPRINT_HB, "signature: %x\n", Ptr[15])); + } + return TRUE; } @@ -301,6 +331,10 @@ i386DiskBootingFromFloppy(VOID) (P) == PARTITION_FAT32_XINT13 || \ (P) == PARTITION_XINT13) +#define IsContainerPartition(P) \ + ((P) == PARTITION_EXTENDED || \ + (P) == PARTITION_XINT13_EXTENDED) + BOOL i386DiskGetSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device, @@ -344,7 +378,8 @@ BOOL i386DiskGetSystemVolume(char *SystemPath, { return FALSE; } - if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator)) + if (!IsContainerPartition(PartitionTableEntry.SystemIndicator) && + PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) { if (++RosPartition == PartitionNumber) {