- Implement GetBestFileNameFromRecord() which will select the higher subsystem name available (POSIX -> Win32 -> DOS) and return it
- Replace the hand-made implementation of it in dirctl functions relying on it (NtfsGetDirectoryInformation(), NtfsGetFullDirectoryInformation(), NtfsGetBothDirectoryInformation())
- Use it in NtfsMakeFCBFromDirEntry()

This fixes browsing POSIX volume (and opening file) in cmd. Even though, explorer doesn't seem to be happy with such change...
This doesn't fix yet the autocompletion in cmd either.

svn path=/trunk/; revision=65456
This commit is contained in:
Pierre Schweitzer 2014-11-23 14:07:08 +00:00
parent c966e68f3b
commit 950747c6d1
4 changed files with 26 additions and 37 deletions

View file

@ -314,4 +314,22 @@ GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType)
return NULL;
}
PFILENAME_ATTRIBUTE
GetBestFileNameFromRecord(PFILE_RECORD_HEADER FileRecord)
{
PFILENAME_ATTRIBUTE FileName;
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_POSIX);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
}
}
return FileName;
}
/* EOF */

View file

@ -137,15 +137,7 @@ NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetNameInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_POSIX);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
}
}
FileName = GetBestFileNameFromRecord(FileRecord);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -173,15 +165,7 @@ NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_POSIX);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
}
}
FileName = GetBestFileNameFromRecord(FileRecord);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -222,15 +206,7 @@ NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetFullDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_POSIX);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
}
}
FileName = GetBestFileNameFromRecord(FileRecord);
ASSERT(FileName != NULL);
Length = FileName->NameLength * sizeof (WCHAR);
@ -272,15 +248,7 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
DPRINT("NtfsGetBothDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_POSIX);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
if (FileName == NULL)
{
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
}
}
FileName = GetBestFileNameFromRecord(FileRecord);
ASSERT(FileName != NULL);
ShortFileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);

View file

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

View file

@ -452,6 +452,9 @@ NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
PFILENAME_ATTRIBUTE
GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType);
PFILENAME_ATTRIBUTE
GetBestFileNameFromRecord(PFILE_RECORD_HEADER FileRecord);
/* blockdev.c */
NTSTATUS