[FREELDR] Hack: Boot ReactOS even when a cdrom-drive does not report a proper geometry
authorEric Kohl <eric.kohl@reactos.org>
Thu, 19 Sep 2019 21:24:43 +0000 (23:24 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Thu, 19 Sep 2019 21:27:11 +0000 (23:27 +0200)
We need to find a way to retrieve the LBA sector count of a drive, not only its CHS geometry.

boot/freeldr/freeldr/arch/i386/hwdisk.c

index d67494d..1717bdb 100644 (file)
@@ -225,7 +225,9 @@ DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
 
     /* Convert in number of sectors */
     NewPosition.QuadPart /= Context->SectorSize;
-    if (NewPosition.QuadPart >= Context->SectorCount)
+
+    /* HACK: CDROMs may have a SectorCount of 0 */
+    if (Context->SectorCount != 0 && NewPosition.QuadPart >= Context->SectorCount)
         return EINVAL;
 
     Context->SectorNumber = NewPosition.QuadPart;