27 #define WIN32_NO_STATUS 29 #undef WIN32_NO_STATUS 37 #define DOKANAPI __stdcall 40 #define DOKANAPI __declspec(dllimport) __stdcall 44 #define DOKAN_CALLBACK __stdcall 59 #define DOKAN_VERSION 230 61 #define DOKAN_MINIMUM_COMPATIBLE_VERSION 200 63 #define DOKAN_DRIVER_NAME L"dokan" DOKAN_MAJOR_API_VERSION L".sys" 65 #define DOKAN_NP_NAME L"Dokan" DOKAN_MAJOR_API_VERSION 77 #define DOKAN_OPTION_DEBUG 1 79 #define DOKAN_OPTION_STDERR (1 << 1) 85 #define DOKAN_OPTION_ALT_STREAM (1 << 2) 87 #define DOKAN_OPTION_WRITE_PROTECT (1 << 3) 89 #define DOKAN_OPTION_NETWORK (1 << 4) 96 #define DOKAN_OPTION_REMOVABLE (1 << 5) 104 #define DOKAN_OPTION_MOUNT_MANAGER (1 << 6) 111 #define DOKAN_OPTION_CURRENT_SESSION (1 << 7) 113 #define DOKAN_OPTION_FILELOCK_USER_MODE (1 << 8) 120 #define DOKAN_OPTION_CASE_SENSITIVE (1 << 9) 122 #define DOKAN_OPTION_ENABLE_UNMOUNT_NETWORK_DRIVE (1 << 10) 127 #define DOKAN_OPTION_DISPATCH_DRIVER_LOGS (1 << 11) 133 #define DOKAN_OPTION_ALLOW_IPC_BATCHING (1 << 12) 137 typedef VOID *DOKAN_HANDLE, **PDOKAN_HANDLE;
144 typedef struct _DOKAN_OPTIONS {
174 CHAR VolumeSecurityDescriptor[VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE];
181 typedef struct _DOKAN_FILE_INFO {
225 #define DOKAN_EXCEPTION_NOT_INITIALIZED 0x0f0ff0ff 226 #define DOKAN_EXCEPTION_INITIALIZATION_FAILED 0x0fbadbad 227 #define DOKAN_EXCEPTION_SHUTDOWN_FAILED 0x0fbadf00 257 typedef struct _DOKAN_OPERATIONS {
290 PDOKAN_IO_SECURITY_CONTEXT SecurityContext,
291 ACCESS_MASK DesiredAccess,
292 ULONG FileAttributes,
294 ULONG CreateDisposition,
296 PDOKAN_FILE_INFO DokanFileInfo);
314 PDOKAN_FILE_INFO DokanFileInfo);
328 PDOKAN_FILE_INFO DokanFileInfo);
354 PDOKAN_FILE_INFO DokanFileInfo);
379 DWORD NumberOfBytesToWrite,
380 LPDWORD NumberOfBytesWritten,
382 PDOKAN_FILE_INFO DokanFileInfo);
394 PDOKAN_FILE_INFO DokanFileInfo);
407 LPBY_HANDLE_FILE_INFORMATION Buffer,
408 PDOKAN_FILE_INFO DokanFileInfo);
426 PDOKAN_FILE_INFO DokanFileInfo);
448 LPCWSTR SearchPattern,
450 PDOKAN_FILE_INFO DokanFileInfo);
463 DWORD FileAttributes,
464 PDOKAN_FILE_INFO DokanFileInfo);
479 CONST FILETIME *CreationTime,
480 CONST FILETIME *LastAccessTime,
481 CONST FILETIME *LastWriteTime,
482 PDOKAN_FILE_INFO DokanFileInfo);
509 PDOKAN_FILE_INFO DokanFileInfo);
537 PDOKAN_FILE_INFO DokanFileInfo);
552 BOOL ReplaceIfExisting,
553 PDOKAN_FILE_INFO DokanFileInfo);
568 PDOKAN_FILE_INFO DokanFileInfo);
583 PDOKAN_FILE_INFO DokanFileInfo);
601 PDOKAN_FILE_INFO DokanFileInfo);
619 PDOKAN_FILE_INFO DokanFileInfo);
642 PULONGLONG TotalNumberOfBytes,
643 PULONGLONG TotalNumberOfFreeBytes,
644 PDOKAN_FILE_INFO DokanFileInfo);
681 DWORD VolumeNameSize,
682 LPDWORD VolumeSerialNumber,
683 LPDWORD MaximumComponentLength,
684 LPDWORD FileSystemFlags,
685 LPWSTR FileSystemNameBuffer,
686 DWORD FileSystemNameSize,
687 PDOKAN_FILE_INFO DokanFileInfo);
702 NTSTATUS(
DOKAN_CALLBACK *Mounted)(LPCWSTR MountPoint, PDOKAN_FILE_INFO DokanFileInfo);
735 PSECURITY_INFORMATION SecurityInformation,
736 PSECURITY_DESCRIPTOR SecurityDescriptor,
739 PDOKAN_FILE_INFO DokanFileInfo);
757 PSECURITY_INFORMATION SecurityInformation,
758 PSECURITY_DESCRIPTOR SecurityDescriptor,
760 PDOKAN_FILE_INFO DokanFileInfo);
777 PVOID FindStreamContext,
778 PDOKAN_FILE_INFO DokanFileInfo);
791 #define DOKAN_SUCCESS 0 793 #define DOKAN_ERROR -1 795 #define DOKAN_DRIVE_LETTER_ERROR -2 797 #define DOKAN_DRIVER_INSTALL_ERROR -3 799 #define DOKAN_START_ERROR -4 805 #define DOKAN_MOUNT_ERROR -5 810 #define DOKAN_MOUNT_POINT_ERROR -6 815 #define DOKAN_VERSION_ERROR -7 853 PDOKAN_OPERATIONS DokanOperations);
871 _In_ PDOKAN_OPERATIONS DokanOperations,
872 _Out_ DOKAN_HANDLE *DokanInstance);
890 _In_ DWORD dwMilliseconds);
903 _In_ DOKAN_HANDLE DokanInstance, _Out_ PHANDLE WaitHandle,
904 _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Context,
905 ULONG dwMilliseconds);
915 BOOL WaitForCallbacks);
1037 ACCESS_MASK DesiredAccess, ULONG FileAttributes, ULONG CreateOptions,
1038 ULONG CreateDisposition, ACCESS_MASK *outDesiredAccess,
1039 DWORD *outFileAttributesAndFlags, DWORD *outCreationDisposition);
1070 _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory);
1081 _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory);
1091 _In_ LPCWSTR FilePath);
1101 _In_ LPCWSTR FilePath);
1115 _In_ LPCWSTR OldPath, _In_ LPCWSTR NewPath,
1116 _In_ BOOL IsDirectory,
1117 _In_ BOOL IsInSameDirectory);
#define DOKAN_CALLBACK
Definition: dokan.h:44
HANDLE DokanOpenRequestorToken(PDOKAN_FILE_INFO DokanFileInfo)
Get the handle to Access Token.
Definition: access.c:26
PDOKAN_OPTIONS DokanOptions
Definition: dokan.h:191
BOOL DokanIsFileSystemRunning(_In_ DOKAN_HANDLE DokanInstance)
Check if the FileSystem is still running or not.
Definition: dokan.c:609
VOID DokanShutdown()
Release all allocated resources by DokanInit when they are no longer needed.
Definition: dokan.c:1422
USHORT Version
Definition: dokan.h:146
PDOKAN_MOUNT_POINT_INFO DokanGetMountPointList(BOOL uncOnly, PULONG nbRead)
Get active Dokan mount points.
Definition: dokan.c:1236
LPCWSTR MountPoint
Definition: dokan.h:154
BOOL DokanUnregisterWaitForFileSystemClosed(_In_ HANDLE WaitHandle, BOOL WaitForCallbacks)
Unregister callback for FileSystem unmount.
Definition: dokan.c:640
ULONG64 GlobalContext
Definition: dokan.h:152
ULONG ProcessId
Definition: dokan.h:201
BOOL DokanRemoveMountPoint(LPCWSTR MountPoint)
Unmount a Dokan device from a mount point.
Definition: mount.c:649
BOOL DokanResetTimeout(ULONG Timeout, PDOKAN_FILE_INFO DokanFileInfo)
Extends the timeout of the current IO operation in driver.
Definition: timeout.c:26
#define DOKANAPI
Definition: dokan.h:40
UCHAR Nocache
Definition: dokan.h:220
ULONG Timeout
Definition: dokan.h:166
VOID DokanReleaseMountPointList(PDOKAN_MOUNT_POINT_INFO list)
Release Mount point list resources from DokanGetMountPointList.
Definition: dokan.c:1284
UCHAR WriteToEndOfFile
Definition: dokan.h:222
BOOL DokanNotifyXAttrUpdate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath)
Notify dokan that file or directory extended attributes have changed.
Definition: dokan.c:1506
DWORD DokanWaitForFileSystemClosed(_In_ DOKAN_HANDLE DokanInstance, _In_ DWORD dwMilliseconds)
Wait until the FileSystem is unmount.
Definition: dokan.c:618
UCHAR SynchronousIo
Definition: dokan.h:218
BOOL DokanNotifyDelete(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory)
Notify dokan that a file or a directory has been deleted.
Definition: dokan.c:1492
NTSTATUS DokanNtStatusFromWin32(DWORD Error)
Convert WIN32 error to NTSTATUS.
Definition: ntstatus.c:25
LPCWSTR UNCName
Definition: dokan.h:159
BOOL DokanRegisterWaitForFileSystemClosed(_In_ DOKAN_HANDLE DokanInstance, _Out_ PHANDLE WaitHandle, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Context, ULONG dwMilliseconds)
Register callback for FileSystem unmount.
Definition: dokan.c:627
Dokan mount options used to describe Dokan device behavior.
Definition: dokan.h:144
BOOL DokanNotifyCreate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory)
Notify dokan that a file or a directory has been created.
Definition: dokan.c:1484
int(WINAPI * PFillFindData)(PWIN32_FIND_DATAW, PDOKAN_FILE_INFO)
FillFindData Used to add an entry in FindFiles operation.
Definition: dokan.h:233
BOOL(WINAPI * PFillFindStreamData)(PWIN32_FIND_STREAM_DATA, PVOID)
FillFindStreamData Used to add an entry in FindStreams.
Definition: dokan.h:239
int DokanCreateFileSystem(_In_ PDOKAN_OPTIONS DokanOptions, _In_ PDOKAN_OPERATIONS DokanOperations, _Out_ DOKAN_HANDLE *DokanInstance)
Mount a new Dokan Volume.
Definition: dokan.c:674
ULONG DokanVersion()
Get the version of Dokan. The returned ULONG is the version number without the dots.
Definition: version.c:26
Dokan file information on the current operation.
Definition: dokan.h:181
ULONG SectorSize
Definition: dokan.h:170
BOOLEAN SingleThread
Definition: dokan.h:148
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.
Definition: dokan.c:1305
ULONG DokanDriverVersion()
Get the version of the Dokan driver. The returned ULONG is the version number without the dots...
Definition: version.c:28
ULONG64 Context
Definition: dokan.h:187
UCHAR PagingIo
Definition: dokan.h:216
UCHAR IsDirectory
Definition: dokan.h:206
BOOL DokanIsNameInExpression(LPCWSTR Expression, LPCWSTR Name, BOOL IgnoreCase)
Checks whether Name matches Expression.
Definition: directory.c:748
VOID DokanCloseHandle(_In_ DOKAN_HANDLE DokanInstance)
Unmount the Dokan instance.
Definition: dokan.c:646
ULONG AllocationUnitSize
Definition: dokan.h:168
BOOL DokanNotifyUpdate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath)
Notify dokan that file or directory attributes have changed.
Definition: dokan.c:1500
UCHAR DeletePending
Definition: dokan.h:214
BOOL DokanUnmount(WCHAR DriveLetter)
Unmount a Dokan device from a driver letter.
Definition: mount.c:296
int DokanMain(PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations)
Mount a new Dokan Volume.
Definition: dokan.c:660
Dokan API callbacks interface.
Definition: dokan.h:257
ULONG64 DokanContext
Definition: dokan.h:189
VOID DokanInit()
Initialize all required Dokan internal resources.
Definition: dokan.c:1397
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 fi...
Definition: dokan.c:1512
ULONG VolumeSecurityDescriptorLength
Definition: dokan.h:172
PVOID ProcessingContext
Definition: dokan.h:197
ULONG Options
Definition: dokan.h:150