mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
dll: API polishing
This commit is contained in:
parent
03611b6210
commit
067a0f1b37
@ -136,8 +136,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param VolumeInfo [out]
|
||||
* Pointer to a structure that will receive the volume information on successful return
|
||||
* from this call.
|
||||
@ -145,15 +143,12 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*GetVolumeInfo)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
/**
|
||||
* Set volume label.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param VolumeLabel
|
||||
* The new label for the volume.
|
||||
* @param VolumeInfo [out]
|
||||
@ -163,7 +158,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*SetVolumeLabel)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR VolumeLabel,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
/**
|
||||
@ -202,13 +196,8 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileName
|
||||
* The name of the file or directory to be created.
|
||||
* @param CaseSensitive
|
||||
* Whether to treat the FileName as case-sensitive or case-insensitive. Case-sensitive
|
||||
* file systems always treat FileName as case-sensitive regardless of this parameter.
|
||||
* @param CreateOptions
|
||||
* Create options for this request. This parameter has the same meaning as the
|
||||
* CreateOptions parameter of the NtCreateFile API. User mode file systems should typically
|
||||
@ -216,12 +205,18 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* directory rather than a file. Some file systems may also want to pay attention to the
|
||||
* FILE_NO_INTERMEDIATE_BUFFERING and FILE_WRITE_THROUGH flags, although these are
|
||||
* typically handled by the FSD component.
|
||||
* @param GrantedAccess
|
||||
* Determines the specific access rights that have been granted for this request. Upon
|
||||
* receiving this call all access checks have been performed and the user mode file system
|
||||
* need not perform any additional checks. However this parameter may be useful to a user
|
||||
* mode file system; for example the WinFsp-FUSE layer uses this parameter to determine
|
||||
* which flags to use in its POSIX open() call.
|
||||
* @param FileAttributes
|
||||
* File attributes to apply to the newly created file or directory.
|
||||
* @param SecurityDescriptor
|
||||
* Security descriptor to apply to the newly created file or directory. This security
|
||||
* descriptor will always be in self-relative format. Its length can be retrieved using the
|
||||
* Windows GetSecurityDescriptorLength API.
|
||||
* Windows GetSecurityDescriptorLength API. Will be NULL for named streams.
|
||||
* @param AllocationSize
|
||||
* Allocation size for the newly created file.
|
||||
* @param PFileNode [out]
|
||||
@ -237,8 +232,7 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Create)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
@ -246,19 +240,20 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileName
|
||||
* The name of the file or directory to be opened.
|
||||
* @param CaseSensitive
|
||||
* Whether to treat the FileName as case-sensitive or case-insensitive. Case-sensitive
|
||||
* file systems always treat FileName as case-sensitive regardless of this parameter.
|
||||
* @param CreateOptions
|
||||
* Create options for this request. This parameter has the same meaning as the
|
||||
* CreateOptions parameter of the NtCreateFile API. User mode file systems typically
|
||||
* do not need to do anything special with respect to this parameter. Some file systems may
|
||||
* also want to pay attention to the FILE_NO_INTERMEDIATE_BUFFERING and FILE_WRITE_THROUGH
|
||||
* flags, although these are typically handled by the FSD component.
|
||||
* @param GrantedAccess
|
||||
* Determines the specific access rights that have been granted for this request. Upon
|
||||
* receiving this call all access checks have been performed and the user mode file system
|
||||
* need not perform any additional checks. However this parameter may be useful to a user
|
||||
* mode file system; for example the WinFsp-FUSE layer uses this parameter to determine
|
||||
* which flags to use in its POSIX open() call.
|
||||
* @param PFileNode [out]
|
||||
* Pointer that will receive the file node on successful return from this call. The file
|
||||
* node is a void pointer (or an integer that can fit in a pointer) that is used to
|
||||
@ -272,16 +267,13 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Open)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
* Overwrite a file.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file to overwrite.
|
||||
* @param FileAttributes
|
||||
@ -296,7 +288,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Overwrite)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
@ -324,8 +315,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to cleanup.
|
||||
* @param FileName
|
||||
@ -339,28 +328,22 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* CanDelete
|
||||
*/
|
||||
VOID (*Cleanup)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PWSTR FileName, BOOLEAN Delete);
|
||||
/**
|
||||
* Close a file.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to be closed.
|
||||
*/
|
||||
VOID (*Close)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode);
|
||||
/**
|
||||
* Read a file.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file to be read.
|
||||
* @param Buffer
|
||||
@ -376,7 +359,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* operation.
|
||||
*/
|
||||
NTSTATUS (*Read)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PULONG PBytesTransferred);
|
||||
/**
|
||||
@ -384,8 +366,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file to be written.
|
||||
* @param Buffer
|
||||
@ -409,7 +389,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* operation.
|
||||
*/
|
||||
NTSTATUS (*Write)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
BOOLEAN WriteToEndOfFile, BOOLEAN ConstrainedIo,
|
||||
PULONG PBytesTransferred, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
@ -420,23 +399,18 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file to be flushed. When NULL the whole volume is being flushed.
|
||||
* @return
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Flush)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode);
|
||||
/**
|
||||
* Get file or directory information.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to get information for.
|
||||
* @param FileInfo [out]
|
||||
@ -446,7 +420,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*GetFileInfo)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
@ -454,8 +427,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to set information for.
|
||||
* @param FileAttributes
|
||||
@ -477,7 +448,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*SetBasicInfo)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT32 FileAttributes,
|
||||
UINT64 CreationTime, UINT64 LastAccessTime, UINT64 LastWriteTime,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
@ -503,8 +473,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file to set the file/allocation size for.
|
||||
* @param NewSize
|
||||
@ -518,7 +486,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*SetFileSize)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT64 NewSize, BOOLEAN SetAllocationSize,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
/**
|
||||
@ -536,8 +503,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to test for deletion.
|
||||
* @param FileName
|
||||
@ -548,7 +513,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* Cleanup
|
||||
*/
|
||||
NTSTATUS (*CanDelete)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PWSTR FileName);
|
||||
/**
|
||||
* Renames a file or directory.
|
||||
@ -564,8 +528,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to be renamed.
|
||||
* @param FileName
|
||||
@ -578,7 +540,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*Rename)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PWSTR NewFileName, BOOLEAN ReplaceIfExists);
|
||||
/**
|
||||
@ -599,7 +560,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*GetSecurity)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize);
|
||||
/**
|
||||
@ -610,24 +570,28 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to set the security descriptor for.
|
||||
* @param SecurityInformation
|
||||
* Indicates what part of the file or directory security descriptor to change.
|
||||
* @param SecurityDescriptor
|
||||
* Security descriptor to apply to the file or directory. This security descriptor will
|
||||
* always be in self-relative format.
|
||||
* Describes what parts of the file or directory security descriptor should
|
||||
* be modified.
|
||||
* @param ModificationDescriptor
|
||||
* Describes the modifications to apply to the file or directory security descriptor.
|
||||
* @param AccessToken
|
||||
* A handle to a token that can be used to verify whether the requested modifications
|
||||
* are allowed.
|
||||
* @return
|
||||
* STATUS_SUCCESS or error code.
|
||||
* @see
|
||||
* FspSetSecurityDescriptor
|
||||
* FspDeleteSecurityDescriptor
|
||||
*/
|
||||
NTSTATUS (*SetSecurity)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor,
|
||||
HANDLE AccessToken);
|
||||
/**
|
||||
* Read a directory.
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the directory to be read.
|
||||
* @param Buffer
|
||||
@ -652,7 +616,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* FspFileSystemAddDirInfo
|
||||
*/
|
||||
NTSTATUS (*ReadDirectory)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PWSTR Pattern,
|
||||
PULONG PBytesTransferred);
|
||||
@ -705,8 +668,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the reparse point.
|
||||
* @param FileName
|
||||
@ -723,7 +684,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* SetReparsePoint
|
||||
*/
|
||||
NTSTATUS (*GetReparsePoint)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, PSIZE_T PSize);
|
||||
/**
|
||||
@ -731,8 +691,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the reparse point.
|
||||
* @param FileName
|
||||
@ -748,7 +706,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* GetReparsePoint
|
||||
*/
|
||||
NTSTATUS (*SetReparsePoint)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size);
|
||||
/**
|
||||
@ -756,8 +713,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the reparse point.
|
||||
* @param FileName
|
||||
@ -770,7 +725,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* STATUS_SUCCESS or error code.
|
||||
*/
|
||||
NTSTATUS (*DeleteReparsePoint)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size);
|
||||
/**
|
||||
@ -778,8 +732,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
*
|
||||
* @param FileSystem
|
||||
* The file system on which this request is posted.
|
||||
* @param Request
|
||||
* The request posted by the kernel mode FSD.
|
||||
* @param FileNode
|
||||
* The file node of the file or directory to get stream information for.
|
||||
* @param Buffer
|
||||
@ -794,7 +746,6 @@ typedef struct _FSP_FILE_SYSTEM_INTERFACE
|
||||
* FspFileSystemAddStreamInfo
|
||||
*/
|
||||
NTSTATUS (*GetStreamInfo)(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, ULONG Length,
|
||||
PULONG PBytesTransferred);
|
||||
|
||||
@ -825,6 +776,11 @@ typedef struct _FSP_FILE_SYSTEM
|
||||
SRWLOCK OpGuardLock;
|
||||
BOOLEAN UmFileNodeIsUserContext2;
|
||||
} FSP_FILE_SYSTEM;
|
||||
typedef struct _FSP_FILE_SYSTEM_OPERATION_CONTEXT
|
||||
{
|
||||
FSP_FSCTL_TRANSACT_REQ *Request;
|
||||
FSP_FSCTL_TRANSACT_RSP *Response;
|
||||
} FSP_FILE_SYSTEM_OPERATION_CONTEXT;
|
||||
/**
|
||||
* Create a file system object.
|
||||
*
|
||||
@ -924,6 +880,17 @@ FSP_API VOID FspFileSystemStopDispatcher(FSP_FILE_SYSTEM *FileSystem);
|
||||
*/
|
||||
FSP_API VOID FspFileSystemSendResponse(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_RSP *Response);
|
||||
/**
|
||||
* Get the current operation context.
|
||||
*
|
||||
* This function may be used only when servicing one of the FSP_FILE_SYSTEM_INTERFACE operations.
|
||||
* The current operation context is stored in thread local storage. It allows access to the
|
||||
* Request and Response associated with this operation.
|
||||
*
|
||||
* @return
|
||||
* The current operation context.
|
||||
*/
|
||||
FSP_API FSP_FILE_SYSTEM_OPERATION_CONTEXT *FspFileSystemGetOperationContext(VOID);
|
||||
static inline
|
||||
PWSTR FspFileSystemMountPoint(FSP_FILE_SYSTEM *FileSystem)
|
||||
{
|
||||
@ -1000,6 +967,12 @@ VOID FspFileSystemSetDebugLog(FSP_FILE_SYSTEM *FileSystem,
|
||||
{
|
||||
FileSystem->DebugLog = DebugLog;
|
||||
}
|
||||
static inline
|
||||
BOOLEAN FspFileSystemIsOperationCaseSensitive(VOID)
|
||||
{
|
||||
FSP_FSCTL_TRANSACT_REQ *Request = FspFileSystemGetOperationContext()->Request;
|
||||
return FspFsctlTransactCreateKind == Request->Kind && Request->Req.Create.CaseSensitive;
|
||||
}
|
||||
|
||||
/*
|
||||
* Operations
|
||||
@ -1266,10 +1239,54 @@ FSP_API NTSTATUS FspCreateSecurityDescriptor(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PSECURITY_DESCRIPTOR ParentDescriptor,
|
||||
PSECURITY_DESCRIPTOR *PSecurityDescriptor);
|
||||
FSP_API NTSTATUS FspSetSecurityDescriptor(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
/**
|
||||
* Modify security descriptor.
|
||||
*
|
||||
* This is a helper for implementing the SetSecurity operation.
|
||||
*
|
||||
* @param InputDescriptor
|
||||
* The input security descriptor to be modified.
|
||||
* @param SecurityInformation
|
||||
* Describes what parts of the InputDescriptor should be modified. This should contain
|
||||
* the same value passed to the SetSecurity SecurityInformation parameter.
|
||||
* @param ModificationDescriptor
|
||||
* Describes the modifications to apply to the InputDescriptor. This should contain
|
||||
* the same value passed to the SetSecurity ModificationDescriptor parameter.
|
||||
* @param AccessToken
|
||||
* A handle to a token that can be used to verify whether the requested modifications
|
||||
* are allowed. This should contain the same value passed to the SetSecurity AccessToken
|
||||
* parameter.
|
||||
* @param PSecurityDescriptor [out]
|
||||
* Pointer to a memory location that will receive the resulting security descriptor.
|
||||
* This security descriptor can be later freed using FspDeleteSecurityDescriptor.
|
||||
* @return
|
||||
* STATUS_SUCCESS or error code.
|
||||
* @see
|
||||
* SetSecurity
|
||||
* FspDeleteSecurityDescriptor
|
||||
*/
|
||||
FSP_API NTSTATUS FspSetSecurityDescriptor(
|
||||
PSECURITY_DESCRIPTOR InputDescriptor,
|
||||
SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR ModificationDescriptor,
|
||||
HANDLE AccessToken,
|
||||
PSECURITY_DESCRIPTOR *PSecurityDescriptor);
|
||||
/**
|
||||
* Delete security descriptor.
|
||||
*
|
||||
* This is a helper for implementing the SetSecurity operation.
|
||||
*
|
||||
* @param SecurityDescriptor
|
||||
* The security descriptor to be deleted.
|
||||
* @param CreateFunc
|
||||
* Function used to create the security descriptor. This parameter should be
|
||||
* set to FspSetSecurityDescriptor for the public API.
|
||||
* @return
|
||||
* STATUS_SUCCESS or error code.
|
||||
* @see
|
||||
* SetSecurity
|
||||
* FspSetSecurityDescriptor
|
||||
*/
|
||||
FSP_API VOID FspDeleteSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
NTSTATUS (*CreateFunc)());
|
||||
static inline
|
||||
|
30
src/dll/fs.c
30
src/dll/fs.c
@ -25,6 +25,7 @@ enum
|
||||
static FSP_FILE_SYSTEM_INTERFACE FspFileSystemNullInterface;
|
||||
|
||||
static INIT_ONCE FspFileSystemInitOnce = INIT_ONCE_STATIC_INIT;
|
||||
static DWORD FspFileSystemTlsKey = TLS_OUT_OF_INDEXES;
|
||||
static NTSTATUS (NTAPI *FspNtOpenSymbolicLinkObject)(
|
||||
PHANDLE LinkHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes);
|
||||
static NTSTATUS (NTAPI *FspNtMakeTemporaryObject)(
|
||||
@ -37,6 +38,8 @@ static BOOL WINAPI FspFileSystemInitialize(
|
||||
{
|
||||
HANDLE Handle;
|
||||
|
||||
FspFileSystemTlsKey = TlsAlloc();
|
||||
|
||||
Handle = GetModuleHandleW(L"ntdll.dll");
|
||||
if (0 != Handle)
|
||||
{
|
||||
@ -55,6 +58,20 @@ static BOOL WINAPI FspFileSystemInitialize(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID FspFileSystemFinalize(BOOLEAN Dynamic)
|
||||
{
|
||||
/*
|
||||
* This function is called during DLL_PROCESS_DETACH. We must therefore keep
|
||||
* finalization tasks to a minimum.
|
||||
*
|
||||
* We must free our TLS key (if any). We only do so if the library
|
||||
* is being explicitly unloaded (rather than the process exiting).
|
||||
*/
|
||||
|
||||
if (Dynamic && TLS_OUT_OF_INDEXES != FspFileSystemTlsKey)
|
||||
TlsFree(FspFileSystemTlsKey);
|
||||
}
|
||||
|
||||
FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath,
|
||||
const FSP_FSCTL_VOLUME_PARAMS *VolumeParams,
|
||||
const FSP_FILE_SYSTEM_INTERFACE *Interface,
|
||||
@ -69,6 +86,8 @@ FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath,
|
||||
Interface = &FspFileSystemNullInterface;
|
||||
|
||||
InitOnceExecuteOnce(&FspFileSystemInitOnce, FspFileSystemInitialize, 0, 0);
|
||||
if (TLS_OUT_OF_INDEXES == FspFileSystemTlsKey)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
FileSystem = MemAlloc(sizeof *FileSystem);
|
||||
if (0 == FileSystem)
|
||||
@ -395,6 +414,7 @@ static DWORD WINAPI FspFileSystemDispatcherThread(PVOID FileSystem0)
|
||||
SIZE_T RequestSize, ResponseSize;
|
||||
FSP_FSCTL_TRANSACT_REQ *Request = 0;
|
||||
FSP_FSCTL_TRANSACT_RSP *Response = 0;
|
||||
FSP_FILE_SYSTEM_OPERATION_CONTEXT OperationContext;
|
||||
HANDLE DispatcherThread = 0;
|
||||
|
||||
Request = MemAlloc(FSP_FSCTL_TRANSACT_BUFFER_SIZEMIN);
|
||||
@ -416,6 +436,10 @@ static DWORD WINAPI FspFileSystemDispatcherThread(PVOID FileSystem0)
|
||||
}
|
||||
}
|
||||
|
||||
OperationContext.Request = Request;
|
||||
OperationContext.Response = Response;
|
||||
TlsSetValue(FspFileSystemTlsKey, &OperationContext);
|
||||
|
||||
memset(Response, 0, sizeof *Response);
|
||||
for (;;)
|
||||
{
|
||||
@ -479,6 +503,7 @@ static DWORD WINAPI FspFileSystemDispatcherThread(PVOID FileSystem0)
|
||||
}
|
||||
|
||||
exit:
|
||||
TlsSetValue(FspFileSystemTlsKey, 0);
|
||||
MemFree(Response);
|
||||
MemFree(Request);
|
||||
|
||||
@ -556,3 +581,8 @@ FSP_API VOID FspFileSystemSendResponse(FSP_FILE_SYSTEM *FileSystem,
|
||||
FspFsctlStop(FileSystem->VolumeHandle);
|
||||
}
|
||||
}
|
||||
|
||||
FSP_API FSP_FILE_SYSTEM_OPERATION_CONTEXT *FspFileSystemGetOperationContext(VOID)
|
||||
{
|
||||
return (FSP_FILE_SYSTEM_OPERATION_CONTEXT *)TlsGetValue(FspFileSystemTlsKey);
|
||||
}
|
||||
|
@ -369,8 +369,8 @@ static NTSTATUS FspFileSystemOpCreate_FileCreate(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Create(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Create(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
|
||||
@ -408,8 +408,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOpen(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Open(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Open(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
@ -453,8 +453,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Open(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Open(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
@ -480,8 +480,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Create(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Create(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
|
||||
@ -521,8 +521,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOverwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Open(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Open(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
@ -566,8 +566,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOverwriteIf(FSP_FILE_SYSTEM *FileSyste
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Open(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Open(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
@ -593,8 +593,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOverwriteIf(FSP_FILE_SYSTEM *FileSyste
|
||||
memset(&OpenFileInfo, 0, sizeof OpenFileInfo);
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->Create(FileSystem, Request,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Create(FileSystem,
|
||||
(PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor);
|
||||
@ -637,8 +637,8 @@ static NTSTATUS FspFileSystemOpCreate_FileOpenTargetDirectory(FSP_FILE_SYSTEM *F
|
||||
OpenFileInfo.NormalizedName = (PVOID)Response->Buffer;
|
||||
OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
FspPathSuffix((PWSTR)Request->Buffer, &Parent, &Suffix, Root);
|
||||
Result = FileSystem->Interface->Open(FileSystem, Request,
|
||||
Parent, Request->Req.Create.CaseSensitive, Request->Req.Create.CreateOptions,
|
||||
Result = FileSystem->Interface->Open(FileSystem,
|
||||
Parent, Request->Req.Create.CreateOptions, GrantedAccess,
|
||||
&FileNode, &OpenFileInfo.FileInfo);
|
||||
FspPathCombine((PWSTR)Request->Buffer, Suffix);
|
||||
if (!NT_SUCCESS(Result))
|
||||
@ -806,7 +806,7 @@ FSP_API NTSTATUS FspFileSystemOpOverwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
memset(&FileInfo, 0, sizeof FileInfo);
|
||||
Result = FileSystem->Interface->Overwrite(FileSystem, Request,
|
||||
Result = FileSystem->Interface->Overwrite(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Overwrite),
|
||||
Request->Req.Overwrite.FileAttributes,
|
||||
Request->Req.Overwrite.Supersede,
|
||||
@ -814,7 +814,7 @@ FSP_API NTSTATUS FspFileSystemOpOverwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (!NT_SUCCESS(Result))
|
||||
{
|
||||
if (0 != FileSystem->Interface->Close)
|
||||
FileSystem->Interface->Close(FileSystem, Request,
|
||||
FileSystem->Interface->Close(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Overwrite));
|
||||
return Result;
|
||||
}
|
||||
@ -827,7 +827,7 @@ FSP_API NTSTATUS FspFileSystemOpCleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
|
||||
{
|
||||
if (0 != FileSystem->Interface->Cleanup)
|
||||
FileSystem->Interface->Cleanup(FileSystem, Request,
|
||||
FileSystem->Interface->Cleanup(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Cleanup),
|
||||
0 != Request->FileName.Size ? (PWSTR)Request->Buffer : 0,
|
||||
0 != Request->Req.Cleanup.Delete);
|
||||
@ -839,7 +839,7 @@ FSP_API NTSTATUS FspFileSystemOpClose(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
|
||||
{
|
||||
if (0 != FileSystem->Interface->Close)
|
||||
FileSystem->Interface->Close(FileSystem, Request,
|
||||
FileSystem->Interface->Close(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Close));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
@ -855,7 +855,7 @@ FSP_API NTSTATUS FspFileSystemOpRead(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
BytesTransferred = 0;
|
||||
Result = FileSystem->Interface->Read(FileSystem, Request,
|
||||
Result = FileSystem->Interface->Read(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Read),
|
||||
(PVOID)Request->Req.Read.Address,
|
||||
Request->Req.Read.Offset,
|
||||
@ -881,7 +881,7 @@ FSP_API NTSTATUS FspFileSystemOpWrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
BytesTransferred = 0;
|
||||
Result = FileSystem->Interface->Write(FileSystem, Request,
|
||||
Result = FileSystem->Interface->Write(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.Write),
|
||||
(PVOID)Request->Req.Write.Address,
|
||||
Request->Req.Write.Offset,
|
||||
@ -908,7 +908,7 @@ FSP_API NTSTATUS FspFileSystemOpFlushBuffers(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (0 == FileSystem->Interface->Flush)
|
||||
return STATUS_SUCCESS; /* liar! */
|
||||
|
||||
return FileSystem->Interface->Flush(FileSystem, Request,
|
||||
return FileSystem->Interface->Flush(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.FlushBuffers));
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ FSP_API NTSTATUS FspFileSystemOpQueryInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
memset(&FileInfo, 0, sizeof FileInfo);
|
||||
Result = FileSystem->Interface->GetFileInfo(FileSystem, Request,
|
||||
Result = FileSystem->Interface->GetFileInfo(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.QueryInformation), &FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
@ -943,7 +943,7 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
{
|
||||
case 4/*FileBasicInformation*/:
|
||||
if (0 != FileSystem->Interface->SetBasicInfo)
|
||||
Result = FileSystem->Interface->SetBasicInfo(FileSystem, Request,
|
||||
Result = FileSystem->Interface->SetBasicInfo(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation),
|
||||
Request->Req.SetInformation.Info.Basic.FileAttributes,
|
||||
Request->Req.SetInformation.Info.Basic.CreationTime,
|
||||
@ -953,14 +953,14 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
break;
|
||||
case 19/*FileAllocationInformation*/:
|
||||
if (0 != FileSystem->Interface->SetFileSize)
|
||||
Result = FileSystem->Interface->SetFileSize(FileSystem, Request,
|
||||
Result = FileSystem->Interface->SetFileSize(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation),
|
||||
Request->Req.SetInformation.Info.Allocation.AllocationSize, TRUE,
|
||||
&FileInfo);
|
||||
break;
|
||||
case 20/*FileEndOfFileInformation*/:
|
||||
if (0 != FileSystem->Interface->SetFileSize)
|
||||
Result = FileSystem->Interface->SetFileSize(FileSystem, Request,
|
||||
Result = FileSystem->Interface->SetFileSize(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation),
|
||||
Request->Req.SetInformation.Info.EndOfFile.FileSize, FALSE,
|
||||
&FileInfo);
|
||||
@ -968,7 +968,7 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
case 13/*FileDispositionInformation*/:
|
||||
if (0 != FileSystem->Interface->GetFileInfo)
|
||||
{
|
||||
Result = FileSystem->Interface->GetFileInfo(FileSystem, Request,
|
||||
Result = FileSystem->Interface->GetFileInfo(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation), &FileInfo);
|
||||
if (NT_SUCCESS(Result) && 0 != (FileInfo.FileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
{
|
||||
@ -978,7 +978,7 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
if (0 != FileSystem->Interface->CanDelete)
|
||||
if (Request->Req.SetInformation.Info.Disposition.Delete)
|
||||
Result = FileSystem->Interface->CanDelete(FileSystem, Request,
|
||||
Result = FileSystem->Interface->CanDelete(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation),
|
||||
(PWSTR)Request->Buffer);
|
||||
else
|
||||
@ -995,7 +995,7 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
STATUS_OBJECT_NAME_NOT_FOUND != Result)
|
||||
break;
|
||||
}
|
||||
Result = FileSystem->Interface->Rename(FileSystem, Request,
|
||||
Result = FileSystem->Interface->Rename(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetInformation),
|
||||
(PWSTR)Request->Buffer,
|
||||
(PWSTR)(Request->Buffer + Request->Req.SetInformation.Info.Rename.NewFileName.Offset),
|
||||
@ -1021,7 +1021,7 @@ FSP_API NTSTATUS FspFileSystemOpQueryVolumeInformation(FSP_FILE_SYSTEM *FileSyst
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
memset(&VolumeInfo, 0, sizeof VolumeInfo);
|
||||
Result = FileSystem->Interface->GetVolumeInfo(FileSystem, Request, &VolumeInfo);
|
||||
Result = FileSystem->Interface->GetVolumeInfo(FileSystem, &VolumeInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
|
||||
@ -1041,7 +1041,7 @@ FSP_API NTSTATUS FspFileSystemOpSetVolumeInformation(FSP_FILE_SYSTEM *FileSystem
|
||||
{
|
||||
case 2/*FileFsLabelInformation*/:
|
||||
if (0 != FileSystem->Interface->SetVolumeLabel)
|
||||
Result = FileSystem->Interface->SetVolumeLabel(FileSystem, Request,
|
||||
Result = FileSystem->Interface->SetVolumeLabel(FileSystem,
|
||||
(PWSTR)Request->Buffer,
|
||||
&VolumeInfo);
|
||||
break;
|
||||
@ -1064,7 +1064,7 @@ FSP_API NTSTATUS FspFileSystemOpQueryDirectory(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
BytesTransferred = 0;
|
||||
Result = FileSystem->Interface->ReadDirectory(FileSystem, Request,
|
||||
Result = FileSystem->Interface->ReadDirectory(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.QueryDirectory),
|
||||
(PVOID)Request->Req.QueryDirectory.Address,
|
||||
Request->Req.QueryDirectory.Offset,
|
||||
@ -1098,7 +1098,7 @@ FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem,
|
||||
memset(ReparseData, 0, sizeof *ReparseData);
|
||||
|
||||
Size = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->GetReparsePoint(FileSystem, Request,
|
||||
Result = FileSystem->Interface->GetReparsePoint(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.FileSystemControl),
|
||||
(PWSTR)Request->Buffer, ReparseData, &Size);
|
||||
if (NT_SUCCESS(Result))
|
||||
@ -1115,7 +1115,7 @@ FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem,
|
||||
ReparseData = (PREPARSE_DATA_BUFFER)
|
||||
(Request->Buffer + Request->Req.FileSystemControl.Buffer.Offset);
|
||||
|
||||
Result = FileSystem->Interface->SetReparsePoint(FileSystem, Request,
|
||||
Result = FileSystem->Interface->SetReparsePoint(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.FileSystemControl),
|
||||
(PWSTR)Request->Buffer,
|
||||
ReparseData,
|
||||
@ -1128,7 +1128,7 @@ FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem,
|
||||
ReparseData = (PREPARSE_DATA_BUFFER)
|
||||
(Request->Buffer + Request->Req.FileSystemControl.Buffer.Offset);
|
||||
|
||||
Result = FileSystem->Interface->DeleteReparsePoint(FileSystem, Request,
|
||||
Result = FileSystem->Interface->DeleteReparsePoint(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.FileSystemControl),
|
||||
(PWSTR)Request->Buffer,
|
||||
ReparseData,
|
||||
@ -1150,7 +1150,7 @@ FSP_API NTSTATUS FspFileSystemOpQuerySecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
SecurityDescriptorSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX;
|
||||
Result = FileSystem->Interface->GetSecurity(FileSystem, Request,
|
||||
Result = FileSystem->Interface->GetSecurity(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.QuerySecurity),
|
||||
Response->Buffer, &SecurityDescriptorSize);
|
||||
if (!NT_SUCCESS(Result))
|
||||
@ -1168,10 +1168,11 @@ FSP_API NTSTATUS FspFileSystemOpSetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (0 == FileSystem->Interface->SetSecurity)
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
return FileSystem->Interface->SetSecurity(FileSystem, Request,
|
||||
return FileSystem->Interface->SetSecurity(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.SetSecurity),
|
||||
Request->Req.SetSecurity.SecurityInformation,
|
||||
(PSECURITY_DESCRIPTOR)Request->Buffer);
|
||||
(PSECURITY_DESCRIPTOR)Request->Buffer,
|
||||
(HANDLE)Request->Req.SetSecurity.AccessToken);
|
||||
}
|
||||
|
||||
FSP_API NTSTATUS FspFileSystemOpQueryStreamInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
@ -1184,7 +1185,7 @@ FSP_API NTSTATUS FspFileSystemOpQueryStreamInformation(FSP_FILE_SYSTEM *FileSyst
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
BytesTransferred = 0;
|
||||
Result = FileSystem->Interface->GetStreamInfo(FileSystem, Request,
|
||||
Result = FileSystem->Interface->GetStreamInfo(FileSystem,
|
||||
(PVOID)USERCONTEXT(Request->Req.QueryStreamInformation),
|
||||
Response->Buffer,
|
||||
FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX,
|
||||
|
@ -691,7 +691,6 @@ static NTSTATUS fsp_fuse_intf_GetReparsePointByName(
|
||||
PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize);
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -715,7 +714,6 @@ static NTSTATUS fsp_fuse_intf_GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_SetVolumeLabel(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR VolumeLabel,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
|
||||
{
|
||||
@ -758,8 +756,7 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -914,8 +911,7 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -941,7 +937,7 @@ static NTSTATUS fsp_fuse_intf_Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
memset(&fi, 0, sizeof fi);
|
||||
switch (Request->Req.Create.DesiredAccess & (FILE_READ_DATA | FILE_WRITE_DATA))
|
||||
switch (GrantedAccess & (FILE_READ_DATA | FILE_WRITE_DATA))
|
||||
{
|
||||
default:
|
||||
case FILE_READ_DATA:
|
||||
@ -1017,7 +1013,6 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -1055,7 +1050,6 @@ static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PWSTR FileName, BOOLEAN Delete)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -1092,7 +1086,6 @@ static VOID fsp_fuse_intf_Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static VOID fsp_fuse_intf_Close(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -1126,7 +1119,6 @@ static VOID fsp_fuse_intf_Close(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PULONG PBytesTransferred)
|
||||
{
|
||||
@ -1161,7 +1153,6 @@ static NTSTATUS fsp_fuse_intf_Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
BOOLEAN WriteToEndOfFile, BOOLEAN ConstrainedIo,
|
||||
PULONG PBytesTransferred, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
@ -1224,7 +1215,6 @@ success:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -1264,7 +1254,6 @@ static NTSTATUS fsp_fuse_intf_Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -1282,7 +1271,6 @@ static NTSTATUS fsp_fuse_intf_GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT32 FileAttributes,
|
||||
UINT64 CreationTime, UINT64 LastAccessTime, UINT64 LastWriteTime,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
@ -1361,7 +1349,6 @@ static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_SetFileSize(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, UINT64 NewSize, BOOLEAN SetAllocationSize,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -1445,7 +1432,6 @@ static int fsp_fuse_intf_CanDeleteAddDirInfoOld(fuse_dirh_t dh, const char *name
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_CanDelete(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PWSTR FileName)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
@ -1479,7 +1465,6 @@ static NTSTATUS fsp_fuse_intf_CanDelete(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_Rename(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PWSTR NewFileName, BOOLEAN ReplaceIfExists)
|
||||
{
|
||||
@ -1513,7 +1498,6 @@ static NTSTATUS fsp_fuse_intf_Rename(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptorBuf, SIZE_T *PSecurityDescriptorSize)
|
||||
{
|
||||
@ -1531,9 +1515,9 @@ static NTSTATUS fsp_fuse_intf_GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_SetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR Ignored)
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor,
|
||||
HANDLE AccessToken)
|
||||
{
|
||||
struct fuse *f = FileSystem->UserContext;
|
||||
struct fsp_fuse_file_desc *filedesc = FileNode;
|
||||
@ -1560,7 +1544,11 @@ static NTSTATUS fsp_fuse_intf_SetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
Result = FspSetSecurityDescriptor(FileSystem, Request, SecurityDescriptor,
|
||||
Result = FspSetSecurityDescriptor(
|
||||
SecurityDescriptor,
|
||||
SecurityInformation,
|
||||
ModificationDescriptor,
|
||||
AccessToken,
|
||||
&NewSecurityDescriptor);
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
@ -1663,7 +1651,6 @@ int fsp_fuse_intf_AddDirInfoOld(fuse_dirh_t dh, const char *name,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PWSTR Pattern,
|
||||
PULONG PBytesTransferred)
|
||||
@ -1871,7 +1858,6 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_GetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, PSIZE_T PSize)
|
||||
{
|
||||
@ -1886,7 +1872,6 @@ static NTSTATUS fsp_fuse_intf_GetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_SetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size)
|
||||
{
|
||||
@ -1971,6 +1956,8 @@ static NTSTATUS fsp_fuse_intf_SetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (0 == (ReparseData->SymbolicLinkReparseBuffer.Flags & SYMLINK_FLAG_RELATIVE) &&
|
||||
ReparseTargetPathLength >= sizeof(WCHAR) && L'\\' == ReparseTargetPath[0])
|
||||
{
|
||||
FSP_FSCTL_TRANSACT_REQ *Request = FspFileSystemGetOperationContext()->Request;
|
||||
|
||||
/* we do not support absolute paths that point outside this file system */
|
||||
if (0 == Request->Req.FileSystemControl.TargetOnFileSystem)
|
||||
return STATUS_ACCESS_DENIED;
|
||||
@ -2081,7 +2068,6 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS fsp_fuse_intf_DeleteReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size)
|
||||
{
|
||||
|
@ -412,16 +412,15 @@ FSP_API NTSTATUS FspCreateSecurityDescriptor(FSP_FILE_SYSTEM *FileSystem,
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FSP_API NTSTATUS FspSetSecurityDescriptor(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
FSP_API NTSTATUS FspSetSecurityDescriptor(
|
||||
PSECURITY_DESCRIPTOR InputDescriptor,
|
||||
SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR ModificationDescriptor,
|
||||
HANDLE AccessToken,
|
||||
PSECURITY_DESCRIPTOR *PSecurityDescriptor)
|
||||
{
|
||||
*PSecurityDescriptor = 0;
|
||||
|
||||
if (FspFsctlTransactSetSecurityKind != Request->Kind)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (0 == InputDescriptor)
|
||||
return STATUS_NO_SECURITY_ON_OBJECT;
|
||||
|
||||
@ -455,11 +454,11 @@ FSP_API NTSTATUS FspSetSecurityDescriptor(FSP_FILE_SYSTEM *FileSystem,
|
||||
InputDescriptor = CopiedDescriptor;
|
||||
|
||||
if (!SetPrivateObjectSecurity(
|
||||
Request->Req.SetSecurity.SecurityInformation,
|
||||
(PVOID)Request->Buffer,
|
||||
SecurityInformation,
|
||||
ModificationDescriptor,
|
||||
&InputDescriptor,
|
||||
&FspFileGenericMapping,
|
||||
(HANDLE)Request->Req.SetSecurity.AccessToken))
|
||||
AccessToken))
|
||||
{
|
||||
HeapFree(ProcessHeap, 0, CopiedDescriptor);
|
||||
return FspNtStatusFromWin32(GetLastError());
|
||||
|
@ -405,12 +405,10 @@ static NTSTATUS GetReparsePointByName(
|
||||
PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize);
|
||||
|
||||
static NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, UINT64 NewSize, BOOLEAN SetAllocationSize,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
|
||||
{
|
||||
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
|
||||
@ -425,7 +423,6 @@ static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS SetVolumeLabel(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR VolumeLabel,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
|
||||
{
|
||||
@ -499,8 +496,7 @@ static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -617,8 +613,7 @@ static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PWSTR FileName, BOOLEAN CaseSensitive, UINT32 CreateOptions,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
|
||||
@ -644,7 +639,7 @@ static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
* TBD.
|
||||
*/
|
||||
if (0 == (FileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
|
||||
Request->Req.Create.DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))
|
||||
(GrantedAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)))
|
||||
FileNode->FileInfo.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||
|
||||
FileNode->RefCount++;
|
||||
@ -666,7 +661,6 @@ static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
NTSTATUS Overwrite(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -705,7 +699,6 @@ static BOOLEAN CleanupEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
|
||||
#endif
|
||||
|
||||
static VOID Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PWSTR FileName, BOOLEAN Delete)
|
||||
{
|
||||
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
|
||||
@ -734,7 +727,6 @@ static VOID Cleanup(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static VOID Close(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0)
|
||||
{
|
||||
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
|
||||
@ -745,7 +737,6 @@ static VOID Close(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PULONG PBytesTransferred)
|
||||
{
|
||||
@ -767,7 +758,6 @@ static NTSTATUS Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
BOOLEAN WriteToEndOfFile, BOOLEAN ConstrainedIo,
|
||||
PULONG PBytesTransferred, FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
@ -805,7 +795,7 @@ static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
Offset = FileNode->FileInfo.FileSize;
|
||||
EndOffset = Offset + Length;
|
||||
if (EndOffset > FileNode->FileInfo.FileSize)
|
||||
SetFileSize(FileSystem, Request, FileNode, EndOffset, FALSE, FileInfo);
|
||||
SetFileSize(FileSystem, FileNode, EndOffset, FALSE, FileInfo);
|
||||
}
|
||||
|
||||
memcpy((PUINT8)FileNode->FileData + Offset, Buffer, (size_t)(EndOffset - Offset));
|
||||
@ -817,7 +807,6 @@ static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
NTSTATUS Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode)
|
||||
{
|
||||
/* nothing to do, since we do not cache anything */
|
||||
@ -825,7 +814,6 @@ NTSTATUS Flush(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -837,7 +825,6 @@ static NTSTATUS GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, UINT32 FileAttributes,
|
||||
UINT64 CreationTime, UINT64 LastAccessTime, UINT64 LastWriteTime,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
@ -864,7 +851,6 @@ static NTSTATUS SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, UINT64 NewSize, BOOLEAN SetAllocationSize,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo)
|
||||
{
|
||||
@ -898,7 +884,7 @@ static NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem,
|
||||
UINT64 AllocationUnit = MEMFS_SECTOR_SIZE * MEMFS_SECTORS_PER_ALLOCATION_UNIT;
|
||||
UINT64 AllocationSize = (NewSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
|
||||
|
||||
NTSTATUS Result = SetFileSize(FileSystem, Request, FileNode, AllocationSize, TRUE,
|
||||
NTSTATUS Result = SetFileSize(FileSystem, FileNode, AllocationSize, TRUE,
|
||||
FileInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
@ -917,7 +903,6 @@ static NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS CanDelete(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PWSTR FileName)
|
||||
{
|
||||
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
|
||||
@ -946,7 +931,6 @@ static BOOLEAN RenameEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
|
||||
}
|
||||
|
||||
static NTSTATUS Rename(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
PWSTR FileName, PWSTR NewFileName, BOOLEAN ReplaceIfExists)
|
||||
{
|
||||
@ -1034,7 +1018,6 @@ exit:
|
||||
}
|
||||
|
||||
static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize)
|
||||
{
|
||||
@ -1059,9 +1042,9 @@ static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS SetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor,
|
||||
HANDLE AccessToken)
|
||||
{
|
||||
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
|
||||
PSECURITY_DESCRIPTOR NewSecurityDescriptor, FileSecurity;
|
||||
@ -1073,7 +1056,11 @@ static NTSTATUS SetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
FileNode = FileNode->MainFileNode;
|
||||
#endif
|
||||
|
||||
Result = FspSetSecurityDescriptor(FileSystem, Request, FileNode->FileSecurity,
|
||||
Result = FspSetSecurityDescriptor(
|
||||
FileNode->FileSecurity,
|
||||
SecurityInformation,
|
||||
ModificationDescriptor,
|
||||
AccessToken,
|
||||
&NewSecurityDescriptor);
|
||||
if (!NT_SUCCESS(Result))
|
||||
return Result;
|
||||
@ -1143,7 +1130,6 @@ static BOOLEAN ReadDirectoryEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
|
||||
}
|
||||
|
||||
static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PWSTR Pattern,
|
||||
PULONG PBytesTransferred)
|
||||
@ -1222,7 +1208,6 @@ static NTSTATUS GetReparsePointByName(
|
||||
}
|
||||
|
||||
static NTSTATUS GetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
PWSTR FileName, PVOID Buffer, PSIZE_T PSize)
|
||||
{
|
||||
@ -1246,7 +1231,6 @@ static NTSTATUS GetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS SetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size)
|
||||
{
|
||||
@ -1287,7 +1271,6 @@ static NTSTATUS SetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
|
||||
static NTSTATUS DeleteReparsePoint(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0,
|
||||
PWSTR FileName, PVOID Buffer, SIZE_T Size)
|
||||
{
|
||||
@ -1358,7 +1341,6 @@ static BOOLEAN GetStreamInfoEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
|
||||
}
|
||||
|
||||
static NTSTATUS GetStreamInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID FileNode0, PVOID Buffer, ULONG Length,
|
||||
PULONG PBytesTransferred)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user