dokan.h File Reference
#include <windows.h>
#include <ntstatus.h>
#include "fileinfo.h"
#include "public.h"

Go to the source code of this file.

Data Structures

struct  PDOKAN_OPTIONS
 Dokan mount options used to describe Dokan device behavior. More...
 
struct  PDOKAN_FILE_INFO
 Dokan file information on the current operation. More...
 
struct  PDOKAN_OPERATIONS
 Dokan API callbacks interface. More...
 

Macros

#define WIN32_NO_STATUS
 
#define DOKANAPI   __declspec(dllimport) __stdcall
 
#define DOKAN_CALLBACK   __stdcall
 
#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
 
#define DOKAN_OPTION_DEBUG   1
 
#define DOKAN_OPTION_STDERR   (1 << 1)
 
#define DOKAN_OPTION_ALT_STREAM   (1 << 2)
 
#define DOKAN_OPTION_WRITE_PROTECT   (1 << 3)
 
#define DOKAN_OPTION_NETWORK   (1 << 4)
 
#define DOKAN_OPTION_REMOVABLE   (1 << 5)
 
#define DOKAN_OPTION_MOUNT_MANAGER   (1 << 6)
 
#define DOKAN_OPTION_CURRENT_SESSION   (1 << 7)
 
#define DOKAN_OPTION_FILELOCK_USER_MODE   (1 << 8)
 
#define DOKAN_OPTION_CASE_SENSITIVE   (1 << 9)
 
#define DOKAN_OPTION_ENABLE_UNMOUNT_NETWORK_DRIVE   (1 << 10)
 
#define DOKAN_OPTION_DISPATCH_DRIVER_LOGS   (1 << 11)
 
#define DOKAN_OPTION_ALLOW_IPC_BATCHING   (1 << 12)
 
#define DOKAN_EXCEPTION_NOT_INITIALIZED   0x0f0ff0ff
 
#define DOKAN_EXCEPTION_INITIALIZATION_FAILED   0x0fbadbad
 
#define DOKAN_EXCEPTION_SHUTDOWN_FAILED   0x0fbadf00
 
#define DOKAN_SUCCESS   0
 
#define DOKAN_ERROR   -1
 
#define DOKAN_DRIVE_LETTER_ERROR   -2
 
#define DOKAN_DRIVER_INSTALL_ERROR   -3
 
#define DOKAN_START_ERROR   -4
 
#define DOKAN_MOUNT_ERROR   -5
 
#define DOKAN_MOUNT_POINT_ERROR   -6
 
#define DOKAN_VERSION_ERROR   -7
 

Typedefs

typedef VOID * DOKAN_HANDLE
 
typedef VOID ** PDOKAN_HANDLE
 
typedef int(WINAPI * PFillFindData) (PWIN32_FIND_DATAW, PDOKAN_FILE_INFO)
 FillFindData Used to add an entry in FindFiles operation. More...
 
typedef BOOL(WINAPI * PFillFindStreamData) (PWIN32_FIND_STREAM_DATA, PVOID)
 FillFindStreamData Used to add an entry in FindStreams. More...
 

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...
 
BOOL DokanNotifyCreate (_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory)
 Notify dokan that a file or a directory has been created. More...
 
BOOL DokanNotifyDelete (_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory)
 Notify dokan that a file or a directory has been deleted. More...
 
BOOL DokanNotifyUpdate (_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath)
 Notify dokan that file or directory attributes have changed. More...
 
BOOL DokanNotifyXAttrUpdate (_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath)
 Notify dokan that file or directory extended attributes have changed. More...
 
BOOL DokanNotifyRename (_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR OldPath, _In_ LPCWSTR NewPath, _In_ BOOL IsDirectory, _In_ BOOL IsInSameDirectory)
 Notify dokan that a file or a directory has been renamed. This method supports in-place rename for file/directory within the same parent. More...
 
NTSTATUS DokanNtStatusFromWin32 (DWORD Error)
 Convert WIN32 error to NTSTATUS. More...
 

Macro Definition Documentation

#define DOKAN_CALLBACK   __stdcall

Change calling convention to standard call

#define DOKANAPI   __declspec(dllimport) __stdcall

Import dokan API

#define WIN32_NO_STATUS

Do not include NTSTATUS. Fix duplicate preprocessor definitions

Typedef Documentation

typedef int(WINAPI * PFillFindData) (PWIN32_FIND_DATAW, PDOKAN_FILE_INFO)

FillFindData Used to add an entry in FindFiles operation.

Returns
1 if buffer is full, otherwise 0 (currently it never returns 1)
typedef BOOL(WINAPI * PFillFindStreamData) (PWIN32_FIND_STREAM_DATA, PVOID)

FillFindStreamData Used to add an entry in FindStreams.

Returns
FALSE if the buffer is full, otherwise TRUE