[NTFS] - Add some improvements to the previous commit, as suggested by Thomas.

svn path=/branches/GSoC_2016/NTFS/; revision=75054
This commit is contained in:
Trevor Thompson 2017-06-16 05:42:01 +00:00 committed by Thomas Faber
parent e0048b1362
commit 9dce6f4db1

View file

@ -167,9 +167,7 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
// we need to extract the filename from the path // we need to extract the filename from the path
DPRINT1("Pathname: %wZ\n", &FileObject->FileName); DPRINT1("Pathname: %wZ\n", &FileObject->FileName);
RtlZeroMemory(&FilenameNoPath, sizeof(UNICODE_STRING)); RtlInitEmptyUnicodeString(&FilenameNoPath, Buffer, MAX_PATH);
FilenameNoPath.Buffer = Buffer;
FilenameNoPath.MaximumLength = MAX_PATH;
FsRtlDissectName(FileObject->FileName, &Current, &Remaining); FsRtlDissectName(FileObject->FileName, &Current, &Remaining);
@ -210,7 +208,7 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
DPRINT1("FileNameAttribute->DirectoryFileReferenceNumber: 0x%016I64x\n", FileNameAttribute->DirectoryFileReferenceNumber); DPRINT1("FileNameAttribute->DirectoryFileReferenceNumber: 0x%016I64x\n", FileNameAttribute->DirectoryFileReferenceNumber);
FileNameAttribute->NameLength = FilenameNoPath.Length / 2; FileNameAttribute->NameLength = FilenameNoPath.Length / sizeof(WCHAR);
// TODO: Get proper nametype, add DOS links as needed // TODO: Get proper nametype, add DOS links as needed
FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS; FileNameAttribute->NameType = NTFS_FILE_NAME_WIN32_AND_DOS;
RtlCopyMemory(FileNameAttribute->Name, FilenameNoPath.Buffer, FilenameNoPath.Length); RtlCopyMemory(FileNameAttribute->Name, FilenameNoPath.Buffer, FilenameNoPath.Length);