* Pointer to the FILE_OBJECT which represents the new name.
* This parameter is used to determine the filename and parent directory.
*
-* @param ParentMftIndex
-* Pointer to a ULONGLONG which will receive the index of the parent directory.
-*
* @param CaseSensitive
* Boolean indicating if the function should operate in case-sensitive mode. This will be TRUE
* if an application opened the file with the FILE_FLAG_POSIX_SEMANTICS flag.
*
+* @param ParentMftIndex
+* Pointer to a ULONGLONG which will receive the index of the parent directory.
+*
* @return
* STATUS_SUCCESS on success. STATUS_NOT_IMPLEMENTED if target address isn't at the end
* of the given file record.
PNTFS_ATTR_RECORD AttributeAddress,
PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
- PULONGLONG ParentMftIndex,
- BOOLEAN CaseSensitive)
+ BOOLEAN CaseSensitive,
+ PULONGLONG ParentMftIndex)
{
ULONG ResidentHeaderLength = FIELD_OFFSET(NTFS_ATTR_RECORD, Resident.Reserved) + sizeof(UCHAR);
PFILENAME_ATTRIBUTE FileNameAttribute;
&Current,
&FirstEntry,
FALSE,
- &CurrentMFTIndex,
- CaseSensitive);
+ CaseSensitive,
+ &CurrentMFTIndex);
if (!NT_SUCCESS(Status))
break;
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 +
while (currentOffset < IndexRootAttr->Header.TotalSizeOfEntries)
{
PINDEX_ENTRY_ATTRIBUTE currentIndexExtry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexRootAttr + 0x10 + currentOffset);
- DbgPrint(" Index Node Entry %u", currentNode++);
+ DbgPrint(" Index Node Entry %lu", currentNode++);
if (currentIndexExtry->Flags & NTFS_INDEX_ENTRY_NODE)
DbgPrint(" (Branch)");
else