https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2ed695fc83296f206097b4ab82e64ab37793ff7b

commit 2ed695fc83296f206097b4ab82e64ab37793ff7b
Author:     Eric Kohl <[email protected]>
AuthorDate: Thu Sep 19 23:24:43 2019 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Thu Sep 19 23:27:11 2019 +0200

    [FREELDR] Hack: Boot ReactOS even when a cdrom-drive does not report a 
proper geometry
    
    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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/boot/freeldr/freeldr/arch/i386/hwdisk.c 
b/boot/freeldr/freeldr/arch/i386/hwdisk.c
index d67494d508d..1717bdbd2dd 100644
--- a/boot/freeldr/freeldr/arch/i386/hwdisk.c
+++ b/boot/freeldr/freeldr/arch/i386/hwdisk.c
@@ -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;

Reply via email to