#[repr(C)]
pub struct _FSP_FILE_SYSTEM_INTERFACE {
Show 34 fields pub GetVolumeInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, VolumeInfo: *mut FSP_FSCTL_VOLUME_INFO) -> NTSTATUS>, pub SetVolumeLabelW: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, VolumeLabel: PWSTR, VolumeInfo: *mut FSP_FSCTL_VOLUME_INFO) -> NTSTATUS>, pub GetSecurityByName: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, PFileAttributes: PUINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, PSecurityDescriptorSize: *mut SIZE_T) -> NTSTATUS>, pub Create: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, FileAttributes: UINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, AllocationSize: UINT64, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub Open: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub Overwrite: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, ReplaceFileAttributes: BOOLEAN, AllocationSize: UINT64, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub Cleanup: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Flags: ULONG)>, pub Close: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID)>, pub Read: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Offset: UINT64, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>, pub Write: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Offset: UINT64, Length: ULONG, WriteToEndOfFile: BOOLEAN, ConstrainedIo: BOOLEAN, PBytesTransferred: PULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub Flush: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub GetFileInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub SetBasicInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, CreationTime: UINT64, LastAccessTime: UINT64, LastWriteTime: UINT64, ChangeTime: UINT64, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub SetFileSize: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, NewSize: UINT64, SetAllocationSize: BOOLEAN, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub CanDelete: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR) -> NTSTATUS>, pub Rename: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, NewFileName: PWSTR, ReplaceIfExists: BOOLEAN) -> NTSTATUS>, pub GetSecurity: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, SecurityDescriptor: PSECURITY_DESCRIPTOR, PSecurityDescriptorSize: *mut SIZE_T) -> NTSTATUS>, pub SetSecurity: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, SecurityInformation: SECURITY_INFORMATION, ModificationDescriptor: PSECURITY_DESCRIPTOR) -> NTSTATUS>, pub ReadDirectory: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Pattern: PWSTR, Marker: PWSTR, Buffer: PVOID, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>, pub ResolveReparsePoints: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, ReparsePointIndex: UINT32, ResolveLastPathComponent: BOOLEAN, PIoStatus: PIO_STATUS_BLOCK, Buffer: PVOID, PSize: PSIZE_T) -> NTSTATUS>, pub GetReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, PSize: PSIZE_T) -> NTSTATUS>, pub SetReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, Size: SIZE_T) -> NTSTATUS>, pub DeleteReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, Size: SIZE_T) -> NTSTATUS>, pub GetStreamInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>, pub GetDirInfoByName: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, DirInfo: *mut FSP_FSCTL_DIR_INFO) -> NTSTATUS>, pub Control: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, ControlCode: UINT32, InputBuffer: PVOID, InputBufferLength: ULONG, OutputBuffer: PVOID, OutputBufferLength: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>, pub SetDelete: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, DeleteFileW: BOOLEAN) -> NTSTATUS>, pub CreateEx: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, FileAttributes: UINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, AllocationSize: UINT64, ExtraBuffer: PVOID, ExtraLength: ULONG, ExtraBufferIsReparsePoint: BOOLEAN, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub OverwriteEx: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, ReplaceFileAttributes: BOOLEAN, AllocationSize: UINT64, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub GetEa: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>, pub SetEa: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>, pub Obsolete0: Option<unsafe extern "C" fn() -> NTSTATUS>, pub DispatcherStopped: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, Normally: BOOLEAN)>, pub Reserved: [Option<unsafe extern "C" fn() -> NTSTATUS>; 31],
}
Expand description

@class FSP_FILE_SYSTEM File system interface.

The operations in this interface must be implemented by the user mode file system. Not all operations need be implemented. For example, a user mode file system that does not wish to support reparse points, need not implement the reparse point operations.

Most of the operations accept a FileContext parameter. This parameter has different meanings depending on the value of the FSP_FSCTL_VOLUME_PARAMS flags UmFileContextIsUserContext2 and UmFileContextIsFullContext.

There are three cases to consider:

  • When both of these flags are unset (default), the FileContext parameter represents the file node. The file node is a void pointer (or an integer that can fit in a pointer) that is used to uniquely identify an open file. Opening the same file name should always yield the same file node value for as long as the file with that name remains open anywhere in the system.
  • When the UmFileContextIsUserContext2 is set, the FileContext parameter represents the file descriptor. The file descriptor is a void pointer (or an integer that can fit in a pointer) that is used to identify an open instance of a file. Opening the same file name may yield a different file descriptor.
  • When the UmFileContextIsFullContext is set, the FileContext parameter is a pointer to a FSP_FSCTL_TRANSACT_FULL_CONTEXT. This allows a user mode file system to access the low-level UserContext and UserContext2 values. The UserContext is used to store the file node and the UserContext2 is used to store the file descriptor for an open file.

Fields§

§GetVolumeInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, VolumeInfo: *mut FSP_FSCTL_VOLUME_INFO) -> NTSTATUS>

Get volume information.

@param FileSystem The file system on which this request is posted. @param VolumeInfo [out] Pointer to a structure that will receive the volume information on successful return from this call. @return STATUS_SUCCESS or error code.

§SetVolumeLabelW: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, VolumeLabel: PWSTR, VolumeInfo: *mut FSP_FSCTL_VOLUME_INFO) -> NTSTATUS>§GetSecurityByName: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, PFileAttributes: PUINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, PSecurityDescriptorSize: *mut SIZE_T) -> NTSTATUS>

Get file or directory attributes and security descriptor given a file name.

@param FileSystem The file system on which this request is posted. @param FileName The name of the file or directory to get the attributes and security descriptor for. @param PFileAttributes Pointer to a memory location that will receive the file attributes on successful return from this call. May be NULL.

If this call returns STATUS_REPARSE, the file system MAY place here the index of the
first reparse point within FileName. The file system MAY also leave this at its default
value of 0.

@param SecurityDescriptor Pointer to a buffer that will receive the file security descriptor on successful return from this call. May be NULL. @param PSecurityDescriptorSize [in,out] Pointer to the security descriptor buffer size. On input it contains the size of the security descriptor buffer. On output it will contain the actual size of the security descriptor copied into the security descriptor buffer. May be NULL. @return STATUS_SUCCESS, STATUS_REPARSE or error code.

STATUS_REPARSE should be returned by file systems that support reparse points when
they encounter a FileName that contains reparse points anywhere but the final path
component.
§Create: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, FileAttributes: UINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, AllocationSize: UINT64, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Create new file or directory.

@param FileSystem The file system on which this request is posted. @param FileName The name of the file or directory to be created. @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 only be concerned with the flag FILE_DIRECTORY_FILE, which is an instruction to create a 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. Will be NULL for named streams. @param AllocationSize Allocation size for the newly created file. @param PFileContext [out] Pointer that will receive the file context on successful return from this call. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§Open: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Open a file or directory.

@param FileSystem The file system on which this request is posted. @param FileName The name of the file or directory to be opened. @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 PFileContext [out] Pointer that will receive the file context on successful return from this call. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§Overwrite: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, ReplaceFileAttributes: BOOLEAN, AllocationSize: UINT64, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Overwrite a file.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to overwrite. @param FileAttributes File attributes to apply to the overwritten file. @param ReplaceFileAttributes When TRUE the existing file attributes should be replaced with the new ones. When FALSE the existing file attributes should be merged (or’ed) with the new ones. @param AllocationSize Allocation size for the overwritten file. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§Cleanup: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Flags: ULONG)>

Cleanup a file.

When CreateFile is used to open or create a file the kernel creates a kernel mode file object (type FILE_OBJECT) and a handle for it, which it returns to user-mode. The handle may be duplicated (using DuplicateHandle), but all duplicate handles always refer to the same file object. When all handles for a particular file object get closed (using CloseHandle) the system sends a Cleanup request to the file system.

There will be a Cleanup operation for every Create or Open operation posted to the user mode file system. However the Cleanup operation is not the final close operation on a file. The file system must be ready to receive additional operations until close time. This is true even when the file is being deleted!

The Flags parameter contains information about the cleanup operation:

  • FspCleanupDelete - An important function of the Cleanup operation is to complete a delete operation. Deleting a file or directory in Windows is a three-stage process where the file is first opened, then tested to see if the delete can proceed and if the answer is positive the file is then deleted during Cleanup.

    If the file system supports POSIX unlink (FSP_FSCTL_VOLUME_PARAMS :: SupportsPosixUnlinkRename), then a Cleanup / FspCleanupDelete operation may arrive while there are other open file handles for this particular file node. If the file system does not support POSIX unlink, then a Cleanup / FspCleanupDelete operation will always be the last outstanding cleanup for this particular file node.

  • FspCleanupSetAllocationSize - The NTFS and FAT file systems reset a file's allocation size when they receive the last outstanding cleanup for a particular file node. User mode file systems that implement allocation size and wish to duplicate the NTFS and FAT behavior can use this flag.
  • FspCleanupSetArchiveBit - File systems that support the archive bit should set the file node's archive bit when this flag is set.
  • FspCleanupSetLastAccessTime, FspCleanupSetLastWriteTime, FspCleanupSetChangeTime - File systems should set the corresponding file time when each one of these flags is set. Note that updating the last access time is expensive and a file system may choose to not implement it.

There is no way to report failure of this operation. This is a Windows limitation.

As an optimization a file system may specify the FSP_FSCTL_VOLUME_PARAMS :: PostCleanupWhenModifiedOnly flag. In this case the FSD will only post Cleanup requests when the file was modified/deleted.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to cleanup. @param FileName The name of the file or directory to cleanup. Sent only when a Delete is requested. @param Flags These flags determine whether the file was modified and whether to delete the file. @see Close CanDelete SetDelete

§Close: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID)>

Close a file.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to be closed.

§Read: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Offset: UINT64, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>

Read a file.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to be read. @param Buffer Pointer to a buffer that will receive the results of the read operation. @param Offset Offset within the file to read from. @param Length Length of data to read. @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes read. @return STATUS_SUCCESS or error code. STATUS_PENDING is supported allowing for asynchronous operation.

§Write: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Offset: UINT64, Length: ULONG, WriteToEndOfFile: BOOLEAN, ConstrainedIo: BOOLEAN, PBytesTransferred: PULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Write a file.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to be written. @param Buffer Pointer to a buffer that contains the data to write. @param Offset Offset within the file to write to. @param Length Length of data to write. @param WriteToEndOfFile When TRUE the file system must write to the current end of file. In this case the Offset parameter will contain the value -1. @param ConstrainedIo When TRUE the file system must not extend the file (i.e. change the file size). @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes written. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code. STATUS_PENDING is supported allowing for asynchronous operation.

§Flush: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Flush a file or volume.

Note that the FSD will also flush all file/volume caches prior to invoking this operation.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to be flushed. When NULL the whole volume is being flushed. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. Used when flushing file (not volume). @return STATUS_SUCCESS or error code.

§GetFileInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Get file or directory information.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to get information for. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§SetBasicInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, CreationTime: UINT64, LastAccessTime: UINT64, LastWriteTime: UINT64, ChangeTime: UINT64, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Set file or directory basic information.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to set information for. @param FileAttributes File attributes to apply to the file or directory. If the value INVALID_FILE_ATTRIBUTES is sent, the file attributes should not be changed. @param CreationTime Creation time to apply to the file or directory. If the value 0 is sent, the creation time should not be changed. @param LastAccessTime Last access time to apply to the file or directory. If the value 0 is sent, the last access time should not be changed. @param LastWriteTime Last write time to apply to the file or directory. If the value 0 is sent, the last write time should not be changed. @param ChangeTime Change time to apply to the file or directory. If the value 0 is sent, the change time should not be changed. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§SetFileSize: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, NewSize: UINT64, SetAllocationSize: BOOLEAN, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Set file/allocation size.

This function is used to change a file’s sizes. Windows file systems maintain two kinds of sizes: the file size is where the End Of File (EOF) is, and the allocation size is the actual size that a file takes up on the “disk”.

The rules regarding file/allocation size are:

  • Allocation size must always be aligned to the allocation unit boundary. The allocation unit is the product (UINT64)SectorSize * (UINT64)SectorsPerAllocationUnit from the FSP_FSCTL_VOLUME_PARAMS structure. The FSD will always send properly aligned allocation sizes when setting the allocation size.
  • Allocation size is always greater or equal to the file size.
  • A file size of more than the current allocation size will also extend the allocation size to the next allocation unit boundary.
  • An allocation size of less than the current file size should also truncate the current file size.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to set the file/allocation size for. @param NewSize New file/allocation size to apply to the file. @param SetAllocationSize If TRUE, then the allocation size is being set. if FALSE, then the file size is being set. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§CanDelete: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR) -> NTSTATUS>

Determine whether a file or directory can be deleted.

This function tests whether a file or directory can be safely deleted. This function does not need to perform access checks, but may performs tasks such as check for empty directories, etc.

This function should NEVER delete the file or directory in question. Deletion should happen during Cleanup with the FspCleanupDelete flag set.

This function gets called when Win32 API’s such as DeleteFile or RemoveDirectory are used. It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.

NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However most file systems need only implement the CanDelete operation.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to test for deletion. @param FileName The name of the file or directory to test for deletion. @return STATUS_SUCCESS or error code. @see Cleanup SetDelete

§Rename: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, NewFileName: PWSTR, ReplaceIfExists: BOOLEAN) -> NTSTATUS>

Renames a file or directory.

The kernel mode FSD provides certain guarantees prior to posting a rename operation:

  • A file cannot be renamed if a file with the same name exists and has open handles.
  • A directory cannot be renamed if it or any of its subdirectories contains a file that has open handles.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to be renamed. @param FileName The current name of the file or directory to rename. @param NewFileName The new name for the file or directory. @param ReplaceIfExists Whether to replace a file that already exists at NewFileName. @return STATUS_SUCCESS or error code.

§GetSecurity: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, SecurityDescriptor: PSECURITY_DESCRIPTOR, PSecurityDescriptorSize: *mut SIZE_T) -> NTSTATUS>

Get file or directory security descriptor.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to get the security descriptor for. @param SecurityDescriptor Pointer to a buffer that will receive the file security descriptor on successful return from this call. May be NULL. @param PSecurityDescriptorSize [in,out] Pointer to the security descriptor buffer size. On input it contains the size of the security descriptor buffer. On output it will contain the actual size of the security descriptor copied into the security descriptor buffer. Cannot be NULL. @return STATUS_SUCCESS or error code.

§SetSecurity: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, SecurityInformation: SECURITY_INFORMATION, ModificationDescriptor: PSECURITY_DESCRIPTOR) -> NTSTATUS>

Set file or directory security descriptor.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to set the security descriptor for. @param SecurityInformation 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. @return STATUS_SUCCESS or error code. @see FspSetSecurityDescriptor FspDeleteSecurityDescriptor

§ReadDirectory: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Pattern: PWSTR, Marker: PWSTR, Buffer: PVOID, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>

Read a directory.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the directory to be read. @param Pattern The pattern to match against files in this directory. Can be NULL. The file system can choose to ignore this parameter as the FSD will always perform its own pattern matching on the returned results. @param Marker A file name that marks where in the directory to start reading. Files with names that are greater than (not equal to) this marker (in the directory order determined by the file system) should be returned. Can be NULL. @param Buffer Pointer to a buffer that will receive the results of the read operation. @param Length Length of data to read. @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes read. @return STATUS_SUCCESS or error code. STATUS_PENDING is supported allowing for asynchronous operation. @see FspFileSystemAddDirInfo

§ResolveReparsePoints: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, ReparsePointIndex: UINT32, ResolveLastPathComponent: BOOLEAN, PIoStatus: PIO_STATUS_BLOCK, Buffer: PVOID, PSize: PSIZE_T) -> NTSTATUS>

Resolve reparse points.

Reparse points are a general mechanism for attaching special behavior to files. A file or directory can contain a reparse point. A reparse point is data that has special meaning to the file system, Windows or user applications. For example, NTFS and Windows use reparse points to implement symbolic links. As another example, a particular file system may use reparse points to emulate UNIX FIFO’s.

This function is expected to resolve as many reparse points as possible. If a reparse point is encountered that is not understood by the file system further reparse point resolution should stop; the reparse point data should be returned to the FSD with status STATUS_REPARSE/reparse-tag. If a reparse point (symbolic link) is encountered that is understood by the file system but points outside it, the reparse point should be resolved, but further reparse point resolution should stop; the resolved file name should be returned to the FSD with status STATUS_REPARSE/IO_REPARSE.

@param FileSystem The file system on which this request is posted. @param FileName The name of the file or directory to have its reparse points resolved. @param ReparsePointIndex The index of the first reparse point within FileName. @param ResolveLastPathComponent If FALSE, the last path component of FileName should not be resolved, even if it is a reparse point that can be resolved. If TRUE, all path components should be resolved if possible. @param PIoStatus Pointer to storage that will receive the status to return to the FSD. When this function succeeds it must set PIoStatus->Status to STATUS_REPARSE and PIoStatus->Information to either IO_REPARSE or the reparse tag. @param Buffer Pointer to a buffer that will receive the resolved file name (IO_REPARSE) or reparse data (reparse tag). If the function returns a file name, it should not be NULL terminated. @param PSize [in,out] Pointer to the buffer size. On input it contains the size of the buffer. On output it will contain the actual size of data copied. @return STATUS_REPARSE or error code.

§GetReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, PSize: PSIZE_T) -> NTSTATUS>

Get reparse point.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the reparse point. @param FileName The file name of the reparse point. @param Buffer Pointer to a buffer that will receive the results of this operation. If the function returns a symbolic link path, it should not be NULL terminated. @param PSize [in,out] Pointer to the buffer size. On input it contains the size of the buffer. On output it will contain the actual size of data copied. @return STATUS_SUCCESS or error code. @see SetReparsePoint

§SetReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, Size: SIZE_T) -> NTSTATUS>

Set reparse point.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the reparse point. @param FileName The file name of the reparse point. @param Buffer Pointer to a buffer that contains the data for this operation. If this buffer contains a symbolic link path, it should not be assumed to be NULL terminated. @param Size Size of data to write. @return STATUS_SUCCESS or error code. @see GetReparsePoint

§DeleteReparsePoint: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, Buffer: PVOID, Size: SIZE_T) -> NTSTATUS>

Delete reparse point.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the reparse point. @param FileName The file name of the reparse point. @param Buffer Pointer to a buffer that contains the data for this operation. @param Size Size of data to write. @return STATUS_SUCCESS or error code.

§GetStreamInfo: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Buffer: PVOID, Length: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>

Get named streams information.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to get stream information for. @param Buffer Pointer to a buffer that will receive the stream information. @param Length Length of buffer. @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes stored. @return STATUS_SUCCESS or error code. @see FspFileSystemAddStreamInfo

§GetDirInfoByName: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, DirInfo: *mut FSP_FSCTL_DIR_INFO) -> NTSTATUS>

Get directory information for a single file or directory within a parent directory.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the parent directory. @param FileName The name of the file or directory to get information for. This name is relative to the parent directory and is a single path component. @param DirInfo [out] Pointer to a structure that will receive the directory information on successful return from this call. This information includes the file name, but also file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§Control: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, ControlCode: UINT32, InputBuffer: PVOID, InputBufferLength: ULONG, OutputBuffer: PVOID, OutputBufferLength: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>

Process control code.

This function is called when a program uses the DeviceIoControl API.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to be controled. @param ControlCode The control code for the operation. This code must have a DeviceType with bit 0x8000 set and must have a TransferType of METHOD_BUFFERED. @param InputBuffer Pointer to a buffer that contains the input data. @param InputBufferLength Input data length. @param OutputBuffer Pointer to a buffer that will receive the output data. @param OutputBufferLength Output data length. @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes transferred. @return STATUS_SUCCESS or error code.

§SetDelete: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileName: PWSTR, DeleteFileW: BOOLEAN) -> NTSTATUS>

Set the file delete flag.

This function sets a flag to indicates whether the FSD file should delete a file when it is closed. This function does not need to perform access checks, but may performs tasks such as check for empty directories, etc.

This function should NEVER delete the file or directory in question. Deletion should happen during Cleanup with the FspCleanupDelete flag set.

This function gets called when Win32 API’s such as DeleteFile or RemoveDirectory are used. It does not get called when a file or directory is opened with FILE_DELETE_ON_CLOSE.

NOTE: If both CanDelete and SetDelete are defined, SetDelete takes precedence. However most file systems need only implement the CanDelete operation.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file or directory to set the delete flag for. @param FileName The name of the file or directory to set the delete flag for. @param DeleteFile If set to TRUE the FSD indicates that the file will be deleted on Cleanup; otherwise it will not be deleted. It is legal to receive multiple SetDelete calls for the same file with different DeleteFile parameters. @return STATUS_SUCCESS or error code. @see Cleanup CanDelete

§CreateEx: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileName: PWSTR, CreateOptions: UINT32, GrantedAccess: UINT32, FileAttributes: UINT32, SecurityDescriptor: PSECURITY_DESCRIPTOR, AllocationSize: UINT64, ExtraBuffer: PVOID, ExtraLength: ULONG, ExtraBufferIsReparsePoint: BOOLEAN, PFileContext: *mut PVOID, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Create new file or directory.

This function works like Create, except that it also accepts an extra buffer that may contain extended attributes or a reparse point.

NOTE: If both Create and CreateEx are defined, CreateEx takes precedence.

@param FileSystem The file system on which this request is posted. @param FileName The name of the file or directory to be created. @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 only be concerned with the flag FILE_DIRECTORY_FILE, which is an instruction to create a 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. Will be NULL for named streams. @param AllocationSize Allocation size for the newly created file. @param ExtraBuffer Extended attributes or reparse point buffer. @param ExtraLength Extended attributes or reparse point buffer length. @param ExtraBufferIsReparsePoint FALSE: extra buffer is extended attributes; TRUE: extra buffer is reparse point. @param PFileContext [out] Pointer that will receive the file context on successful return from this call. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§OverwriteEx: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, FileAttributes: UINT32, ReplaceFileAttributes: BOOLEAN, AllocationSize: UINT64, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Overwrite a file.

This function works like Overwrite, except that it also accepts EA (extended attributes).

NOTE: If both Overwrite and OverwriteEx are defined, OverwriteEx takes precedence.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to overwrite. @param FileAttributes File attributes to apply to the overwritten file. @param ReplaceFileAttributes When TRUE the existing file attributes should be replaced with the new ones. When FALSE the existing file attributes should be merged (or’ed) with the new ones. @param AllocationSize Allocation size for the overwritten file. @param Ea Extended attributes buffer. @param EaLength Extended attributes buffer length. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code.

§GetEa: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, PBytesTransferred: PULONG) -> NTSTATUS>

Get extended attributes.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to get extended attributes for. @param Ea Extended attributes buffer. @param EaLength Extended attributes buffer length. @param PBytesTransferred [out] Pointer to a memory location that will receive the actual number of bytes transferred. @return STATUS_SUCCESS or error code. @see SetEa FspFileSystemAddEa

§SetEa: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, FileContext: PVOID, Ea: PFILE_FULL_EA_INFORMATION, EaLength: ULONG, FileInfo: *mut FSP_FSCTL_FILE_INFO) -> NTSTATUS>

Set extended attributes.

@param FileSystem The file system on which this request is posted. @param FileContext The file context of the file to set extended attributes for. @param Ea Extended attributes buffer. @param EaLength Extended attributes buffer length. @param FileInfo [out] Pointer to a structure that will receive the file information on successful return from this call. This information includes file attributes, file times, etc. @return STATUS_SUCCESS or error code. @see GetEa

§Obsolete0: Option<unsafe extern "C" fn() -> NTSTATUS>§DispatcherStopped: Option<unsafe extern "C" fn(FileSystem: *mut FSP_FILE_SYSTEM, Normally: BOOLEAN)>

Inform the file system that its dispatcher has been stopped.

Prior to WinFsp v2.0 the FSD would never unmount a file system volume unless the user mode file system requested the unmount. Since WinFsp v2.0 it is possible for the FSD to unmount a file system volume without an explicit user mode file system request. For example, this happens when the FSD is being uninstalled.

A user mode file system can use this operation to determine when its dispatcher has been stopped. The Normally parameter can be used to determine why the dispatcher was stopped: it is TRUE when the file system is being stopped via FspFileSystemStopDispatcher and FALSE otherwise.

When the file system receives a request with Normally == TRUE it need not take any extra steps. This case is the same as for pre-v2.0 versions: since the file system stopped the dispatcher via FspFileSystemStopDispatcher, it will likely exit its process soon.

When the file system receives a request with Normally == FALSE it may need to take extra steps to exit its process as this is not done by default.

A file system that uses the FspService infrastructure may use the FspFileSystemStopServiceIfNecessary API to correctly handle all cases.

This operation is the last one that a file system will receive.

@param FileSystem The file system on which this request is posted. @param Normally TRUE if the file system is being stopped via FspFileSystemStopDispatcher. FALSE if the file system is being stopped because of another reason such as driver unload/uninstall. @see FspFileSystemStopServiceIfNecessary

§Reserved: [Option<unsafe extern "C" fn() -> NTSTATUS>; 31]

Trait Implementations§

source§

impl Clone for _FSP_FILE_SYSTEM_INTERFACE

source§

fn clone(&self) -> _FSP_FILE_SYSTEM_INTERFACE

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for _FSP_FILE_SYSTEM_INTERFACE

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for _FSP_FILE_SYSTEM_INTERFACE

source§

fn default() -> _FSP_FILE_SYSTEM_INTERFACE

Returns the “default value” for a type. Read more
source§

impl Copy for _FSP_FILE_SYSTEM_INTERFACE

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.