[NTFS] Prefer long file name when naming objects

We now always see the long file name of an object when browsing NTFS partitions.

svn path=/trunk/; revision=65027
This commit is contained in:
Hervé Poussineau 2014-10-26 19:10:17 +00:00
parent 0a8cd9075d
commit beb81cc389
4 changed files with 18 additions and 9 deletions

View file

@ -287,16 +287,25 @@ NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord)
}
PFILENAME_ATTRIBUTE
GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord)
GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType)
{
PNTFS_ATTR_RECORD Attribute;
PFILENAME_ATTRIBUTE Name;
Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
while (Attribute < (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) &&
Attribute->Type != AttributeEnd)
{
if (Attribute->Type == AttributeFileName)
return (PFILENAME_ATTRIBUTE)((ULONG_PTR)Attribute + Attribute->Resident.ValueOffset);
{
Name = (PFILENAME_ATTRIBUTE)((ULONG_PTR)Attribute + Attribute->Resident.ValueOffset);
if (Name->NameType == NameType ||
(Name->NameType == NTFS_FILE_NAME_WIN32_AND_DOS && NameType == NTFS_FILE_NAME_WIN32) ||
(Name->NameType == NTFS_FILE_NAME_WIN32_AND_DOS && NameType == NTFS_FILE_NAME_DOS))
{
return Name;
}
}
Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute + Attribute->Length);
}

View file

@ -135,7 +135,7 @@ NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetNameInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord);
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -163,7 +163,7 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord);
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -204,7 +204,7 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetFullDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord);
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -246,7 +246,7 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetBothDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord);
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);

View file

@ -289,7 +289,7 @@ NtfsMakeRootFCB(PNTFS_VCB Vcb)
return NULL;
}
FileName = GetFileNameFromRecord(MftRecord);
FileName = GetFileNameFromRecord(MftRecord, NTFS_FILE_NAME_WIN32);
if (!FileName)
{
ExFreePoolWithTag(MftRecord, TAG_NTFS);
@ -391,7 +391,7 @@ NtfsMakeFCBFromDirEntry(PNTFS_VCB Vcb,
DPRINT1("NtfsMakeFCBFromDirEntry(%p, %p, %wZ, %p, %p)\n", Vcb, DirectoryFCB, Name, Record, fileFCB);
FileName = GetFileNameFromRecord(Record);
FileName = GetFileNameFromRecord(Record, NTFS_FILE_NAME_WIN32);
if (!FileName)
{
return STATUS_OBJECT_NAME_NOT_FOUND; // Not sure that's the best here

View file

@ -448,7 +448,7 @@ VOID
NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
PFILENAME_ATTRIBUTE
GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord);
GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType);
/* blockdev.c */