https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa809fd2feb93d4d65cc94...
commit fa809fd2feb93d4d65cc94436bdd5024bc8be667 Author: Hervé Poussineau hpoussin@reactos.org AuthorDate: Tue Sep 13 23:32:01 2022 +0200 Commit: hpoussin 32227662+hpoussin@users.noreply.github.com CommitDate: Sat Sep 24 12:12:33 2022 +0200
[VFATFS] Correctly init dirIndex/startIndex on FATX subdirectories
'.' and '..' entries do not exist on FATX subdirectories. We have to fake them when enumerating the directory, and ignore them when creating a FCB from a directory entry.
CORE-16373 --- drivers/filesystems/vfatfs/fcb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/filesystems/vfatfs/fcb.c b/drivers/filesystems/vfatfs/fcb.c index 6fd76071678..696184ec627 100644 --- a/drivers/filesystems/vfatfs/fcb.c +++ b/drivers/filesystems/vfatfs/fcb.c @@ -428,6 +428,7 @@ static VOID vfatInitFCBFromDirEntry( PDEVICE_EXTENSION Vcb, + PVFATFCB ParentFcb, PVFATFCB Fcb, PVFAT_DIRENTRY_CONTEXT DirContext) { @@ -476,7 +477,8 @@ vfatInitFCBFromDirEntry( } Fcb->dirIndex = DirContext->DirIndex; Fcb->startIndex = DirContext->StartIndex; - if (vfatVolumeIsFatX(Vcb) && !vfatFCBIsRoot(Fcb)) + Fcb->parentFcb = ParentFcb; + if (vfatVolumeIsFatX(Vcb) && !vfatFCBIsRoot(ParentFcb)) { ASSERT(DirContext->DirIndex >= 2 && DirContext->StartIndex >= 2); Fcb->dirIndex = DirContext->DirIndex-2; @@ -572,13 +574,12 @@ vfatUpdateFCB( RemoveEntryList(&Fcb->ParentListEntry);
/* Reinit FCB */ - vfatInitFCBFromDirEntry(pVCB, Fcb, DirContext); + vfatInitFCBFromDirEntry(pVCB, ParentFcb, Fcb, DirContext);
if (vfatFCBIsDirectory(Fcb)) { CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL); } - Fcb->parentFcb = ParentFcb; InsertTailList(&ParentFcb->ParentListHead, &Fcb->ParentListEntry); vfatAddFCBToTable(pVCB, Fcb);
@@ -739,10 +740,9 @@ vfatMakeFCBFromDirEntry( }
rcFCB = vfatNewFCB(vcb, &NameU); - vfatInitFCBFromDirEntry(vcb, rcFCB, DirContext); + vfatInitFCBFromDirEntry(vcb, directoryFCB, rcFCB, DirContext);
rcFCB->RefCount = 1; - rcFCB->parentFcb = directoryFCB; InsertTailList(&directoryFCB->ParentListHead, &rcFCB->ParentListEntry); vfatAddFCBToTable(vcb, rcFCB); *fileFCB = rcFCB;