Fixed the 'higher 4 bit fat32'-bug.

svn path=/trunk/; revision=2266
This commit is contained in:
Hartmut Birr 2001-10-03 18:23:02 +00:00
parent 0f0199f381
commit ae6141ba18

View file

@ -1,5 +1,5 @@
/* /*
* $Id: fat.c,v 1.30 2001/08/14 08:06:26 hbirr Exp $ * $Id: fat.c,v 1.31 2001/10/03 18:23:02 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -72,7 +72,7 @@ Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt,
} }
} }
CurrentCluster = *(PULONG)(BaseAddress + (FATOffset % ChunkSize)); CurrentCluster = (*(PULONG)(BaseAddress + (FATOffset % ChunkSize))) & 0x0fffffff;
if (CurrentCluster >= 0xffffff8 && CurrentCluster <= 0xfffffff) if (CurrentCluster >= 0xffffff8 && CurrentCluster <= 0xfffffff)
CurrentCluster = 0xffffffff; CurrentCluster = 0xffffffff;
CcRosReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE); CcRosReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
@ -380,7 +380,7 @@ FAT32FindAvailableCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster)
} }
} }
} }
if (*((PULONG)(BaseAddress + ((FatStart + i) % ChunkSize))) == 0) if (*((PULONG)(BaseAddress + ((FatStart + i) % ChunkSize))) & 0x0fffffff == 0)
{ {
DPRINT("Found available cluster 0x%x\n", i); DPRINT("Found available cluster 0x%x\n", i);
*Cluster = i / 4; *Cluster = i / 4;
@ -605,7 +605,7 @@ FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt,
forto=128; forto=128;
for (i = 0; i < forto; i++) for (i = 0; i < forto; i++)
{ {
if (Block[i] == 0) if (Block[i] & 0x0fffffff == 0)
ulCount++; ulCount++;
} }
} }
@ -810,7 +810,7 @@ FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt,
DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset, DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset,
ClusterToWrite); ClusterToWrite);
*((PULONG)(BaseAddress + (FATOffset % ChunkSize))) = NewValue; *((PULONG)(BaseAddress + (FATOffset % ChunkSize))) = NewValue & 0x0fffffff;
Status = VfatWriteSectors(DeviceExt->StorageDevice, Status = VfatWriteSectors(DeviceExt->StorageDevice,
ROUND_DOWN(FATOffset, ChunkSize) / BLOCKSIZE, ROUND_DOWN(FATOffset, ChunkSize) / BLOCKSIZE,
ChunkSize / BLOCKSIZE, ChunkSize / BLOCKSIZE,