mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:42:59 +00:00
- Fix incorrect sector size detection which caused seeking to fail when booting from a floppy
- FreeLoader can load from a floppy disk now svn path=/trunk/; revision=45602
This commit is contained in:
parent
690fd6eb6d
commit
3874d4ff4e
1 changed files with 17 additions and 5 deletions
|
@ -433,11 +433,27 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
ULONGLONG SectorOffset = 0;
|
ULONGLONG SectorOffset = 0;
|
||||||
ULONGLONG SectorCount = 0;
|
ULONGLONG SectorCount = 0;
|
||||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||||
|
GEOMETRY Geometry;
|
||||||
|
EXTENDED_GEOMETRY ExtGeometry;
|
||||||
CHAR FileName[1];
|
CHAR FileName[1];
|
||||||
|
|
||||||
if (!DissectArcPath(Path, FileName, &DriveNumber, &DrivePartition))
|
if (!DissectArcPath(Path, FileName, &DriveNumber, &DrivePartition))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
SectorSize = (DrivePartition == 0xff ? 2048 : 512);
|
|
||||||
|
ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
|
||||||
|
if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size))
|
||||||
|
{
|
||||||
|
SectorSize = ExtGeometry.BytesPerSector;
|
||||||
|
SectorCount = ExtGeometry.Sectors;
|
||||||
|
}
|
||||||
|
else if (MachDiskGetDriveGeometry(DriveNumber, &Geometry))
|
||||||
|
{
|
||||||
|
SectorSize = Geometry.BytesPerSector;
|
||||||
|
SectorCount = Geometry.Sectors;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
if (DrivePartition != 0xff && DrivePartition != 0)
|
if (DrivePartition != 0xff && DrivePartition != 0)
|
||||||
{
|
{
|
||||||
if (!DiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry))
|
if (!DiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry))
|
||||||
|
@ -445,10 +461,6 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
|
||||||
SectorOffset = PartitionTableEntry.SectorCountBeforePartition;
|
SectorOffset = PartitionTableEntry.SectorCountBeforePartition;
|
||||||
SectorCount = PartitionTableEntry.PartitionSectorCount;
|
SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SectorCount = 0; /* FIXME */
|
|
||||||
}
|
|
||||||
|
|
||||||
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
Context = MmHeapAlloc(sizeof(DISKCONTEXT));
|
||||||
if (!Context)
|
if (!Context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue