Handle FAT32 partitions larger than 4GB

svn path=/trunk/; revision=3927
This commit is contained in:
Gé van Geldorp 2003-01-03 23:58:31 +00:00
parent 85c1893693
commit 0a4d96cc81

View file

@ -1,5 +1,5 @@
/* $Id: rw.c,v 1.50 2002/11/11 21:49:18 hbirr Exp $ /* $Id: rw.c,v 1.51 2003/01/03 23:58:31 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -273,6 +273,7 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer,
NTSTATUS Status; NTSTATUS Status;
ULONG BytesDone; ULONG BytesDone;
ULONG BytesPerSector; ULONG BytesPerSector;
LARGE_INTEGER BytesPerSectorLarge;
ULONG BytesPerCluster; ULONG BytesPerCluster;
/* PRECONDITION */ /* PRECONDITION */
@ -292,6 +293,7 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer,
Ccb = (PVFATCCB)IrpContext->FileObject->FsContext2; Ccb = (PVFATCCB)IrpContext->FileObject->FsContext2;
Fcb = Ccb->pFcb; Fcb = Ccb->pFcb;
BytesPerSector = DeviceExt->FatInfo.BytesPerSector; BytesPerSector = DeviceExt->FatInfo.BytesPerSector;
BytesPerSectorLarge.QuadPart = BytesPerSector;
BytesPerCluster = DeviceExt->FatInfo.BytesPerCluster; BytesPerCluster = DeviceExt->FatInfo.BytesPerCluster;
assert(ReadOffset.QuadPart + Length <= ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector)); assert(ReadOffset.QuadPart + Length <= ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector));
@ -375,7 +377,7 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer,
while (Length > 0 && CurrentCluster != 0xffffffff && NT_SUCCESS(Status)) while (Length > 0 && CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
{ {
StartCluster = CurrentCluster; StartCluster = CurrentCluster;
StartOffset.QuadPart = ClusterToSector(DeviceExt, StartCluster) * BytesPerSector; StartOffset.QuadPart = ClusterToSector(DeviceExt, StartCluster) * BytesPerSectorLarge.QuadPart;
BytesDone = 0; BytesDone = 0;
ClusterCount = 0; ClusterCount = 0;