[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

svn path=/trunk/; revision=71674
This commit is contained in:
Pierre Schweitzer 2016-06-26 10:23:35 +00:00
parent d19532d463
commit 1edb644ad2

View file

@ -704,6 +704,27 @@ VfatSetRenameInformation(
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))
{