[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / arch / i386 / hardware.c
index 1dff167..97577aa 100644 (file)
@@ -452,7 +452,23 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
         SectorCount = Geometry.Sectors;
     }
     else
-        return EINVAL;
+    {
+        DPRINTM(DPRINT_HWDETECT, "Using legacy sector size detection\n");
+
+        /* Fall back to legacy detection */
+        if (DrivePartition == 0xff)
+        {
+            /* This is a CD-ROM device */
+            SectorSize = 2048;
+        }
+        else
+        {
+            /* This is either a floppy disk device (DrivePartition == 0) or
+             * a hard disk device (DrivePartition != 0 && DrivePartition != 0xFF) but
+             * it doesn't matter which one because they both have 512 bytes per sector */
+            SectorSize = 512;
+        }
+    }
 
     if (DrivePartition != 0xff && DrivePartition != 0)
     {