From 812b97ae664c22a190ac11d4af5bc7c423fd2885 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sat, 9 Sep 2006 13:47:45 +0000 Subject: [PATCH] Correct bug in cache which could cause us to lose the last block of a file. This is wierd and insidious, and probably was the cause of n00bs not being able to boot on occasion. svn path=/trunk/; revision=23990 --- reactos/boot/freeldr/freeldr/cache/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/cache/cache.c b/reactos/boot/freeldr/freeldr/cache/cache.c index ac02a72151a..eaf024fbfb4 100644 --- a/reactos/boot/freeldr/freeldr/cache/cache.c +++ b/reactos/boot/freeldr/freeldr/cache/cache.c @@ -138,7 +138,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo SectorOffsetInStartBlock = StartSector % CacheManagerDrive.BlockSize; CopyLengthInStartBlock = (SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount; EndBlock = (StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize; - SectorOffsetInEndBlock = (StartSector + SectorCount) % CacheManagerDrive.BlockSize; + SectorOffsetInEndBlock = 1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize; BlockCount = (EndBlock - StartBlock) + 1; DbgPrint((DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount));