[FREELDR]

Apply Carlos patch again, but use MaxSectors = 1 for now. That should result in the exact identical behaviour as before.

svn path=/trunk/; revision=57278
This commit is contained in:
Timo Kreuzer 2012-09-11 17:34:09 +00:00
parent c378d0a138
commit 858cfa0dbb

View file

@ -114,31 +114,45 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
{
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
UCHAR* Ptr = (UCHAR*)Buffer;
ULONG i, Length;
ULONG Length, TotalSectors, MaxSectors, ReadSectors;
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)
{
Length = N;
if (Length > Context->SectorSize)
Length = Context->SectorSize;
ReadSectors = TotalSectors;
if (ReadSectors > MaxSectors)
ReadSectors = MaxSectors;
ret = MachDiskReadLogicalSectors(
Context->DriveNumber,
Context->SectorNumber + Context->SectorOffset + i,
1,
SectorOffset,
ReadSectors,
(PVOID)DISKREADBUFFER);
if (!ret)
return EIO;
break;
Length = ReadSectors * Context->SectorSize;
if (Length > N)
Length = N;
RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, Length);
Ptr += Length;
*Count += Length;
N -= Length;
i++;
SectorOffset += ReadSectors;
TotalSectors -= ReadSectors;
}
return ESUCCESS;
*Count = Ptr - (UCHAR *)Buffer;
return (!ret) ? EIO : ESUCCESS;
}
static LONG DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)