i bet it would be better for fixing this that this patch were committed in
main trunk.... ;)
On Thu, Sep 9, 2010 at 3:44 PM, Eric Kohl <eric.kohl(a)t-online.de> wrote:
Hi!
This patch fixes the disk geometry bug I mentioned in my previous mail. It
enables disk.sys and usetup.exe to use the same disk geometry that is used
by the BIOS.
Due to another bug or workaround in the 1st stage setup, the 2nd stage
setup will not boot at all.
Regards,
Eric
Index: boot/freeldr/freeldr/arch/i386/hardware.c
===================================================================
--- boot/freeldr/freeldr/arch/i386/hardware.c (revision 48722)
+++ boot/freeldr/freeldr/arch/i386/hardware.c (working copy)
@@ -327,7 +327,6 @@
{
PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
- EXTENDED_GEOMETRY ExtGeometry;
GEOMETRY Geometry;
ULONG Size;
@@ -362,16 +361,8 @@
DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) +
sizeof(CM_PARTIAL_RESOURCE_LIST));
/* Get the disk geometry */
- ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
- if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry,
ExtGeometry.Size))
+ if(MachDiskGetDriveGeometry(DriveNumber, &Geometry))
{
- DiskGeometry->BytesPerSector = ExtGeometry.BytesPerSector;
- DiskGeometry->NumberOfCylinders = ExtGeometry.Cylinders;
- DiskGeometry->SectorsPerTrack = ExtGeometry.SectorsPerTrack;
- DiskGeometry->NumberOfHeads = ExtGeometry.Heads;
- }
- else if(MachDiskGetDriveGeometry(DriveNumber, &Geometry))
- {
DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
DiskGeometry->SectorsPerTrack = Geometry.Sectors;
Index: boot/freeldr/freeldr/arch/i386/pcdisk.c
===================================================================
--- boot/freeldr/freeldr/arch/i386/pcdisk.c (revision 48722)
+++ boot/freeldr/freeldr/arch/i386/pcdisk.c (working copy)
@@ -296,12 +296,25 @@
BOOLEAN
PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
{
+ EXTENDED_GEOMETRY ExtGeometry;
REGS RegsIn;
REGS RegsOut;
ULONG Cylinders;
DPRINTM(DPRINT_DISK, "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)
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev