mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 12:13:01 +00:00
-remove incorrect handle count check when deleting files
-reformat code svn path=/trunk/; revision=14181
This commit is contained in:
parent
f0bec76acd
commit
846dc1aebe
1 changed files with 47 additions and 51 deletions
|
@ -268,7 +268,6 @@ VfatSetDispositionInformation(PFILE_OBJECT FileObject,
|
|||
PDEVICE_OBJECT DeviceObject,
|
||||
PFILE_DISPOSITION_INFORMATION DispositionInfo)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
#ifdef DBG
|
||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||
#endif
|
||||
|
@ -279,6 +278,21 @@ VfatSetDispositionInformation(PFILE_OBJECT FileObject,
|
|||
ASSERT(DeviceExt->FatInfo.BytesPerCluster != 0);
|
||||
ASSERT(FCB != NULL);
|
||||
|
||||
if (!DispositionInfo->DeleteFile)
|
||||
{
|
||||
/* undelete the file */
|
||||
FCB->Flags &= ~FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = FALSE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (FCB->Flags & FCB_DELETE_PENDING)
|
||||
{
|
||||
/* stream already marked for deletion. just update the file object */
|
||||
FileObject->DeletePending = TRUE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (*FCB->Attributes & FILE_ATTRIBUTE_READONLY)
|
||||
{
|
||||
return STATUS_CANNOT_DELETE;
|
||||
|
@ -292,45 +306,27 @@ VfatSetDispositionInformation(PFILE_OBJECT FileObject,
|
|||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (DispositionInfo->DeleteFile)
|
||||
|
||||
if (!MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete))
|
||||
{
|
||||
if (MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete))
|
||||
{
|
||||
if (FCB->OpenHandleCount > 1)
|
||||
{
|
||||
DPRINT1("%d %x\n", FCB->OpenHandleCount, CcGetFileObjectFromSectionPtrs(FileObject->SectionObjectPointer));
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
/* can't delete a file if its mapped into a process */
|
||||
|
||||
DPRINT("MmFlushImageSection returned FALSE\n");
|
||||
return STATUS_CANNOT_DELETE;
|
||||
}
|
||||
else
|
||||
|
||||
if (vfatFCBIsDirectory(FCB) && !VfatIsDirectoryEmpty(FCB))
|
||||
{
|
||||
/* can't delete a non-empty directory */
|
||||
|
||||
return STATUS_DIRECTORY_NOT_EMPTY;
|
||||
}
|
||||
|
||||
/* all good */
|
||||
FCB->Flags |= FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("MmFlushImageSection returned FALSE\n");
|
||||
Status = STATUS_CANNOT_DELETE;
|
||||
}
|
||||
if (NT_SUCCESS(Status) && vfatFCBIsDirectory(FCB))
|
||||
{
|
||||
if (!VfatIsDirectoryEmpty(FCB))
|
||||
{
|
||||
Status = STATUS_DIRECTORY_NOT_EMPTY;
|
||||
FCB->Flags &= ~FCB_DELETE_PENDING;
|
||||
FileObject->DeletePending = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FileObject->DeletePending = FALSE;
|
||||
}
|
||||
return Status;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue