- Fixed the directory index of a file for FATX.
- Replaced VfatSupersedeFile with VfatSetAllocationSizeInformation.
- Check for the file size before each call to CcMapData. W2K doesn't
like it to map over the end of a directory.
Modified: trunk/reactos/drivers/fs/vfat/create.c
_____
Modified: trunk/reactos/drivers/fs/vfat/create.c
--- trunk/reactos/drivers/fs/vfat/create.c 2005-01-25 21:05:38 UTC
(rev 13276)
+++ trunk/reactos/drivers/fs/vfat/create.c 2005-01-25 21:07:32 UTC
(rev 13277)
@@ -231,15 +231,20 @@
rcFcb = vfatGrabFCBFromTable(DeviceExt, &PathNameU);
if (rcFcb)
{
- if(rcFcb->startIndex >= DirContext->DirIndex)
+ ULONG startIndex = rcFcb->startIndex;
+ if ((rcFcb->Flags & FCB_IS_FATX_ENTRY) &&
!vfatFCBIsRoot(Parent))
{
+ startIndex += 2;
+ }
+ if(startIndex >= DirContext->DirIndex)
+ {
RtlCopyUnicodeString(&DirContext->LongNameU,
&rcFcb->LongNameU);
RtlCopyUnicodeString(&DirContext->ShortNameU,
&rcFcb->ShortNameU);
RtlCopyMemory(&DirContext->DirEntry, &rcFcb->entry,
sizeof(DIR_ENTRY));
DirContext->StartIndex = rcFcb->startIndex;
DirContext->DirIndex = rcFcb->dirIndex;
DPRINT("FindFile: new Name %wZ, DirIndex %d (%d)\n",
- &DirContext->LongNameU, DirContext->DirIndex,
DirContext->StartIndex);
+ &DirContext->LongNameU, DirContext->DirIndex,
DirContext->StartIndex);
Status = STATUS_SUCCESS;
}
else
@@ -428,55 +433,6 @@
return Status;
}
-VOID STATIC
-VfatSupersedeFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
- PVFATFCB Fcb)
-{
- ULONG Cluster, NextCluster;
- NTSTATUS Status;
-
- if (Fcb->Flags & FCB_IS_FATX_ENTRY)
- {
- Fcb->entry.FatX.FileSize = 0;
- Cluster = Fcb->entry.FatX.FirstCluster;
- Fcb->entry.FatX.FirstCluster = 0;
- }
- else
- {
- Fcb->entry.Fat.FileSize = 0;
- if (DeviceExt->FatInfo.FatType == FAT32)
- {
- Cluster = Fcb->entry.Fat.FirstCluster +
Fcb->entry.Fat.FirstClusterHigh * 65536;
- }
- else
- {
- Cluster = Fcb->entry.Fat.FirstCluster;
- }
- Fcb->entry.Fat.FirstCluster = 0;
- Fcb->entry.Fat.FirstClusterHigh = 0;
- }
- Fcb->LastOffset = Fcb->LastCluster = 0;
- VfatUpdateEntry (Fcb);
- if (Fcb->RFCB.FileSize.QuadPart > 0)
- {
- Fcb->RFCB.AllocationSize.QuadPart = 0;
- Fcb->RFCB.FileSize.QuadPart = 0;
- Fcb->RFCB.ValidDataLength.QuadPart = 0;
- /* Notify cache manager about the change in file size if caching
is
- initialized on the file stream */
- if (FileObject->SectionObjectPointer->SharedCacheMap != NULL)
- {
- CcSetFileSizes(FileObject,
(PCC_FILE_SIZES)&Fcb->RFCB.AllocationSize);
- }
- }
- while (Cluster != 0xffffffff && Cluster > 1)
- {
- Status = GetNextCluster (DeviceExt, Cluster, &NextCluster);
- WriteCluster (DeviceExt, Cluster, 0);
- Cluster = NextCluster;
- }
-}
-
NTSTATUS
VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
@@ -734,7 +690,9 @@
/* Supersede the file */
if (RequestedDisposition == FILE_SUPERSEDE)
{
- VfatSupersedeFile(DeviceExt, FileObject, pFcb);
+ LARGE_INTEGER AllocationSize;
+ AllocationSize.QuadPart = 0LL;
+ VfatSetAllocationSizeInformation(FileObject, pFcb, DeviceExt,
&AllocationSize);
Irp->IoStatus.Information = FILE_SUPERSEDED;
}
else if (RequestedDisposition == FILE_OVERWRITE ||
RequestedDisposition == FILE_OVERWRITE_IF)