Author: cgutman
Date: Wed Apr 28 00:12:11 2010
New Revision: 47051
URL:
http://svn.reactos.org/svn/reactos?rev=47051&view=rev
Log:
[FREELDR]
- Set the partition count to 0 for a floppy drive so it can be told apart from a cd-rom
drive
- Add a last-chance sector size detection algorithm based on the partition number
- Add the same detection code to the xbox code too (it is essentially the same as what was
already there just with more comments)
- Change DiskNormalizeSystemPath so it doesn't try to "normalize" a floppy
boot path
- Fixes bug #5233
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
trunk/reactos/boot/freeldr/freeldr/disk/disk.c
trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Wed Apr 28
00:12:11 2010
@@ -452,7 +452,23 @@
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)
{
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Wed Apr 28 00:12:11
2010
@@ -138,7 +138,20 @@
if (!DissectArcPath(Path, FileName, &DriveNumber, &DrivePartition))
return EINVAL;
- SectorSize = (DrivePartition == 0xff ? 2048 : 512);
+
+ 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)
{
if (!XboxDiskGetPartitionEntry(DriveNumber, DrivePartition,
&PartitionTableEntry))
Modified: trunk/reactos/boot/freeldr/freeldr/disk/disk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/disk.c [iso-8859-1] Wed Apr 28 00:12:11 2010
@@ -136,7 +136,7 @@
return FALSE;
}
- if (0 != PartitionNumber)
+ if (0 != PartitionNumber || DriveNumber < 0x80)
{
return TRUE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/arcname.c [iso-8859-1] Wed Apr 28 00:12:11
2010
@@ -60,7 +60,7 @@
if (p == NULL)
return FALSE;
p++;
- *BootPartition = 0xff;
+ *BootPartition = 0;
}
else if (_strnicmp(p, "cdrom(", 6) == 0)
{