[NTFS] Also return the short file name to caller if available

svn path=/trunk/; revision=65028
This commit is contained in:
Hervé Poussineau 2014-10-26 19:10:39 +00:00
parent beb81cc389
commit fa7836ce2a

View file

@ -242,12 +242,13 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
ULONG BufferLength)
{
ULONG Length;
PFILENAME_ATTRIBUTE FileName;
PFILENAME_ATTRIBUTE FileName, ShortFileName;
DPRINT("NtfsGetBothDirectoryInformation() called\n");
FileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_WIN32);
ASSERT(FileName != NULL);
ShortFileName = GetFileNameFromRecord(FileRecord, NTFS_FILE_NAME_DOS);
Length = FileName->NameLength * sizeof (WCHAR);
if ((sizeof(FILE_BOTH_DIR_INFORMATION) + Length) > BufferLength)
@ -258,6 +259,19 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) + Length, sizeof(ULONG));
RtlCopyMemory(Info->FileName, FileName->Name, Length);
if (ShortFileName)
{
/* Should we upcase the filename? */
ASSERT(ShortFileName->NameLength <= ARRAYSIZE(Info->ShortName));
Info->ShortNameLength = ShortFileName->NameLength * sizeof(WCHAR);
RtlCopyMemory(Info->ShortName, ShortFileName->Name, Info->ShortNameLength);
}
else
{
Info->ShortName[0] = 0;
Info->ShortNameLength = 0;
}
Info->CreationTime.QuadPart = FileName->CreationTime;
Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
@ -272,9 +286,6 @@ NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt,
// Info->FileIndex=;
Info->EaSize = 0;
Info->ShortName[0] = 0;
Info->ShortNameLength = 0;
return STATUS_SUCCESS;
}