[FASTFAT]

Fail, if we try to overwrite an eixting read-only file.

svn path=/trunk/; revision=61260
This commit is contained in:
Eric Kohl 2013-12-11 11:42:44 +00:00
parent 02b443855b
commit b637046c9d

View file

@ -349,6 +349,7 @@ VfatOpenFile(
PDEVICE_EXTENSION DeviceExt,
PUNICODE_STRING PathNameU,
PFILE_OBJECT FileObject,
ULONG RequestedDisposition,
PVFATFCB *ParentFcb)
{
PVFATFCB Fcb;
@ -404,6 +405,15 @@ VfatOpenFile(
vfatReleaseFCB (DeviceExt, Fcb);
return STATUS_DELETE_PENDING;
}
/* Fail, if we try to overwrite a read-only file */
if ((*Fcb->Attributes & FILE_ATTRIBUTE_READONLY) &&
(RequestedDisposition == FILE_OVERWRITE))
{
vfatReleaseFCB(DeviceExt, Fcb);
return STATUS_ACCESS_DENIED;
}
DPRINT("Attaching FCB to fileObject\n");
Status = vfatAttachFCBToFileObject(DeviceExt, Fcb, FileObject);
if (!NT_SUCCESS(Status))
@ -519,7 +529,7 @@ VfatCreateFile(
}
/* Try opening the file. */
Status = VfatOpenFile(DeviceExt, &PathNameU, FileObject, &ParentFcb);
Status = VfatOpenFile(DeviceExt, &PathNameU, FileObject, RequestedDisposition, &ParentFcb);
/*
* If the directory containing the file to open doesn't exist then