mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
sys: FspFsvolQueryFsAttributeInformation: allow file system to fully specify file system name
tst: memfs: add -F FileSystemName option
This commit is contained in:
parent
b55c20b393
commit
1e03c1a465
@ -98,16 +98,22 @@ static NTSTATUS FspFsvolQueryFsAttributeInformation(
|
||||
|
||||
RtlInitUnicodeString(&FileSystemName, FsvolDeviceExtension->VolumeParams.FileSystemName);
|
||||
|
||||
CopyLength = sizeof L"" DRIVER_NAME - sizeof(WCHAR);
|
||||
RtlCopyMemory(FileSystemNameBuf, L"" DRIVER_NAME, CopyLength);
|
||||
if (0 != FileSystemName.Length)
|
||||
if (0 == FileSystemName.Length ||
|
||||
(L'-' == FileSystemName.Buffer[0] ||
|
||||
L'/' == FileSystemName.Buffer[0] ||
|
||||
L'\\' == FileSystemName.Buffer[0]))
|
||||
{
|
||||
FileSystemNameBuf[CopyLength / sizeof(WCHAR)] = L'-';
|
||||
CopyLength += sizeof(WCHAR);
|
||||
CopyLength = sizeof L"" DRIVER_NAME - sizeof(WCHAR);
|
||||
RtlCopyMemory(FileSystemNameBuf, L"" DRIVER_NAME, CopyLength);
|
||||
RtlCopyMemory(FileSystemNameBuf + CopyLength / sizeof(WCHAR), FileSystemName.Buffer,
|
||||
FileSystemName.Length);
|
||||
CopyLength += FileSystemName.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyLength = FileSystemName.Length;
|
||||
RtlCopyMemory(FileSystemNameBuf, FileSystemName.Buffer, CopyLength);
|
||||
}
|
||||
|
||||
Info->FileSystemNameLength = CopyLength;
|
||||
if (Buffer + CopyLength > BufferEnd)
|
||||
|
@ -44,6 +44,7 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
||||
ULONG FileInfoTimeout = INFINITE;
|
||||
ULONG MaxFileNodes = 1024;
|
||||
ULONG MaxFileSize = 16 * 1024 * 1024;
|
||||
PWSTR FileSystemName = 0;
|
||||
PWSTR MountPoint = 0;
|
||||
PWSTR VolumePrefix = 0;
|
||||
PWSTR RootSddl = 0;
|
||||
@ -65,6 +66,9 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
||||
case L'D':
|
||||
argtos(DebugLogFile);
|
||||
break;
|
||||
case L'F':
|
||||
argtos(FileSystemName);
|
||||
break;
|
||||
case L'i':
|
||||
CaseInsensitiveFlags = MemfsCaseInsensitive;
|
||||
break;
|
||||
@ -121,11 +125,12 @@ NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
||||
FspDebugLogSetHandle(DebugLogHandle);
|
||||
}
|
||||
|
||||
Result = MemfsCreate(
|
||||
Result = MemfsCreateFunnel(
|
||||
CaseInsensitiveFlags | Flags,
|
||||
FileInfoTimeout,
|
||||
MaxFileNodes,
|
||||
MaxFileSize,
|
||||
FileSystemName,
|
||||
VolumePrefix,
|
||||
RootSddl,
|
||||
&Memfs);
|
||||
@ -184,6 +189,7 @@ usage:
|
||||
" -t FileInfoTimeout [millis]\n"
|
||||
" -n MaxFileNodes\n"
|
||||
" -s MaxFileSize [bytes]\n"
|
||||
" -F FileSystemName\n"
|
||||
" -S RootSddl [file rights: FA, etc; NO generic rights: GA, etc.]\n"
|
||||
" -u \\Server\\Share [UNC prefix (single backslash)]\n"
|
||||
" -m MountPoint [X:|* (required if no UNC prefix)]\n";
|
||||
|
@ -1661,11 +1661,12 @@ static FSP_FILE_SYSTEM_INTERFACE MemfsInterface =
|
||||
* Public API
|
||||
*/
|
||||
|
||||
NTSTATUS MemfsCreate(
|
||||
NTSTATUS MemfsCreateFunnel(
|
||||
ULONG Flags,
|
||||
ULONG FileInfoTimeout,
|
||||
ULONG MaxFileNodes,
|
||||
ULONG MaxFileSize,
|
||||
PWSTR FileSystemName,
|
||||
PWSTR VolumePrefix,
|
||||
PWSTR RootSddl,
|
||||
MEMFS **PMemfs)
|
||||
@ -1732,7 +1733,8 @@ NTSTATUS MemfsCreate(
|
||||
VolumeParams.PostCleanupOnDeleteOnly = 1;
|
||||
if (0 != VolumePrefix)
|
||||
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
|
||||
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR), L"MEMFS");
|
||||
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),
|
||||
0 != FileSystemName ? FileSystemName : L"-MEMFS");
|
||||
|
||||
Result = FspFileSystemCreate(DevicePath, &VolumeParams, &MemfsInterface, &Memfs->FileSystem);
|
||||
if (!NT_SUCCESS(Result))
|
||||
|
@ -33,11 +33,14 @@ enum
|
||||
MemfsCaseInsensitive = 0x80,
|
||||
};
|
||||
|
||||
NTSTATUS MemfsCreate(
|
||||
#define MemfsCreate(Flags, FileInfoTimeout, MaxFileNodes, MaxFileSize, VolumePrefix, RootSddl, PMemfs)\
|
||||
MemfsCreateFunnel(Flags, FileInfoTimeout, MaxFileNodes, MaxFileSize, 0, VolumePrefix, RootSddl, PMemfs)
|
||||
NTSTATUS MemfsCreateFunnel(
|
||||
ULONG Flags,
|
||||
ULONG FileInfoTimeout,
|
||||
ULONG MaxFileNodes,
|
||||
ULONG MaxFileSize,
|
||||
PWSTR FileSystemName,
|
||||
PWSTR VolumePrefix,
|
||||
PWSTR RootSddl,
|
||||
MEMFS **PMemfs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user