diff --git a/reactos/drivers/storage/floppy/readwrite.c b/reactos/drivers/storage/floppy/readwrite.c index bc5a851dd4b..13efa2afa06 100644 --- a/reactos/drivers/storage/floppy/readwrite.c +++ b/reactos/drivers/storage/floppy/readwrite.c @@ -660,10 +660,15 @@ 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) < Length / DriveInfo->DiskGeometry.BytesPerSector) + if( (DriveInfo->DiskGeometry.SectorsPerTrack - StartSector + 1) < + (Length - TransferByteOffset) / DriveInfo->DiskGeometry.BytesPerSector) + { CurrentTransferSectors = (UCHAR)DriveInfo->DiskGeometry.SectorsPerTrack - StartSector + 1; + } else - CurrentTransferSectors = (UCHAR)(Length / DriveInfo->DiskGeometry.BytesPerSector); + { + CurrentTransferSectors = (UCHAR)((Length - TransferByteOffset) / DriveInfo->DiskGeometry.BytesPerSector); + } KdPrint(("0x%x\n", CurrentTransferSectors));