From 785882957e9f289b3653e570b1c57e97a201e893 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Tue, 5 Apr 2005 17:12:52 +0000 Subject: [PATCH] - Changed the calculation of the current sector count to read or write from both sides of a floppy in one step. - Set the EOT sector always to the last sector of a floppy. svn path=/trunk/; revision=14506 --- reactos/drivers/storage/floppy/readwrite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/storage/floppy/readwrite.c b/reactos/drivers/storage/floppy/readwrite.c index fe803085427..c703b23cd1b 100644 --- a/reactos/drivers/storage/floppy/readwrite.c +++ b/reactos/drivers/storage/floppy/readwrite.c @@ -654,10 +654,10 @@ VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, KdPrint(("floppy: ReadWritePassive(): computing number of sectors to transfer (StartSector 0x%x): ", StartSector)); /* 1-based sector number */ - if( ((DriveInfo->DiskGeometry.SectorsPerTrack - StartSector) + 1) < + if( (((DriveInfo->DiskGeometry.TracksPerCylinder - Head) * DriveInfo->DiskGeometry.SectorsPerTrack - StartSector) + 1 ) < (Length - TransferByteOffset) / DriveInfo->DiskGeometry.BytesPerSector) { - CurrentTransferSectors = (UCHAR)(DriveInfo->DiskGeometry.SectorsPerTrack - StartSector) + 1; + CurrentTransferSectors = (UCHAR)((DriveInfo->DiskGeometry.TracksPerCylinder - Head) * DriveInfo->DiskGeometry.SectorsPerTrack - StartSector) + 1; } else { @@ -703,7 +703,7 @@ VOID NTAPI ReadWritePassive(PDRIVE_INFO DriveInfo, /* Issue the read/write command to the controller. Note that it expects the opposite of WriteToDevice. */ if(HwReadWriteData(DriveInfo->ControllerInfo, !WriteToDevice, DriveInfo->UnitNumber, Cylinder, Head, StartSector, - DriveInfo->BytesPerSectorCode, StartSector + CurrentTransferSectors, 0, 0xff) != STATUS_SUCCESS) + DriveInfo->BytesPerSectorCode, DriveInfo->DiskGeometry.SectorsPerTrack, 0, 0xff) != STATUS_SUCCESS) { KdPrint(("floppy: ReadWritePassive(): HwReadWriteData returned failure; unable to read; completing with STATUS_UNSUCCESSFUL\n")); RWFreeAdapterChannel(DriveInfo->ControllerInfo->AdapterObject);