https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4aab2678175b4e0533f8…
commit e4aab2678175b4e0533f8c86e00ed370db501f1e
Author: Trevor Thompson <tmt256(a)email.vccs.edu>
AuthorDate: Sun Jun 25 04:29:04 2017 +0000
[NTFS] - Fix creation of files with long filenames.
svn path=/branches/GSoC_2016/NTFS/; revision=75193
---
drivers/filesystems/ntfs/attrib.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/filesystems/ntfs/attrib.c b/drivers/filesystems/ntfs/attrib.c
index 120cf90185..7669008f99 100644
--- a/drivers/filesystems/ntfs/attrib.c
+++ b/drivers/filesystems/ntfs/attrib.c
@@ -220,9 +220,15 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
DPRINT1("FileNameAttribute->DirectoryFileReferenceNumber: 0x%016I64x\n",
FileNameAttribute->DirectoryFileReferenceNumber);
FileNameAttribute->NameLength = FilenameNoPath.Length / sizeof(WCHAR);
- // TODO: Get proper nametype, add DOS links as needed
- FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS;
RtlCopyMemory(FileNameAttribute->Name, FilenameNoPath.Buffer,
FilenameNoPath.Length);
+
+ // 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))
+ FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS;
+ else
+ FileNameAttribute->NameType = NTFS_FILE_NAME_POSIX;
+
FileRecord->LinkCount++;
AttributeAddress->Length = ResidentHeaderLength +