Author: cgutman Date: Tue Feb 16 21:32:58 2010 New Revision: 45602
URL: http://svn.reactos.org/svn/reactos?rev=45602&view=rev Log: - Fix incorrect sector size detection which caused seeking to fail when booting from a floppy - FreeLoader can load from a floppy disk now
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Tue Feb 16 21:32:58 2010 @@ -433,21 +433,33 @@ ULONGLONG SectorOffset = 0; ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; + GEOMETRY Geometry; + EXTENDED_GEOMETRY ExtGeometry; CHAR FileName[1];
if (!DissectArcPath(Path, FileName, &DriveNumber, &DrivePartition)) return EINVAL; - SectorSize = (DrivePartition == 0xff ? 2048 : 512); + + ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY); + if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size)) + { + SectorSize = ExtGeometry.BytesPerSector; + SectorCount = ExtGeometry.Sectors; + } + else if (MachDiskGetDriveGeometry(DriveNumber, &Geometry)) + { + SectorSize = Geometry.BytesPerSector; + SectorCount = Geometry.Sectors; + } + else + return EINVAL; + if (DrivePartition != 0xff && DrivePartition != 0) { if (!DiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry)) return EINVAL; SectorOffset = PartitionTableEntry.SectorCountBeforePartition; SectorCount = PartitionTableEntry.PartitionSectorCount; - } - else - { - SectorCount = 0; /* FIXME */ }
Context = MmHeapAlloc(sizeof(DISKCONTEXT));