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; FsAttributeMask |= PtfsExtendedAttributes;
else if (0 == _wcsicmp(L"FlushAndPurgeOnCleanup", OptionString)) else if (0 == _wcsicmp(L"FlushAndPurgeOnCleanup", OptionString))
FsAttributeMask |= PtfsFlushAndPurgeOnCleanup; FsAttributeMask |= PtfsFlushAndPurgeOnCleanup;
else if (0 == _wcsicmp(L"WslFeatures", OptionString))
FsAttributeMask |= PtfsWslFeatures;
else else
goto usage; goto usage;
break; break;
@ -243,6 +245,7 @@ usage:
" -o ReparsePoints\n" " -o ReparsePoints\n"
" -o NamedStreams\n" " -o NamedStreams\n"
" -o ExtendedAttributes\n" " -o ExtendedAttributes\n"
" -o WslFeatures\n"
" -o FlushAndPurgeOnCleanup\n" " -o FlushAndPurgeOnCleanup\n"
" -u \\Server\\Share [UNC prefix (single backslash)]\n" " -u \\Server\\Share [UNC prefix (single backslash)]\n"
" -p Directory [directory to expose as pass through file system]\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; UINT32 MaximumAccess = IsDirectory ? GrantedAccess : MAXIMUM_ALLOWED;
NTSTATUS Result; NTSTATUS Result;
if (ExtraBufferIsReparsePoint)
{
/* no support for WSL */
Result = STATUS_INVALID_PARAMETER;
goto exit;
}
CreateOptions &= CreateOptions &=
FILE_DIRECTORY_FILE | FILE_DIRECTORY_FILE |
FILE_NON_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE |
@ -198,6 +191,21 @@ static NTSTATUS CreateEx(FSP_FILE_SYSTEM *FileSystem,
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; 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); Result = LfsGetFileInfo(Handle, Ptfs->RootPrefixLength, FileInfo);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
goto exit; goto exit;
@ -1154,6 +1162,8 @@ NTSTATUS PtfsCreate(
VolumeParams.PassQueryDirectoryPattern = 1; VolumeParams.PassQueryDirectoryPattern = 1;
VolumeParams.FlushAndPurgeOnCleanup = (FsAttributeMask & PtfsFlushAndPurgeOnCleanup) ? VolumeParams.FlushAndPurgeOnCleanup = (FsAttributeMask & PtfsFlushAndPurgeOnCleanup) ?
1 : 0; 1 : 0;
VolumeParams.WslFeatures = (FsAttributeMask & PtfsWslFeatures) ?
1 : 0;
VolumeParams.AllowOpenInKernelMode = 1; VolumeParams.AllowOpenInKernelMode = 1;
VolumeParams.RejectIrpPriorToTransact0 = 1; VolumeParams.RejectIrpPriorToTransact0 = 1;
VolumeParams.UmFileContextIsUserContext2 = 1; VolumeParams.UmFileContextIsUserContext2 = 1;

View File

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