mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-15 00:02:46 -05:00
wslinux support: ATOMIC_CREATE_ECP_CONTEXT
This commit is contained in:
@ -274,6 +274,7 @@ namespace memfs
|
||||
Host.PostCleanupWhenModifiedOnly = true;
|
||||
Host.PassQueryDirectoryFileName = true;
|
||||
Host.ExtendedAttributes = true;
|
||||
Host.WslFeatures = true;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -331,8 +332,9 @@ namespace memfs
|
||||
UInt32 FileAttributes,
|
||||
Byte[] SecurityDescriptor,
|
||||
UInt64 AllocationSize,
|
||||
IntPtr Ea,
|
||||
UInt32 EaLength,
|
||||
IntPtr ExtraBuffer,
|
||||
UInt32 ExtraLength,
|
||||
Boolean ExtraBufferIsReparsePoint,
|
||||
out Object FileNode0,
|
||||
out Object FileDesc,
|
||||
out FileInfo FileInfo,
|
||||
@ -369,11 +371,21 @@ namespace memfs
|
||||
FileNode.FileInfo.FileAttributes = 0 != (FileAttributes & (UInt32)System.IO.FileAttributes.Directory) ?
|
||||
FileAttributes : FileAttributes | (UInt32)System.IO.FileAttributes.Archive;
|
||||
FileNode.FileSecurity = SecurityDescriptor;
|
||||
if (IntPtr.Zero != Ea)
|
||||
if (IntPtr.Zero != ExtraBuffer)
|
||||
{
|
||||
Result = SetEaEntries(FileNode, null, Ea, EaLength);
|
||||
if (0 > Result)
|
||||
return Result;
|
||||
if (!ExtraBufferIsReparsePoint)
|
||||
{
|
||||
Result = SetEaEntries(FileNode, null, ExtraBuffer, ExtraLength);
|
||||
if (0 > Result)
|
||||
return Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte[] ReparseData = MakeReparsePoint(ExtraBuffer, ExtraLength);
|
||||
FileNode.FileInfo.FileAttributes |= (UInt32)System.IO.FileAttributes.ReparsePoint;
|
||||
FileNode.FileInfo.ReparseTag = GetReparseTag(ReparseData);
|
||||
FileNode.ReparseData = ReparseData;
|
||||
}
|
||||
}
|
||||
if (0 != AllocationSize)
|
||||
{
|
||||
|
@ -70,6 +70,11 @@ FSP_FSCTL_STATIC_ASSERT(MEMFS_MAX_PATH > MAX_PATH,
|
||||
#define MEMFS_EA
|
||||
|
||||
/*
|
||||
* Define the MEMFS_WSL macro to include WSLinux support.
|
||||
*/
|
||||
#define MEMFS_WSL
|
||||
|
||||
/*
|
||||
* Define the DEBUG_BUFFER_CHECK macro on Windows 8 or above. This includes
|
||||
* a check for the Write buffer to ensure that it is read-only.
|
||||
*
|
||||
@ -1047,8 +1052,8 @@ static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem,
|
||||
static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
|
||||
#if defined(MEMFS_EA)
|
||||
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
|
||||
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
|
||||
PVOID ExtraBuffer, ULONG ExtraLength, BOOLEAN ExtraBufferIsReparsePoint,
|
||||
#endif
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -1129,15 +1134,43 @@ static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
memcpy(FileNode->FileSecurity, SecurityDescriptor, FileNode->FileSecuritySize);
|
||||
}
|
||||
|
||||
#if defined(MEMFS_EA)
|
||||
if (0 != Ea)
|
||||
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
|
||||
if (0 != ExtraBuffer)
|
||||
{
|
||||
Result = FspFileSystemEnumerateEa(FileSystem, MemfsFileNodeSetEa, FileNode, Ea, EaLength);
|
||||
if (!NT_SUCCESS(Result))
|
||||
#if defined(MEMFS_EA)
|
||||
if (!ExtraBufferIsReparsePoint)
|
||||
{
|
||||
MemfsFileNodeDelete(FileNode);
|
||||
return Result;
|
||||
Result = FspFileSystemEnumerateEa(FileSystem, MemfsFileNodeSetEa, FileNode,
|
||||
(PFILE_FULL_EA_INFORMATION)ExtraBuffer, ExtraLength);
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
MemfsFileNodeDelete(FileNode);
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(MEMFS_WSL)
|
||||
if (ExtraBufferIsReparsePoint)
|
||||
{
|
||||
#if defined(MEMFS_REPARSE_POINTS)
|
||||
FileNode->ReparseDataSize = ExtraLength;
|
||||
FileNode->ReparseData = malloc(ExtraLength);
|
||||
if (0 == FileNode->ReparseData && 0 != ExtraLength)
|
||||
{
|
||||
MemfsFileNodeDelete(FileNode);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
FileNode->FileInfo.FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
|
||||
FileNode->FileInfo.ReparseTag = *(PULONG)ExtraBuffer;
|
||||
/* the first field in a reparse buffer is the reparse tag */
|
||||
memcpy(FileNode->ReparseData, ExtraBuffer, ExtraLength);
|
||||
#else
|
||||
MemfsFileNodeDelete(FileNode);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2189,7 +2222,7 @@ static FSP_FILE_SYSTEM_INTERFACE MemfsInterface =
|
||||
GetVolumeInfo,
|
||||
SetVolumeLabel,
|
||||
GetSecurityByName,
|
||||
#if defined(MEMFS_EA)
|
||||
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
|
||||
0,
|
||||
#else
|
||||
Create,
|
||||
@ -2240,8 +2273,10 @@ static FSP_FILE_SYSTEM_INTERFACE MemfsInterface =
|
||||
0,
|
||||
#endif
|
||||
0,
|
||||
#if defined(MEMFS_EA)
|
||||
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
|
||||
Create,
|
||||
#endif
|
||||
#if defined(MEMFS_EA)
|
||||
Overwrite,
|
||||
GetEa,
|
||||
SetEa
|
||||
@ -2347,6 +2382,9 @@ NTSTATUS MemfsCreateFunnel(
|
||||
#endif
|
||||
#if defined(MEMFS_EA)
|
||||
VolumeParams.ExtendedAttributes = 1;
|
||||
#endif
|
||||
#if defined(MEMFS_WSL)
|
||||
VolumeParams.WslFeatures = 1;
|
||||
#endif
|
||||
VolumeParams.AllowOpenInKernelMode = 1;
|
||||
if (0 != VolumePrefix)
|
||||
|
Reference in New Issue
Block a user