[NTFS] - When creating files:
authorTrevor Thompson <tmt256@email.vccs.edu>
Fri, 25 Aug 2017 17:16:04 +0000 (17:16 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 10 Dec 2017 10:15:16 +0000 (11:15 +0100)
-Don't add a preceding backslash when creating files on root.
-Use NTFS_FILE_NAME_POSIX name type if CaseSensitive option is specified.
-Don't try to create a file when a folder is requested (folder creation is still TODO).

svn path=/branches/GSoC_2016/NTFS/; revision=75671

drivers/filesystems/ntfs/attrib.c
drivers/filesystems/ntfs/create.c

index e6d3483..e830264 100644 (file)
@@ -172,11 +172,11 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
     // we need to extract the filename from the path
     DPRINT1("Pathname: %wZ\n", &FileObject->FileName);
 
     // we need to extract the filename from the path
     DPRINT1("Pathname: %wZ\n", &FileObject->FileName);
 
-    FilenameNoPath.Buffer = FileObject->FileName.Buffer;
-    FilenameNoPath.MaximumLength = FilenameNoPath.Length = FileObject->FileName.Length;
-
     FsRtlDissectName(FileObject->FileName, &Current, &Remaining);
 
     FsRtlDissectName(FileObject->FileName, &Current, &Remaining);
 
+    FilenameNoPath.Buffer = Current.Buffer;
+    FilenameNoPath.MaximumLength = FilenameNoPath.Length = Current.Length;
+
     while (Current.Length != 0)
     {
         DPRINT1("Current: %wZ\n", &Current);
     while (Current.Length != 0)
     {
         DPRINT1("Current: %wZ\n", &Current);
@@ -232,7 +232,7 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
 
     // For now, we're emulating the way Windows behaves when 8.3 name generation is disabled
     // TODO: add DOS Filename as needed
 
     // For now, we're emulating the way Windows behaves when 8.3 name generation is disabled
     // TODO: add DOS Filename as needed
-    if (RtlIsNameLegalDOS8Dot3(&FilenameNoPath, NULL, NULL))
+    if (!CaseSensitive && RtlIsNameLegalDOS8Dot3(&FilenameNoPath, NULL, NULL))
         FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS;
     else
         FileNameAttribute->NameType = NTFS_FILE_NAME_POSIX;
         FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS;
     else
         FileNameAttribute->NameType = NTFS_FILE_NAME_POSIX;
index a98afc6..e8d0b1e 100644 (file)
@@ -569,6 +569,13 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
                 return STATUS_ACCESS_DENIED;
             }
 
                 return STATUS_ACCESS_DENIED;
             }
 
+            // We can't create directories yet
+            if (RequestedOptions & FILE_DIRECTORY_FILE)
+            {
+                DPRINT1("FIXME: Folder creation is still TODO!\n");
+                return STATUS_NOT_IMPLEMENTED;
+            }
+
             // Create the file record on disk
             Status = NtfsCreateFileRecord(DeviceExt,
                                           FileObject,
             // Create the file record on disk
             Status = NtfsCreateFileRecord(DeviceExt,
                                           FileObject,