Dokan Library const and methods. More...
Modules | |
Dokan Notify | |
Dokan User FS file-change notification. | |
Macros | |
#define | DOKAN_VERSION 220 |
#define | DOKAN_MINIMUM_COMPATIBLE_VERSION 200 |
#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. More... | |
VOID | DokanShutdown () |
Release all allocated resources by DokanInit when they are no longer needed. More... | |
int | DokanMain (PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations) |
Mount a new Dokan Volume. More... | |
int | DokanCreateFileSystem (_In_ PDOKAN_OPTIONS DokanOptions, _In_ PDOKAN_OPERATIONS DokanOperations, _Out_ DOKAN_HANDLE *DokanInstance) |
Mount a new Dokan Volume. More... | |
BOOL | DokanIsFileSystemRunning (_In_ DOKAN_HANDLE DokanInstance) |
Check if the FileSystem is still running or not. More... | |
DWORD | DokanWaitForFileSystemClosed (_In_ DOKAN_HANDLE DokanInstance, _In_ DWORD dwMilliseconds) |
Wait until the FileSystem is unmount. More... | |
BOOL | DokanRegisterWaitForFileSystemClosed (_In_ DOKAN_HANDLE DokanInstance, _Out_ PHANDLE WaitHandle, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Context, ULONG dwMilliseconds) |
Register callback for FileSystem unmount. More... | |
BOOL | DokanUnregisterWaitForFileSystemClosed (_In_ HANDLE WaitHandle, BOOL WaitForCallbacks) |
Unregister callback for FileSystem unmount. More... | |
VOID | DokanCloseHandle (_In_ DOKAN_HANDLE DokanInstance) |
Unmount the Dokan instance. More... | |
BOOL | DokanUnmount (WCHAR DriveLetter) |
Unmount a Dokan device from a driver letter. More... | |
BOOL | DokanRemoveMountPoint (LPCWSTR MountPoint) |
Unmount a Dokan device from a mount point. More... | |
BOOL | DokanIsNameInExpression (LPCWSTR Expression, LPCWSTR Name, BOOL IgnoreCase) |
Checks whether Name matches Expression. More... | |
ULONG | DokanVersion () |
Get the version of Dokan. The returned ULONG is the version number without the dots. More... | |
ULONG | DokanDriverVersion () |
Get the version of the Dokan driver. The returned ULONG is the version number without the dots. More... | |
BOOL | DokanResetTimeout (ULONG Timeout, PDOKAN_FILE_INFO DokanFileInfo) |
Extends the timeout of the current IO operation in driver. More... | |
HANDLE | DokanOpenRequestorToken (PDOKAN_FILE_INFO DokanFileInfo) |
Get the handle to Access Token. More... | |
PDOKAN_MOUNT_POINT_INFO | DokanGetMountPointList (BOOL uncOnly, PULONG nbRead) |
Get active Dokan mount points. More... | |
VOID | DokanReleaseMountPointList (PDOKAN_MOUNT_POINT_INFO list) |
Release Mount point list resources from DokanGetMountPointList. More... | |
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. More... | |
NTSTATUS | DokanNtStatusFromWin32 (DWORD Error) |
Convert WIN32 error to NTSTATUS. More... | |
Detailed Description
Dokan Library const and methods.
Macro Definition Documentation
#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 200 |
Minimum Dokan version (ver 2.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 220 |
The current Dokan version (200 means ver 2.0.0). DOKAN_OPTIONS::Version
Function Documentation
VOID DokanCloseHandle | ( | _In_ DOKAN_HANDLE | DokanInstance | ) |
Unmount the Dokan instance.
Unmount and wait until all resources of the DokanInstance
are released.
- Parameters
-
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.
- Parameters
-
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 .
- Returns
- DokanMainResult status.
ULONG DokanDriverVersion | ( | ) |
Get the version of the Dokan driver. The returned ULONG is the version number without the dots.
- Returns
- The version of Dokan driver or 0 on failure.
PDOKAN_MOUNT_POINT_INFO DokanGetMountPointList | ( | BOOL | uncOnly, |
PULONG | nbRead | ||
) |
Get active Dokan mount points.
Returned array need to be released by calling DokanReleaseMountPointList
- Parameters
-
uncOnly Get only instances that have UNC Name. nbRead Number of instances successfully retrieved.
- Returns
- Allocate array of DOKAN_MOUNT_POINT_INFO.
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.
- Parameters
-
DokanInstance The dokan mount context created by DokanCreateFileSystem .
- Returns
- Whether the FileSystem is still running or not.
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.
- Parameters
-
Expression Expression can contain any of the above characters. Name Name to check IgnoreCase Case sensitive or not
- Returns
- result if name matches the expression
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.
- Parameters
-
DokanOptions a DOKAN_OPTIONS that describe the mount. DokanOperations Instance of DOKAN_OPERATIONS that will be called for each request made by the kernel.
- Returns
- DokanMainResult status.
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
- Parameters
-
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.
- See also
- CreateFile function (MSDN)
NTSTATUS DokanNtStatusFromWin32 | ( | DWORD | Error | ) |
Convert WIN32 error to NTSTATUS.
https://support.microsoft.com/en-us/kb/113996
- Parameters
-
Error Win32 Error to convert
- Returns
- NTSTATUS associate to the ERROR.
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.
- Parameters
-
DokanFileInfo DOKAN_FILE_INFO of the operation to extend.
- Returns
- A handle to the account token for the user on whose behalf the code is running.
BOOL DokanRegisterWaitForFileSystemClosed | ( | _In_ DOKAN_HANDLE | DokanInstance, |
_Out_ PHANDLE | WaitHandle, | ||
_In_ WAITORTIMERCALLBACKFUNC | Callback, | ||
_In_ PVOID | Context, | ||
ULONG | dwMilliseconds | ||
) |
Register callback for FileSystem unmount.
- Parameters
-
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.
- Returns
- TRUE if successful, FALSE otherwise.
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.
- Parameters
-
list Allocated array of DOKAN_MOUNT_POINT_INFO from DokanGetMountPointList.
- Returns
- Nothing.
BOOL DokanRemoveMountPoint | ( | LPCWSTR | MountPoint | ) |
Unmount a Dokan device from a mount point.
- Parameters
-
MountPoint Mount point to unmount ("Z", "Z:", "Z:\", "Z:\MyMountPoint").
- Returns
TRUE
if device was unmounted orFALSE
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.
- Parameters
-
Timeout Extended time in milliseconds requested. DokanFileInfo DOKAN_FILE_INFO of the operation to extend.
- Returns
- If the operation was successful.
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.
- Parameters
-
DriveLetter Dokan driver letter to unmount.
- Returns
TRUE
if device was unmounted orFALSE
in case of failure or device not found.
BOOL DokanUnregisterWaitForFileSystemClosed | ( | _In_ HANDLE | WaitHandle, |
BOOL | WaitForCallbacks | ||
) |
Unregister callback for FileSystem unmount.
- Parameters
-
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.
- Returns
- TRUE if successful, FALSE otherwise.
ULONG DokanVersion | ( | ) |
Get the version of Dokan. The returned ULONG is the version number without the dots.
- Returns
- The version of Dokan
DWORD DokanWaitForFileSystemClosed | ( | _In_ DOKAN_HANDLE | DokanInstance, |
_In_ DWORD | dwMilliseconds | ||
) |
Wait until the FileSystem is unmount.
- Parameters
-
DokanInstance The dokan mount context created by DokanCreateFileSystem . dwMilliseconds The time-out interval, in milliseconds. See WaitForSingleObject.
- Returns
- See WaitForSingleObject for a description of return values.