[FASTFAT]

Fail, if we try to overwrite an existing directory.

svn path=/trunk/; revision=69941
This commit is contained in:
Eric Kohl 2015-11-19 16:36:39 +00:00
parent f472d3c7c8
commit 2a6b240439

View file

@ -353,6 +353,7 @@ VfatOpenFile(
PUNICODE_STRING PathNameU,
PFILE_OBJECT FileObject,
ULONG RequestedDisposition,
ULONG RequestedOptions,
PVFATFCB *ParentFcb)
{
PVFATFCB Fcb;
@ -403,6 +404,16 @@ VfatOpenFile(
return Status;
}
/* Fail, if we try to overwrite an existing directory */
if ((!(RequestedOptions & FILE_DIRECTORY_FILE) && (*Fcb->Attributes & FILE_ATTRIBUTE_DIRECTORY)) &&
(RequestedDisposition == FILE_OVERWRITE ||
RequestedDisposition == FILE_OVERWRITE_IF ||
RequestedDisposition == FILE_SUPERSEDE))
{
vfatReleaseFCB(DeviceExt, Fcb);
return STATUS_OBJECT_NAME_COLLISION;
}
if (Fcb->Flags & FCB_DELETE_PENDING)
{
vfatReleaseFCB(DeviceExt, Fcb);
@ -580,8 +591,9 @@ VfatCreateFile(
/* Try opening the file. */
if (!OpenTargetDir)
{
Status = VfatOpenFile(DeviceExt, &PathNameU, FileObject, RequestedDisposition, &ParentFcb);
if (Status == STATUS_ACCESS_DENIED)
Status = VfatOpenFile(DeviceExt, &PathNameU, FileObject, RequestedDisposition, RequestedOptions, &ParentFcb);
if (Status == STATUS_ACCESS_DENIED ||
Status == STATUS_OBJECT_NAME_COLLISION)
return Status;
}
else