Author: ekohl
Date: Wed Dec 11 11:42:44 2013
New Revision: 61260
URL:
http://svn.reactos.org/svn/reactos?rev=61260&view=rev
Log:
[FASTFAT]
Fail, if we try to overwrite an eixting read-only file.
Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Wed Dec 11 11:42:44
2013
@@ -349,6 +349,7 @@
PDEVICE_EXTENSION DeviceExt,
PUNICODE_STRING PathNameU,
PFILE_OBJECT FileObject,
+ ULONG RequestedDisposition,
PVFATFCB *ParentFcb)
{
PVFATFCB Fcb;
@@ -404,6 +405,15 @@
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 @@
}
/* 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