diff --git a/reactos/drivers/fs/vfat/fat.c b/reactos/drivers/fs/vfat/fat.c index e2fea4585c2..6d88db2f4a0 100644 --- a/reactos/drivers/fs/vfat/fat.c +++ b/reactos/drivers/fs/vfat/fat.c @@ -1,5 +1,5 @@ /* - * $Id: fat.c,v 1.21 2001/03/06 17:28:25 dwelch Exp $ + * $Id: fat.c,v 1.22 2001/04/26 01:28:15 phreak Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -15,7 +15,7 @@ #include #include -#define NDEBUGN +#define NDEBUG #include #include "vfat.h" @@ -133,9 +133,10 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, PVOID BaseAddress; *NextCluster = 0; + FATOffset = (CurrentCluster * 12) / 8; /* first byte containing value */ Status = CcRequestCacheSegment(DeviceExt->Fat12StorageBcb, - 0, + PAGE_ROUND_DOWN(FATOffset), &BaseAddress, &Valid, &CacheSeg); @@ -147,7 +148,7 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, { Status = VfatReadSectors(DeviceExt->StorageDevice, DeviceExt->FATStart, - DeviceExt->Boot->FATSectors, + PAGESIZE / BLOCKSIZE, BaseAddress); if (!NT_SUCCESS(Status)) { @@ -157,11 +158,12 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, } CBlock = (PUCHAR)BaseAddress; - FATOffset = (CurrentCluster * 12) / 8; /* first byte containing value */ if ((CurrentCluster % 2) == 0) { Entry = CBlock[FATOffset]; + DPRINT( "Entry = %x, FATOffset = %x\n", Entry, FATOffset ); Entry |= ((CBlock[FATOffset+1] & 0xf)<<8); + DPRINT( "Entry = %x\n", Entry ); } else { @@ -173,8 +175,9 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, Entry = 0xffffffff; // DPRINT("Returning %x\n",Entry); *NextCluster = Entry; + DPRINT( "NextCluster = %x, CurrentCluster = %x\n", *NextCluster, CurrentCluster ); CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, TRUE); - return(STATUS_SUCCESS); + return Entry == 0xffffffff ? STATUS_END_OF_FILE : STATUS_SUCCESS; } NTSTATUS