sys: FspFsvolQueryFsAttributeInformation: return full file system name

This commit is contained in:
Bill Zissimopoulos 2016-09-20 16:29:26 -07:00
parent 817beebb63
commit 5798527237
2 changed files with 23 additions and 7 deletions

View File

@ -79,6 +79,8 @@ static NTSTATUS FspFsvolQueryFsAttributeInformation(
PFILE_FS_ATTRIBUTE_INFORMATION Info = (PFILE_FS_ATTRIBUTE_INFORMATION)*PBuffer;
PUINT8 Buffer = (PUINT8)Info->FileSystemName;
ULONG CopyLength;
UNICODE_STRING FileSystemName;
WCHAR FileSystemNameBuf[16 + FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
Info->FileSystemAttributes =
(FsvolDeviceExtension->VolumeParams.CaseSensitiveSearch ? FILE_CASE_SENSITIVE_SEARCH : 0) |
@ -91,15 +93,29 @@ static NTSTATUS FspFsvolQueryFsAttributeInformation(
//(FsvolDeviceExtension->VolumeParams.ExtendedAttributes ? FILE_SUPPORTS_EXTENDED_ATTRIBUTES : 0) |
(FsvolDeviceExtension->VolumeParams.ReadOnlyVolume ? FILE_READ_ONLY_VOLUME : 0);
Info->MaximumComponentNameLength = FsvolDeviceExtension->VolumeParams.MaxComponentLength;
Info->FileSystemNameLength = sizeof L"" DRIVER_NAME - sizeof(WCHAR);
CopyLength = Info->FileSystemNameLength;
RtlInitUnicodeString(&FileSystemName, FsvolDeviceExtension->VolumeParams.FileSystemName);
ASSERT(sizeof FileSystemNameBuf >= sizeof L"" DRIVER_NAME + FSP_FSCTL_VOLUME_FSNAME_SIZE);
CopyLength = sizeof L"" DRIVER_NAME - sizeof(WCHAR);
RtlCopyMemory(FileSystemNameBuf, L"" DRIVER_NAME, CopyLength);
if (0 != FileSystemName.Length)
{
FileSystemNameBuf[CopyLength / sizeof(WCHAR)] = L'_';
CopyLength += sizeof(WCHAR);
RtlCopyMemory(FileSystemNameBuf + CopyLength / sizeof(WCHAR), FileSystemName.Buffer,
FileSystemName.Length * sizeof(WCHAR));
CopyLength += FileSystemName.Length * sizeof(WCHAR);
}
Info->FileSystemNameLength = CopyLength;
if (Buffer + CopyLength > BufferEnd)
{
CopyLength = (ULONG)(BufferEnd - Buffer);
Result = STATUS_BUFFER_OVERFLOW;
}
RtlCopyMemory(Buffer, L"" DRIVER_NAME, CopyLength);
RtlCopyMemory(Buffer, FileSystemNameBuf, CopyLength);
Buffer += CopyLength;
*PBuffer = Buffer;

View File

@ -496,7 +496,7 @@ void getvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
ASSERT(255 == MaxComponentLength);
ASSERT(0 != (FileSystemFlags &
(FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK | FILE_PERSISTENT_ACLS)));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp"));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp_MEMFS"));
}
Success = GetDiskFreeSpaceW(FilePath, &SectorsPerCluster, &BytesPerSector, &FreeClusters, &TotalClusters);
@ -573,7 +573,7 @@ void setvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
ASSERT(255 == MaxComponentLength);
ASSERT(0 != (FileSystemFlags &
(FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK | FILE_PERSISTENT_ACLS)));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp"));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp_MEMFS"));
}
Success = SetVolumeLabelW(FilePath, L"TestLabel");
@ -590,7 +590,7 @@ void setvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
ASSERT(255 == MaxComponentLength);
ASSERT(0 != (FileSystemFlags &
(FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK | FILE_PERSISTENT_ACLS)));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp"));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp_MEMFS"));
}
Success = SetVolumeLabelW(FilePath, L"123456789012345678901234567890123");
@ -607,7 +607,7 @@ void setvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
ASSERT(255 == MaxComponentLength);
ASSERT(0 != (FileSystemFlags &
(FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK | FILE_PERSISTENT_ACLS)));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp"));
ASSERT(0 == wcscmp(FileSystemNameBuf, L"WinFsp_MEMFS"));
}
}