|
Dokan 3.0.0
User mode file system library for windows with FUSE Wrapper
|
Dokan Library const and methods. More...
Topics | |
| Dokan Notify | |
| Dokan User FS file-change notification. | |
Macros | |
| #define | DOKAN_VERSION 300 |
| #define | DOKAN_MINIMUM_COMPATIBLE_VERSION 300 |
| #define | DOKAN_DRIVER_NAME L"dokan" DOKAN_MAJOR_API_VERSION L".sys" |
| #define | DOKAN_NP_NAME L"Dokan" DOKAN_MAJOR_API_VERSION |
Functions | |
| VOID | DokanInit () |
| Initialize all required Dokan internal resources. | |
| VOID | DokanShutdown () |
| Release all allocated resources by DokanInit when they are no longer needed. | |
| int | DokanMain (PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations) |
| Mount a new Dokan Volume. | |
| int | DokanCreateFileSystem (_In_ PDOKAN_OPTIONS DokanOptions, _In_ PDOKAN_OPERATIONS DokanOperations, _Out_ DOKAN_HANDLE *DokanInstance) |
| Mount a new Dokan Volume. | |
| BOOL | DokanIsFileSystemRunning (_In_ DOKAN_HANDLE DokanInstance) |
| Check if the FileSystem is still running or not. | |
| DWORD | DokanWaitForFileSystemClosed (_In_ DOKAN_HANDLE DokanInstance, _In_ DWORD dwMilliseconds) |
| Wait until the FileSystem is unmount. | |
| BOOL | DokanRegisterWaitForFileSystemClosed (_In_ DOKAN_HANDLE DokanInstance, _Out_ PHANDLE WaitHandle, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Context, ULONG dwMilliseconds) |
| Register callback for FileSystem unmount. | |
| BOOL | DokanUnregisterWaitForFileSystemClosed (_In_ HANDLE WaitHandle, BOOL WaitForCallbacks) |
| Unregister callback for FileSystem unmount. | |
| VOID | DokanCloseHandle (_In_ DOKAN_HANDLE DokanInstance) |
| Unmount the Dokan instance. | |
| BOOL | DokanUnmount (WCHAR DriveLetter) |
| Unmount a Dokan device from a driver letter. | |
| BOOL | DokanRemoveMountPoint (LPCWSTR MountPoint) |
| Unmount a Dokan device from a mount point. | |
| BOOL | DokanIsNameInExpression (LPCWSTR Expression, LPCWSTR Name, BOOL IgnoreCase) |
| Checks whether Name matches Expression. | |
| ULONG | DokanVersion () |
| Get the version of Dokan. The returned ULONG is the version number without the dots. | |
| ULONG | DokanDriverVersion () |
| Get the version of the Dokan driver. The returned ULONG is the version number without the dots. | |
| BOOL | DokanResetTimeout (ULONG Timeout, PDOKAN_FILE_INFO DokanFileInfo) |
| Extends the timeout of the current IO operation in driver. | |
| HANDLE | DokanOpenRequestorToken (PDOKAN_FILE_INFO DokanFileInfo) |
| Get the handle to Access Token. | |
| PDOKAN_MOUNT_POINT_INFO | DokanGetMountPointList (BOOL uncOnly, PULONG nbRead) |
| Get active Dokan mount points. | |
| VOID | DokanReleaseMountPointList (PDOKAN_MOUNT_POINT_INFO list) |
| Release Mount point list resources from DokanGetMountPointList. | |
| VOID | DokanMapKernelToUserCreateFileFlags (ACCESS_MASK DesiredAccess, ULONG FileAttributes, ULONG CreateOptions, ULONG CreateDisposition, ACCESS_MASK *outDesiredAccess, DWORD *outFileAttributesAndFlags, DWORD *outCreationDisposition) |
| Convert DOKAN_OPERATIONS::ZwCreateFile parameters to CreateFile parameters. | |
| NTSTATUS | DokanNtStatusFromWin32 (DWORD Error) |
| Convert WIN32 error to NTSTATUS. | |
Dokan Library const and methods.
| #define DOKAN_DRIVER_NAME L"dokan" DOKAN_MAJOR_API_VERSION L".sys" |
Driver file name including the DOKAN_MAJOR_API_VERSION
| #define DOKAN_MINIMUM_COMPATIBLE_VERSION 300 |
Minimum Dokan version (ver 3.0.0) accepted.
| #define DOKAN_NP_NAME L"Dokan" DOKAN_MAJOR_API_VERSION |
Network provider name including the DOKAN_MAJOR_API_VERSION
| #define DOKAN_VERSION 300 |
The current Dokan version (300 means ver 3.0.0). DOKAN_OPTIONS::Version
| VOID DokanCloseHandle | ( | _In_ DOKAN_HANDLE | DokanInstance | ) |
Unmount the Dokan instance.
Unmount and wait until all resources of the DokanInstance are released.
| DokanInstance | The dokan mount context created by DokanCreateFileSystem . |
| int DokanCreateFileSystem | ( | _In_ PDOKAN_OPTIONS | DokanOptions, |
| _In_ PDOKAN_OPERATIONS | DokanOperations, | ||
| _Out_ DOKAN_HANDLE * | DokanInstance ) |
Mount a new Dokan Volume.
It is mandatory to have called DokanInit previously to use this API.
This function returns directly on device mount or on failure. See DokanMainResult for possible errors.
DokanWaitForFileSystemClosed can be used to wait until the device is unmount.
| DokanOptions | a DOKAN_OPTIONS that describe the mount. |
| DokanOperations | Instance of DOKAN_OPERATIONS that will be called for each request made by the kernel. |
| DokanInstance | Dokan mount instance context that can be used for related instance calls like DokanIsFileSystemRunning . |
| ULONG DokanDriverVersion | ( | ) |
Get the version of the Dokan driver. The returned ULONG is the version number without the dots.
| PDOKAN_MOUNT_POINT_INFO DokanGetMountPointList | ( | BOOL | uncOnly, |
| PULONG | nbRead ) |
Get active Dokan mount points.
Returned array need to be released by calling DokanReleaseMountPointList
| uncOnly | Get only instances that have UNC Name. |
| nbRead | Number of instances successfully retrieved. |
| VOID DokanInit | ( | ) |
Initialize all required Dokan internal resources.
This needs to be called only once before trying to use DokanMain or DokanCreateFileSystem for the first time. Otherwise both will fail and raise an exception.
| BOOL DokanIsFileSystemRunning | ( | _In_ DOKAN_HANDLE | DokanInstance | ) |
Check if the FileSystem is still running or not.
| DokanInstance | The dokan mount context created by DokanCreateFileSystem . |
| BOOL DokanIsNameInExpression | ( | LPCWSTR | Expression, |
| LPCWSTR | Name, | ||
| BOOL | IgnoreCase ) |
Checks whether Name matches Expression.
Behave like FsRtlIsNameInExpression routine from Microsoft
* (asterisk) Matches zero or more characters.
? (question mark) Matches a single character.
DOS_DOT (" quotation mark) Matches either a period or zero characters beyond the name string.
DOS_QM (> greater than) Matches any single character or, upon encountering a period or end of name string, advances the expression to the end of the set of contiguous DOS_QMs.
DOS_STAR (< less than) Matches zero or more characters until encountering and matching the final . in the name.
| Expression | Expression can contain any of the above characters. |
| Name | Name to check |
| IgnoreCase | Case sensitive or not |
| int DokanMain | ( | PDOKAN_OPTIONS | DokanOptions, |
| PDOKAN_OPERATIONS | DokanOperations ) |
Mount a new Dokan Volume.
This function block until the device is unmounted. If the mount fails, it will directly return a DokanMainResult error.
See DokanCreateFileSystem to create mount Dokan Volume asynchronously.
| DokanOptions | a DOKAN_OPTIONS that describe the mount. |
| DokanOperations | Instance of DOKAN_OPERATIONS that will be called for each request made by the kernel. |
| VOID DokanMapKernelToUserCreateFileFlags | ( | ACCESS_MASK | DesiredAccess, |
| ULONG | FileAttributes, | ||
| ULONG | CreateOptions, | ||
| ULONG | CreateDisposition, | ||
| ACCESS_MASK * | outDesiredAccess, | ||
| DWORD * | outFileAttributesAndFlags, | ||
| DWORD * | outCreationDisposition ) |
Convert DOKAN_OPERATIONS::ZwCreateFile parameters to CreateFile parameters.
Dokan Kernel forward the DesiredAccess directly from the IRP_MJ_CREATE. This DesiredAccess has been converted from generic rights (user CreateFile request) to standard rights and will be converted back here. https://msdn.microsoft.com/windows/hardware/drivers/ifs/access-mask
| DesiredAccess | DesiredAccess from DOKAN_OPERATIONS::ZwCreateFile. |
| FileAttributes | FileAttributes from DOKAN_OPERATIONS::ZwCreateFile. |
| CreateOptions | CreateOptions from DOKAN_OPERATIONS::ZwCreateFile. |
| CreateDisposition | CreateDisposition from DOKAN_OPERATIONS::ZwCreateFile. |
| outDesiredAccess | New CreateFile dwDesiredAccess. |
| outFileAttributesAndFlags | New CreateFile dwFlagsAndAttributes. |
| outCreationDisposition | New CreateFile dwCreationDisposition. |
| NTSTATUS DokanNtStatusFromWin32 | ( | DWORD | Error | ) |
Convert WIN32 error to NTSTATUS.
https://support.microsoft.com/en-us/kb/113996
| Error | Win32 Error to convert |
| HANDLE DokanOpenRequestorToken | ( | PDOKAN_FILE_INFO | DokanFileInfo | ) |
Get the handle to Access Token.
This method needs be called in DOKAN_OPERATIONS::ZwCreateFile callback. The caller must call CloseHandle for the returned handle.
| DokanFileInfo | DOKAN_FILE_INFO of the operation to extend. |
| BOOL DokanRegisterWaitForFileSystemClosed | ( | _In_ DOKAN_HANDLE | DokanInstance, |
| _Out_ PHANDLE | WaitHandle, | ||
| _In_ WAITORTIMERCALLBACKFUNC | Callback, | ||
| _In_ PVOID | Context, | ||
| ULONG | dwMilliseconds ) |
Register callback for FileSystem unmount.
| DokanInstance | The dokan mount context created by DokanCreateFileSystem . |
| WaitHandle | Handle to wait handle registration. This handle needs to be closed by calling UnregisterWait, UnregisterWaitEx or DokanUnregisterWaitForFileSystemClosed to unregister the callback . |
| Callback | Callback function to be called from a worker thread when file system is unmounted . |
| Context | A context parameter to send to callback function . |
| dwMilliseconds | The time-out interval, in milliseconds. See RegisterWaitForSingleObject. |
| VOID DokanReleaseMountPointList | ( | PDOKAN_MOUNT_POINT_INFO | list | ) |
Release Mount point list resources from DokanGetMountPointList.
After DokanGetMountPointList call you will receive a dynamically allocated array of DOKAN_MOUNT_POINT_INFO. This array needs to be released when no longer needed by calling this function.
| list | Allocated array of DOKAN_MOUNT_POINT_INFO from DokanGetMountPointList. |
| BOOL DokanRemoveMountPoint | ( | LPCWSTR | MountPoint | ) |
Unmount a Dokan device from a mount point.
| MountPoint | Mount point to unmount ("Z", "Z:", "Z:\", "Z:\MyMountPoint"). |
TRUE if device was unmounted or FALSE in case of failure or device not found. | BOOL DokanResetTimeout | ( | ULONG | Timeout, |
| PDOKAN_FILE_INFO | DokanFileInfo ) |
Extends the timeout of the current IO operation in driver.
| Timeout | Extended time in milliseconds requested. |
| DokanFileInfo | DOKAN_FILE_INFO of the operation to extend. |
| VOID DokanShutdown | ( | ) |
Release all allocated resources by DokanInit when they are no longer needed.
This should be called when the application no longer expects to create a new FileSystem with DokanMain or DokanCreateFileSystem and after all devices are unmount.
| BOOL DokanUnmount | ( | WCHAR | DriveLetter | ) |
Unmount a Dokan device from a driver letter.
| DriveLetter | Dokan driver letter to unmount. |
TRUE if device was unmounted or FALSE in case of failure or device not found. | BOOL DokanUnregisterWaitForFileSystemClosed | ( | _In_ HANDLE | WaitHandle, |
| BOOL | WaitForCallbacks ) |
Unregister callback for FileSystem unmount.
| WaitHandle | Handle returned as WaitHandle parameter in previous call to DokanRegisterWaitForFileSystemClosed . |
| WaitForCallbacks | Indicates whether to wait for callbacks to complete before returning. Normally set to TRUE unless called from same thread as callback function. |
| ULONG DokanVersion | ( | ) |
Get the version of Dokan. The returned ULONG is the version number without the dots.
| DWORD DokanWaitForFileSystemClosed | ( | _In_ DOKAN_HANDLE | DokanInstance, |
| _In_ DWORD | dwMilliseconds ) |
Wait until the FileSystem is unmount.
| DokanInstance | The dokan mount context created by DokanCreateFileSystem . |
| dwMilliseconds | The time-out interval, in milliseconds. See WaitForSingleObject. |