Author: pschweitzer
Date: Thu Sep 25 20:21:34 2014
New Revision: 64290
URL:
http://svn.reactos.org/svn/reactos?rev=64290&view=rev
Log:
[NTFS]
Allow opening the NTFS volume in NtfsCreateFile()
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] Thu Sep 25 20:21:34 2014
@@ -159,7 +159,7 @@
PIO_STACK_LOCATION Stack;
PFILE_OBJECT FileObject;
ULONG RequestedDisposition;
-// ULONG RequestedOptions;
+ ULONG RequestedOptions;
// PFCB Fcb;
// PWSTR FileName;
NTSTATUS Status;
@@ -172,12 +172,13 @@
ASSERT(Stack);
RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) &
0xff);
-// RequestedOptions =
-// Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
+ RequestedOptions = Stack->Parameters.Create.Options &
FILE_VALID_OPTION_FLAGS;
// PagingFileCreate = (Stack->Flags & SL_OPEN_PAGING_FILE) ? TRUE : FALSE;
-// if ((RequestedOptions & FILE_DIRECTORY_FILE)
-// && RequestedDisposition == FILE_SUPERSEDE)
-// return STATUS_INVALID_PARAMETER;
+ if (RequestedOptions & FILE_DIRECTORY_FILE &&
+ RequestedDisposition == FILE_SUPERSEDE)
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
FileObject = Stack->FileObject;
@@ -186,6 +187,28 @@
RequestedDisposition == FILE_SUPERSEDE)
{
return STATUS_ACCESS_DENIED;
+ }
+
+ /* This a open operation for the volume itself */
+ if (FileObject->FileName.Length == 0 &&
+ (FileObject->RelatedFileObject == NULL ||
FileObject->RelatedFileObject->FsContext2 != NULL))
+ {
+ if (RequestedDisposition != FILE_OPEN &&
+ RequestedDisposition != FILE_OPEN_IF)
+ {
+ return STATUS_ACCESS_DENIED;
+ }
+
+ if (RequestedOptions & FILE_DIRECTORY_FILE)
+ {
+ return STATUS_NOT_A_DIRECTORY;
+ }
+
+ NtfsAttachFCBToFileObject(DeviceExt, DeviceExt->VolumeFcb, FileObject);
+ DeviceExt->VolumeFcb->RefCount++;
+
+ Irp->IoStatus.Information = FILE_OPENED;
+ return STATUS_SUCCESS;
}
Status = NtfsOpenFile(DeviceExt,