tst: ntptfs: WslFeatures

This commit is contained in:
Bill Zissimopoulos 2022-01-21 14:29:42 +00:00
parent 13810e94fc
commit f28902dd7b
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
3 changed files with 23 additions and 8 deletions

View File

@ -124,6 +124,8 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
FsAttributeMask |= PtfsExtendedAttributes;
else if (0 == _wcsicmp(L"FlushAndPurgeOnCleanup", OptionString))
FsAttributeMask |= PtfsFlushAndPurgeOnCleanup;
else if (0 == _wcsicmp(L"WslFeatures", OptionString))
FsAttributeMask |= PtfsWslFeatures;
else
goto usage;
break;
@ -243,6 +245,7 @@ usage:
" -o ReparsePoints\n"
" -o NamedStreams\n"
" -o ExtendedAttributes\n"
" -o WslFeatures\n"
" -o FlushAndPurgeOnCleanup\n"
" -u \\Server\\Share [UNC prefix (single backslash)]\n"
" -p Directory [directory to expose as pass through file system]\n"

View File

@ -153,13 +153,6 @@ static NTSTATUS CreateEx(FSP_FILE_SYSTEM *FileSystem,
UINT32 MaximumAccess = IsDirectory ? GrantedAccess : MAXIMUM_ALLOWED;
NTSTATUS Result;
if (ExtraBufferIsReparsePoint)
{
/* no support for WSL */
Result = STATUS_INVALID_PARAMETER;
goto exit;
}
CreateOptions &=
FILE_DIRECTORY_FILE |
FILE_NON_DIRECTORY_FILE |
@ -198,6 +191,21 @@ static NTSTATUS CreateEx(FSP_FILE_SYSTEM *FileSystem,
if (!NT_SUCCESS(Result))
goto exit;
if (ExtraBufferIsReparsePoint)
{
/* this can happen on a WSL mount */
Result = LfsFsControlFile(
Handle,
FSCTL_SET_REPARSE_POINT,
ExtraBuffer,
(ULONG)ExtraLength,
0,
0,
&ExtraLength);
if (!NT_SUCCESS(Result))
goto exit;
}
Result = LfsGetFileInfo(Handle, Ptfs->RootPrefixLength, FileInfo);
if (!NT_SUCCESS(Result))
goto exit;
@ -1154,6 +1162,8 @@ NTSTATUS PtfsCreate(
VolumeParams.PassQueryDirectoryPattern = 1;
VolumeParams.FlushAndPurgeOnCleanup = (FsAttributeMask & PtfsFlushAndPurgeOnCleanup) ?
1 : 0;
VolumeParams.WslFeatures = (FsAttributeMask & PtfsWslFeatures) ?
1 : 0;
VolumeParams.AllowOpenInKernelMode = 1;
VolumeParams.RejectIrpPriorToTransact0 = 1;
VolumeParams.UmFileContextIsUserContext2 = 1;

View File

@ -42,11 +42,13 @@ enum
PtfsNamedStreams = 0x00000040,
PtfsExtendedAttributes = 0x00000100,
PtfsFlushAndPurgeOnCleanup = 0x00004000,
PtfsWslFeatures = 0x04000000,
PtfsAttributesMask =
PtfsReparsePoints |
PtfsNamedStreams |
PtfsExtendedAttributes |
PtfsFlushAndPurgeOnCleanup,
PtfsFlushAndPurgeOnCleanup |
PtfsWslFeatures,
};
typedef struct
{