From 220378c764d3e54c077c8ec76c04ee5efa3a7aa9 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Thu, 18 Dec 2008 20:47:20 +0000 Subject: [PATCH] VfatSetAllocationSizeInformation: The fast code for extending the size of a non-empty file did have a bug in that it didn't always set Fcb->LastCluster/Fcb->LastOffset but the OffsetToCluster call was made assuming that it did. However, the code that replaced it had a bug as well, in that it did not set Cluster to the original final cluster like the error handling code expected, so it would crash when out of disk space. Bringing back the fast code, but with its bug fixed. svn path=/trunk/; revision=38179 --- reactos/drivers/filesystems/fastfat/finfo.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat/finfo.c b/reactos/drivers/filesystems/fastfat/finfo.c index b8e3a141295..6864a2d4dcb 100644 --- a/reactos/drivers/filesystems/fastfat/finfo.c +++ b/reactos/drivers/filesystems/fastfat/finfo.c @@ -639,7 +639,6 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject, } else { -#if 0 /* FIXME */ if (Fcb->LastCluster > 0) { if (Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize == Fcb->LastOffset) @@ -665,23 +664,14 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject, return Status; } - if (Fcb->LastCluster == 0) - { - Fcb->LastCluster = Cluster; - Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize; - } + Fcb->LastCluster = Cluster; + Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize; /* FIXME: Check status */ /* Cluster points now to the last cluster within the chain */ Status = OffsetToCluster(DeviceExt, Cluster, ROUND_DOWN(NewSize - 1, ClusterSize) - Fcb->LastOffset, &NCluster, TRUE); -#else - Status = OffsetToCluster(DeviceExt, FirstCluster, - ROUND_DOWN(NewSize - 1, ClusterSize), - &Cluster, TRUE); - NCluster = Cluster; -#endif if (NCluster == 0xffffffff || !NT_SUCCESS(Status)) { /* disk is full */