From c63e7e54b5a1808d7f126911d75ac996dbb8093c Mon Sep 17 00:00:00 2001 From: Trevor Thompson Date: Fri, 25 Aug 2017 17:16:04 +0000 Subject: [PATCH] [NTFS] - When creating files: -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 | 8 ++++---- drivers/filesystems/ntfs/create.c | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/filesystems/ntfs/attrib.c b/drivers/filesystems/ntfs/attrib.c index e6d3483553b..e830264ad68 100644 --- a/drivers/filesystems/ntfs/attrib.c +++ b/drivers/filesystems/ntfs/attrib.c @@ -172,11 +172,11 @@ AddFileName(PFILE_RECORD_HEADER FileRecord, // 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); + FilenameNoPath.Buffer = Current.Buffer; + FilenameNoPath.MaximumLength = FilenameNoPath.Length = Current.Length; + 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 - 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; diff --git a/drivers/filesystems/ntfs/create.c b/drivers/filesystems/ntfs/create.c index a98afc67b7f..e8d0b1eb141 100644 --- a/drivers/filesystems/ntfs/create.c +++ b/drivers/filesystems/ntfs/create.c @@ -569,6 +569,13 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject, 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,