[FREELDR]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 27 Nov 2011 10:00:24 +0000 (10:00 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 27 Nov 2011 10:00:24 +0000 (10:00 +0000)
PcDiskGetDriveGeometry: Try to retrieve the extended disk geometry first.

svn path=/trunk/; revision=54505

reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c

index 967d100..6a04730 100644 (file)
@@ -302,12 +302,25 @@ BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULON
 BOOLEAN
 PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
 {
+  EXTENDED_GEOMETRY ExtGeometry;
   REGS RegsIn;
   REGS RegsOut;
   ULONG Cylinders;
 
   TRACE("DiskGetDriveGeometry()\n");
 
+  /* Try to get the extended geometry first */
+  ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
+  if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size))
+  {
+    Geometry->Cylinders = ExtGeometry.Cylinders;
+    Geometry->Heads = ExtGeometry.Heads;
+    Geometry->Sectors = ExtGeometry.SectorsPerTrack;
+    Geometry->BytesPerSector = ExtGeometry.BytesPerSector;
+
+    return TRUE;
+  }
+
   /* BIOS Int 13h, function 08h - Get drive parameters
    * AH = 08h
    * DL = drive (bit 7 set for hard disk)