Author: pschweitzer Date: Sun Jun 26 10:23:35 2016 New Revision: 71674
URL: http://svn.reactos.org/svn/reactos?rev=71674&view=rev Log: [FASTFAT] Don't allow renaming a directory if there are opened files in it. The way we do it for now isn't fully optimal and could be really improved, but that's a first step in the right direction. This should help getting rid of FAT volumes corruption. This also fixes a few winetests it seems.
CORE-11426 #comment Patch that fixes bug 3 committed in r71674
Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat... ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Sun Jun 26 10:23:35 2016 @@ -704,6 +704,27 @@ vfatSplitPathName(&NewName, &NewPath, &NewFile); DPRINT("New dir: %wZ, New file: %wZ\n", &NewPath, &NewFile);
+ /* FIXME: Do it in a more efficient way, like linking FCBs to their parent FCB so that we browse less FCBs + * Note: The FIXME is the way MS FastFAT seems to do it + */ + if (vfatFCBIsDirectory(FCB)) + { + PLIST_ENTRY Entry; + PVFATFCB VolFCB; + + for (Entry = DeviceExt->FcbListHead.Flink; Entry != &DeviceExt->FcbListHead; Entry = Entry->Flink) + { + VolFCB = CONTAINING_RECORD(Entry, VFATFCB, FcbListEntry); + if (VolFCB->parentFcb == FCB && VolFCB->OpenHandleCount != 0) + { + DPRINT1("At least one children file opened! %wZ (%u, %u)\n", &VolFCB->PathNameU, VolFCB->RefCount, VolFCB->OpenHandleCount); + Status = STATUS_ACCESS_DENIED; + ASSERT(OldReferences == FCB->parentFcb->RefCount); + goto Cleanup; + } + } + } + /* Are we working in place? */ if (FsRtlAreNamesEqual(&SourcePath, &NewPath, TRUE, NULL)) {