mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-15 08:12:45 -05:00
sys: IRP_MJ_QUERY_INFORMATION: FileStreamInformation
This commit is contained in:
@ -99,6 +99,7 @@ FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath,
|
||||
FileSystem->Operations[FspFsctlTransactFileSystemControlKind] = FspFileSystemOpFileSystemControl;
|
||||
FileSystem->Operations[FspFsctlTransactQuerySecurityKind] = FspFileSystemOpQuerySecurity;
|
||||
FileSystem->Operations[FspFsctlTransactSetSecurityKind] = FspFileSystemOpSetSecurity;
|
||||
FileSystem->Operations[FspFsctlTransactQueryStreamInformationKind] = FspFileSystemOpQueryStreamInformation;
|
||||
FileSystem->Interface = Interface;
|
||||
|
||||
FileSystem->OpGuardStrategy = FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_FINE;
|
||||
|
@ -976,18 +976,46 @@ FSP_API NTSTATUS FspFileSystemOpSetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
(PSECURITY_DESCRIPTOR)Request->Buffer);
|
||||
}
|
||||
|
||||
FSP_API BOOLEAN FspFileSystemAddDirInfo(FSP_FSCTL_DIR_INFO *DirInfo,
|
||||
FSP_API NTSTATUS FspFileSystemOpQueryStreamInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
|
||||
{
|
||||
NTSTATUS Result;
|
||||
ULONG BytesTransferred;
|
||||
|
||||
if (0 == FileSystem->Interface->GetStreamInfo)
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
BytesTransferred = 0;
|
||||
Result = FileSystem->Interface->GetStreamInfo(FileSystem, Request,
|
||||
(PVOID)USERCONTEXT(Request->Req.QueryStreamInformation),
|
||||
Response->Buffer,
|
||||
FSP_FSCTL_TRANSACT_RSP_SIZEMAX - sizeof *Response,
|
||||
&BytesTransferred);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
Response->Size = (UINT16)(sizeof *Response + BytesTransferred);
|
||||
Response->Rsp.QueryStreamInformation.Buffer.Offset = 0;
|
||||
Response->Rsp.QueryStreamInformation.Buffer.Size = (UINT16)BytesTransferred;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FSP_FSCTL_STATIC_ASSERT(
|
||||
sizeof(UINT16) == sizeof ((FSP_FSCTL_DIR_INFO *)0)->Size &&
|
||||
sizeof(UINT16) == sizeof ((FSP_FSCTL_STREAM_INFO *)0)->Size,
|
||||
"FSP_FSCTL_DIR_INFO::Size and FSP_FSCTL_STREAM_INFO::Size: sizeof must be 2.");
|
||||
static BOOLEAN FspFileSystemAddXxxInfo(PVOID Info, SIZE_T InfoSize,
|
||||
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
|
||||
{
|
||||
static UINT8 Zero[sizeof DirInfo->Size] = { 0 };
|
||||
static UINT8 Zero[sizeof(UINT16)] = { 0 };
|
||||
PVOID BufferEnd = (PUINT8)Buffer + Length;
|
||||
PVOID SrcBuffer;
|
||||
ULONG SrcLength, DstLength;
|
||||
|
||||
if (0 != DirInfo)
|
||||
if (0 != Info)
|
||||
{
|
||||
SrcBuffer = DirInfo;
|
||||
SrcLength = DirInfo->Size;
|
||||
SrcBuffer = Info;
|
||||
SrcLength = *(PUINT16)Info;
|
||||
DstLength = FSP_FSCTL_DEFAULT_ALIGN_UP(SrcLength);
|
||||
}
|
||||
else
|
||||
@ -1007,6 +1035,12 @@ FSP_API BOOLEAN FspFileSystemAddDirInfo(FSP_FSCTL_DIR_INFO *DirInfo,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FSP_API BOOLEAN FspFileSystemAddDirInfo(FSP_FSCTL_DIR_INFO *DirInfo,
|
||||
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
|
||||
{
|
||||
return FspFileSystemAddXxxInfo(DirInfo, sizeof *DirInfo, Buffer, Length, PBytesTransferred);
|
||||
}
|
||||
|
||||
FSP_API BOOLEAN FspFileSystemFindReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
NTSTATUS (*GetReparsePointByName)(
|
||||
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
|
||||
@ -1267,3 +1301,9 @@ FSP_API NTSTATUS FspFileSystemCanReplaceReparsePoint(
|
||||
else
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FSP_API BOOLEAN FspFileSystemAddStreamInfo(FSP_FSCTL_STREAM_INFO *StreamInfo,
|
||||
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
|
||||
{
|
||||
return FspFileSystemAddXxxInfo(StreamInfo, sizeof *StreamInfo, Buffer, Length, PBytesTransferred);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ struct fsp_fuse_core_opt_data
|
||||
rellinks;
|
||||
int set_FileInfoTimeout;
|
||||
int CaseInsensitiveSearch,
|
||||
NamedStreams,
|
||||
ReadOnlyVolume;
|
||||
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
|
||||
};
|
||||
@ -96,9 +95,9 @@ static struct fuse_opt fsp_fuse_core_opts[] =
|
||||
FSP_FUSE_CORE_OPT("FileInfoTimeout=", set_FileInfoTimeout, 1),
|
||||
FSP_FUSE_CORE_OPT("FileInfoTimeout=%d", VolumeParams.FileInfoTimeout, 0),
|
||||
FSP_FUSE_CORE_OPT("CaseInsensitiveSearch", CaseInsensitiveSearch, 1),
|
||||
FSP_FUSE_CORE_OPT("NamedStreams", NamedStreams, 1),
|
||||
FSP_FUSE_CORE_OPT("ReadOnlyVolume", ReadOnlyVolume, 1),
|
||||
FUSE_OPT_KEY("ReparsePoints", FUSE_OPT_KEY_DISCARD),
|
||||
FUSE_OPT_KEY("NamedStreams", FUSE_OPT_KEY_DISCARD),
|
||||
FUSE_OPT_KEY("HardLinks", FUSE_OPT_KEY_DISCARD),
|
||||
FUSE_OPT_KEY("ExtendedAttributes", FUSE_OPT_KEY_DISCARD),
|
||||
FUSE_OPT_KEY("--UNC=", 'U'),
|
||||
@ -457,7 +456,6 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key,
|
||||
" -o VolumeSerialNumber=N 32-bit wide\n"
|
||||
" -o FileInfoTimeout=N FileInfo/Security/VolumeInfo timeout (millisec)\n"
|
||||
" -o CaseInsensitiveSearch file system supports case-insensitive file names\n"
|
||||
//" -o NamedStreams file system supports named streams\n"
|
||||
//" -o ReadOnlyVolume file system is read only\n"
|
||||
" --UNC=U --VolumePrefix=U UNC prefix (\\Server\\Share)\n"
|
||||
" --FileSystemName=FSN Name of user mode file system\n");
|
||||
@ -523,7 +521,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
||||
opt_data.VolumeParams.PersistentAcls = TRUE;
|
||||
opt_data.VolumeParams.ReparsePoints = TRUE;
|
||||
opt_data.VolumeParams.ReparsePointsAccessCheck = FALSE;
|
||||
opt_data.VolumeParams.NamedStreams = !!opt_data.NamedStreams;
|
||||
opt_data.VolumeParams.NamedStreams = FALSE;
|
||||
opt_data.VolumeParams.ReadOnlyVolume = !!opt_data.ReadOnlyVolume;
|
||||
opt_data.VolumeParams.PostCleanupOnDeleteOnly = TRUE;
|
||||
opt_data.VolumeParams.UmFileNodeIsUserContext2 = TRUE;
|
||||
|
Reference in New Issue
Block a user