Author: tkreuzer
Date: Tue Sep 11 19:11:56 2012
New Revision: 57281
URL:
http://svn.reactos.org/svn/reactos?rev=57281&view=rev
Log:
[FREELDR]
Revert once again. testbot hates me. sigh...
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] Tue Sep 11 19:11:56
2012
@@ -114,45 +114,31 @@
{
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;
- }
-
- *Count = Ptr - (UCHAR *)Buffer;
-
- return (!ret) ? EIO : ESUCCESS;
+ i++;
+ }
+
+ return ESUCCESS;
}
static LONG DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)