Author: pschweitzer
Date: Sun Oct 12 11:48:42 2014
New Revision: 64692
URL:
http://svn.reactos.org/svn/reactos?rev=64692&view=rev
Log:
[NTFS]
On opening, check the file found matches the requested dispositions from the caller
Modified:
trunk/reactos/drivers/filesystems/ntfs/create.c
Modified: trunk/reactos/drivers/filesystems/ntfs/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/create.c [iso-8859-1] Sun Oct 12 11:48:42 2014
@@ -221,6 +221,30 @@
FileObject->FileName.Buffer,
&Fcb);
+ if (NT_SUCCESS(Status))
+ {
+ if (RequestedDisposition == FILE_CREATE)
+ {
+ Irp->IoStatus.Information = FILE_EXISTS;
+ NtfsCloseFile(DeviceExt, FileObject);
+ return STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ if (RequestedOptions & FILE_NON_DIRECTORY_FILE &&
+ NtfsFCBIsDirectory(Fcb))
+ {
+ NtfsCloseFile(DeviceExt, FileObject);
+ return STATUS_FILE_IS_A_DIRECTORY;
+ }
+
+ if (RequestedOptions & FILE_DIRECTORY_FILE &&
+ !NtfsFCBIsDirectory(Fcb))
+ {
+ NtfsCloseFile(DeviceExt, FileObject);
+ return STATUS_NOT_A_DIRECTORY;
+ }
+ }
+
/*
* If the directory containing the file to open doesn't exist then
* fail immediately