[NTFS] - After creating a new file, update creation disposition before calling NtfsCr...
authorTrevor Thompson <tmt256@email.vccs.edu>
Thu, 27 Jul 2017 11:35:50 +0000 (11:35 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 10 Dec 2017 10:15:03 +0000 (11:15 +0100)
svn path=/branches/GSoC_2016/NTFS/; revision=75423

drivers/filesystems/ntfs/create.c

index f5ca102..a98afc6 100644 (file)
@@ -580,8 +580,18 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
                 return Status;
             }
 
-            // Now we should be able to open the file
-            return NtfsCreateFile(DeviceObject, IrpContext);
+            // Before we open the file we just created, we need to change the disposition (upper 8 bits of ULONG)
+            // from create to open, since we already created the file
+            Stack->Parameters.Create.Options = (ULONG)FILE_OPEN << 24 | RequestedOptions;
+
+            // Now we should be able to open the file using NtfsCreateFile()
+            Status = NtfsCreateFile(DeviceObject, IrpContext);
+            if (NT_SUCCESS(Status))
+            {
+                // We need to change Irp->IoStatus.Information to reflect creation
+                Irp->IoStatus.Information = FILE_CREATED;
+            }
+            return Status;
         }
     }