From 39fa117fd69c74613fb6e0ac27166352d3cbb42b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 11 Sep 2012 19:11:56 +0000 Subject: [PATCH] [FREELDR] Revert once again. testbot hates me. sigh... svn path=/trunk/; revision=57281 --- .../boot/freeldr/freeldr/arch/i386/hwdisk.c | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c b/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c index 926f5ef7164..1eb5e84e950 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c @@ -114,45 +114,31 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) { DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); UCHAR* Ptr = (UCHAR*)Buffer; - ULONG Length, TotalSectors, MaxSectors, ReadSectors; + ULONG i, Length; BOOLEAN ret; - ULONGLONG SectorOffset; - - TotalSectors = (N + Context->SectorSize - 1) / Context->SectorSize; - MaxSectors = 1;//DISKREADBUFFER_SIZE / Context->SectorSize; - SectorOffset = Context->SectorNumber + Context->SectorOffset; - - ret = 0; + *Count = 0; + i = 0; while (N > 0) { - ReadSectors = TotalSectors; - if (ReadSectors > MaxSectors) - ReadSectors = MaxSectors; - + Length = N; + if (Length > Context->SectorSize) + Length = Context->SectorSize; ret = MachDiskReadLogicalSectors( Context->DriveNumber, - SectorOffset, - ReadSectors, + Context->SectorNumber + Context->SectorOffset + i, + 1, (PVOID)DISKREADBUFFER); if (!ret) - break; - - Length = ReadSectors * Context->SectorSize; - if (Length > N) - Length = N; - + return EIO; RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, Length); - Ptr += Length; + *Count += Length; N -= Length; - SectorOffset += ReadSectors; - TotalSectors -= ReadSectors; + i++; } - *Count = Ptr - (UCHAR *)Buffer; - - return (!ret) ? EIO : ESUCCESS; + return ESUCCESS; } static LONG DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)