/* Dokan : user-mode file system library for Windows Copyright (C) 2020 - 2025 Google, Inc. Copyright (C) 2015 - 2019 Adrien J. and Maxime C. Copyright (C) 2007 - 2011 Hiroki Asakawa http://dokan-dev.github.io This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef DOKAN_H_ #define DOKAN_H_ /** Do not include NTSTATUS. Fix duplicate preprocessor definitions */ #define WIN32_NO_STATUS #include #undef WIN32_NO_STATUS #include /** \cond */ #ifndef _In_ #define _In_ #endif #ifndef _In_opt_ #define _In_opt_ #endif #ifndef _Out_ #define _Out_ #endif #ifndef _Out_opt_ #define _Out_opt_ #endif #ifndef _Inout_ #define _Inout_ #endif #ifndef _Inout_opt_ #define _Inout_opt_ #endif /** \endcond */ #ifdef _EXPORTING /** Export dokan API see also dokan.def for export */ #define DOKANAPI __stdcall #else /** Import dokan API */ #define DOKANAPI __declspec(dllimport) __stdcall #endif /** Change calling convention to standard call */ #define DOKAN_CALLBACK __stdcall #ifdef __cplusplus extern "C" { #endif /** @file */ /** * \defgroup Dokan Dokan * \brief Dokan Library const and methods */ /** @{ */ #ifndef DOKAN_MAJOR_API_VERSION /** Major API version string used to construct driver and service names. */ #define DOKAN_MAJOR_API_VERSION L"3" #endif /** The current Dokan version (300 means ver 3.0.0). \ref DOKAN_OPTIONS.Version */ #define DOKAN_VERSION 300 /** Minimum Dokan version (ver 3.0.0) accepted. */ #define DOKAN_MINIMUM_COMPATIBLE_VERSION 300 /** Driver file name including the DOKAN_MAJOR_API_VERSION */ #define DOKAN_DRIVER_NAME L"dokan" DOKAN_MAJOR_API_VERSION L".sys" /** Network provider name including the DOKAN_MAJOR_API_VERSION */ #define DOKAN_NP_NAME L"Dokan" DOKAN_MAJOR_API_VERSION #ifndef VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE /** Maximum size in bytes of \ref DOKAN_OPTIONS.VolumeSecurityDescriptor. */ #define VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE (1024 * 16) #endif /** @} */ /** * \defgroup DOKAN_NT_CONSTANTS NT File Operation Constants * \brief Public NT create, disposition, rename, and wildcard constants used * with \ref DOKAN_OPERATIONS callbacks and \ref DokanIsNameInExpression. * * Each constant is guarded with \c \#ifndef and uses the exact literal value * from the Windows SDK and WDK headers so \c can be included * before or after \c without macro redefinition warnings. */ /** @{ */ #ifndef FILE_SUPERSEDE /** Create disposition: replace existing file or create a new file. */ #define FILE_SUPERSEDE 0x00000000 #endif #ifndef FILE_OPEN /** Create disposition: open existing file; fail if it does not exist. */ #define FILE_OPEN 0x00000001 #endif #ifndef FILE_CREATE /** Create disposition: create a new file; fail if it already exists. */ #define FILE_CREATE 0x00000002 #endif #ifndef FILE_OPEN_IF /** Create disposition: open existing file or create a new file. */ #define FILE_OPEN_IF 0x00000003 #endif #ifndef FILE_OVERWRITE /** Create disposition: open and overwrite existing file; fail if absent. */ #define FILE_OVERWRITE 0x00000004 #endif #ifndef FILE_OVERWRITE_IF /** Create disposition: overwrite existing file or create a new file. */ #define FILE_OVERWRITE_IF 0x00000005 #endif #ifndef FILE_MAXIMUM_DISPOSITION /** Maximum valid NT create disposition value. */ #define FILE_MAXIMUM_DISPOSITION 0x00000005 #endif #ifndef FILE_DIRECTORY_FILE /** Create option: target must be a directory. */ #define FILE_DIRECTORY_FILE 0x00000001 #endif #ifndef FILE_WRITE_THROUGH /** Create option: write directly through any intermediate cache. */ #define FILE_WRITE_THROUGH 0x00000002 #endif #ifndef FILE_SEQUENTIAL_ONLY /** Create option: file access will be sequential. */ #define FILE_SEQUENTIAL_ONLY 0x00000004 #endif #ifndef FILE_NO_INTERMEDIATE_BUFFERING /** Create option: bypass system file cache for reads and writes. */ #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 #endif #ifndef FILE_SYNCHRONOUS_IO_ALERT /** Create option: synchronous I/O with alertable waits. */ #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 #endif #ifndef FILE_SYNCHRONOUS_IO_NONALERT /** Create option: synchronous I/O with non-alertable waits. */ #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 #endif #ifndef FILE_NON_DIRECTORY_FILE /** Create option: target must not be a directory. */ #define FILE_NON_DIRECTORY_FILE 0x00000040 #endif #ifndef FILE_NO_EA_KNOWLEDGE /** Create option: caller does not understand extended attributes. */ #define FILE_NO_EA_KNOWLEDGE 0x00000200 #endif #ifndef FILE_RANDOM_ACCESS /** Create option: file access will be random. */ #define FILE_RANDOM_ACCESS 0x00000800 #endif #ifndef FILE_DELETE_ON_CLOSE /** Create option: delete the file when the last handle closes. */ #define FILE_DELETE_ON_CLOSE 0x00001000 #endif #ifndef FILE_OPEN_BY_FILE_ID /** Create option: FileName contains a file ID rather than a path. */ #define FILE_OPEN_BY_FILE_ID 0x00002000 #endif #ifndef FILE_OPEN_FOR_BACKUP_INTENT /** Create option: open for backup or restore semantics. */ #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 #endif #ifndef FILE_OPEN_REPARSE_POINT /** Create option: open a reparse point directly without normal reparse processing. */ #define FILE_OPEN_REPARSE_POINT 0x00200000 #endif #ifndef FILE_DISPOSITION_DO_NOT_DELETE /** Disposition flag: clear delete-on-close disposition. */ #define FILE_DISPOSITION_DO_NOT_DELETE 0x00000000 #endif #ifndef FILE_DISPOSITION_DELETE /** Disposition flag: mark file or directory for deletion. */ #define FILE_DISPOSITION_DELETE 0x00000001 #endif #ifndef FILE_DISPOSITION_POSIX_SEMANTICS /** Disposition flag: request POSIX unlink semantics on delete. */ #define FILE_DISPOSITION_POSIX_SEMANTICS 0x00000002 #endif #ifndef FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK /** Disposition flag: force an image section check before deletion. */ #define FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK 0x00000004 #endif #ifndef FILE_DISPOSITION_ON_CLOSE /** Disposition flag: modify the per-handle delete-on-close state. */ #define FILE_DISPOSITION_ON_CLOSE 0x00000008 #endif #ifndef FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE /** Disposition flag: allow deletion even when FILE_ATTRIBUTE_READONLY is set. */ #define FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE 0x00000010 #endif #ifndef FILE_RENAME_REPLACE_IF_EXISTS /** Rename flag: replace target if it already exists. */ #define FILE_RENAME_REPLACE_IF_EXISTS 0x00000001 #endif #ifndef FILE_RENAME_POSIX_SEMANTICS /** Rename flag: request POSIX replacement semantics on rename. */ #define FILE_RENAME_POSIX_SEMANTICS 0x00000002 #endif #ifndef FILE_RENAME_IGNORE_READONLY_ATTRIBUTE /** Rename flag: allow replacing a target with FILE_ATTRIBUTE_READONLY set. */ #define FILE_RENAME_IGNORE_READONLY_ATTRIBUTE 0x00000040 #endif #ifndef DOS_STAR /** DOS wildcard: matches zero or more characters without consuming the last '.'. */ #define DOS_STAR (L'<') #endif #ifndef DOS_QM /** DOS wildcard: matches one non-'.' character, or zero at '.' or end of name. */ #define DOS_QM (L'>') #endif #ifndef DOS_DOT /** DOS wildcard: matches a literal '.', or zero characters at end of name. */ #define DOS_DOT (L'"') #endif /** @} */ /** * \defgroup DOKAN_OPTION DOKAN_OPTION * \brief All DOKAN_OPTION flags used in DOKAN_OPTIONS.Options * \see DOKAN_FILE_INFO */ /** @{ */ /** Enable ouput debug message */ #define DOKAN_OPTION_DEBUG 1 /** Enable ouput debug message to stderr */ #define DOKAN_OPTION_STDERR (1 << 1) /** * Enable the use of alternate stream paths in the form * :. If this is not specified then the driver will * fail any attempt to access a path with a colon. */ #define DOKAN_OPTION_ALT_STREAM (1 << 2) /** Enable mount drive as write-protected */ #define DOKAN_OPTION_WRITE_PROTECT (1 << 3) /** Use network drive - Dokan network provider needs to be installed and a \ref DOKAN_OPTIONS.UNCName provided */ #define DOKAN_OPTION_NETWORK (1 << 4) /** * Use removable drive * Be aware that on some environments, the userland application will be denied * to communicate with the drive which will result in a unwanted unmount. * \see Issue #843 */ #define DOKAN_OPTION_REMOVABLE (1 << 5) /** * Use Windows Mount Manager. * This option is highly recommended to use for better system integration * * If a drive letter is used but is busy, Mount manager will assign one for us and * \ref DOKAN_OPERATIONS.Mounted parameters will contain the new mount point. */ #define DOKAN_OPTION_MOUNT_MANAGER (1 << 6) /** * Mount the drive on current session only * Note: As Windows process only have on sessionID which is here used to define what is the current session, * impersonation will not work if someone attend to mount for a user from another one (like system service). * See issue #1196 */ #define DOKAN_OPTION_CURRENT_SESSION (1 << 7) /** Enable Lockfile/Unlockfile operations. Otherwise Dokan will take care of it */ #define DOKAN_OPTION_FILELOCK_USER_MODE (1 << 8) /** * Enable Case sensitive path. * By default all path are case insensitive. * For case sensitive: \c \\dir\\File and \c \\diR\\file are different files * but for case insensitive they are the same. */ #define DOKAN_OPTION_CASE_SENSITIVE (1 << 9) /** Allows unmounting of network drive via explorer */ #define DOKAN_OPTION_ENABLE_UNMOUNT_NETWORK_DRIVE (1 << 10) /** * Forward the kernel driver global and volume logs to the userland. * Can be very slow if single thread is enabled. */ #define DOKAN_OPTION_DISPATCH_DRIVER_LOGS (1 << 11) /** * Pull batches of events from the driver instead of a single one and execute * them parallelly. This option should only be used on computers with low cpu * count and userland filesystem taking time to process requests (like remote * storage). */ #define DOKAN_OPTION_ALLOW_IPC_BATCHING (1 << 12) /** @} */ /** * \struct DOKAN_UNICODE_STRING * \brief Layout-compatible counted UTF-16 string descriptor matching NT * \c UNICODE_STRING without requiring \c . */ typedef struct _DOKAN_UNICODE_STRING { /** Length, in bytes, of the string stored in \ref Buffer (excluding any NUL). */ USHORT Length; /** Allocated capacity, in bytes, of \ref Buffer. */ USHORT MaximumLength; /** Pointer to the UTF-16 character buffer. */ PWSTR Buffer; } DOKAN_UNICODE_STRING, *PDOKAN_UNICODE_STRING; /** * \struct DOKAN_ACCESS_STATE * \brief User-mode copy of the kernel \c ACCESS_STATE passed during * \ref DOKAN_OPERATIONS.ZwCreateFile. */ typedef struct _DOKAN_ACCESS_STATE { /** Whether security evaluation has already been performed. */ BOOLEAN SecurityEvaluated; /** Whether an audit event should be generated for this open. */ BOOLEAN GenerateAudit; /** Whether an audit event should be generated when the handle closes. */ BOOLEAN GenerateOnClose; /** Whether privilege use should be audited. */ BOOLEAN AuditPrivileges; /** Access state flags from the kernel \c ACCESS_STATE. */ ULONG Flags; /** Access rights not yet granted to the caller. */ ACCESS_MASK RemainingDesiredAccess; /** Access rights already granted to the caller. */ ACCESS_MASK PreviouslyGrantedAccess; /** Original access rights requested by the caller. */ ACCESS_MASK OriginalDesiredAccess; /** Optional security descriptor for newly created objects, or \c NULL. */ PSECURITY_DESCRIPTOR SecurityDescriptor; /** Counted UTF-16 object name from the kernel \c ACCESS_STATE. */ DOKAN_UNICODE_STRING ObjectName; /** Counted UTF-16 object type name from the kernel \c ACCESS_STATE. */ DOKAN_UNICODE_STRING ObjectType; } DOKAN_ACCESS_STATE, *PDOKAN_ACCESS_STATE; /** * \struct DOKAN_IO_SECURITY_CONTEXT * \brief User-mode copy of the kernel \c IO_SECURITY_CONTEXT passed to * \ref DOKAN_OPERATIONS.ZwCreateFile. */ typedef struct _DOKAN_IO_SECURITY_CONTEXT { /** Access state and optional security descriptor for the create request. */ DOKAN_ACCESS_STATE AccessState; /** Access rights requested for the create operation. */ ACCESS_MASK DesiredAccess; } DOKAN_IO_SECURITY_CONTEXT, *PDOKAN_IO_SECURITY_CONTEXT; /** * \struct DOKAN_MOUNT_POINT_INFO * \brief Active Dokan mount point entry returned by \ref DokanGetMountPointList. */ typedef struct _DOKAN_MOUNT_POINT_INFO { /** File system device type (disk or network). */ ULONG Type; /** Mount point, such as \c "M:\\" (drive letter) or an NTFS directory path. */ WCHAR MountPoint[MAX_PATH]; /** UNC name used for a network volume, or an empty string. */ WCHAR UNCName[64]; /** Kernel disk device name. */ WCHAR DeviceName[64]; /** Session ID of the mounting process, or \c (ULONG)-1 for all sessions. */ ULONG SessionId; /** Bitmask of mount options active on this mount point. */ ULONG MountOptions; } DOKAN_MOUNT_POINT_INFO, *PDOKAN_MOUNT_POINT_INFO; /** * \struct DOKAN_BASIC_INFORMATION * \brief NT-native timestamps and file attributes passed to * \ref DOKAN_OPERATIONS.SetFileBasicInformation. * * Per [MS-FSCC], a timestamp value of 0 leaves that timestamp unchanged, -1 * freezes automatic updates on the handle, and -2 restores automatic updates. * A \ref FileAttributes value of 0 leaves file attributes unchanged. */ typedef struct _DOKAN_BASIC_INFORMATION { /** File creation time (100-nanosecond intervals since January 1, 1601 UTC), or 0 / -1 / -2. */ LARGE_INTEGER CreationTime; /** File last access time (100-nanosecond intervals since January 1, 1601 UTC), or 0 / -1 / -2. */ LARGE_INTEGER LastAccessTime; /** File last write time (100-nanosecond intervals since January 1, 1601 UTC), or 0 / -1 / -2. */ LARGE_INTEGER LastWriteTime; /** File metadata change time (100-nanosecond intervals since January 1, 1601 UTC), or 0 / -1 / -2. */ LARGE_INTEGER ChangeTime; /** Bitmask of \c FILE_ATTRIBUTE_* flags, or 0 to leave attributes unchanged. */ ULONG FileAttributes; } DOKAN_BASIC_INFORMATION, *PDOKAN_BASIC_INFORMATION; /** Opaque handle to a running Dokan file system instance. */ typedef VOID* DOKAN_HANDLE; /** Pointer to a \ref DOKAN_HANDLE. */ typedef DOKAN_HANDLE* PDOKAN_HANDLE; /** * \struct DOKAN_OPTIONS * \brief Dokan mount options used to describe Dokan device behavior. * \see DokanMain */ typedef struct _DOKAN_OPTIONS { /** Version of the Dokan features requested without dots (version "123" is equal to Dokan version 1.2.3). */ USHORT Version; /** Only use a single thread to process events. This is highly not recommended as can easily create a bottleneck. */ BOOLEAN SingleThread; /** Features enabled for the mount. See \ref DOKAN_OPTION. */ ULONG Options; /** FileSystem can store anything here. */ ULONG64 GlobalContext; /** * Mount point. It can be a drive letter like \c "M:\\" or an existing empty * folder path \c "C:\\mount\\dokan" on an NTFS partition. */ LPCWSTR MountPoint; /** * UNC Name for the Network Redirector * \see Support for UNC Naming */ LPCWSTR UNCName; /** * Max timeout in milliseconds of each request before Dokan gives up to wait events to complete. * A timeout request is a sign that the userland implementation is no longer able to properly manage requests in time. * The driver will therefore unmount the device when a timeout trigger in order to keep the system stable. * The default timeout value is 15 seconds. */ ULONG Timeout; /** Allocation Unit Size of the volume. This will affect the file size. */ ULONG AllocationUnitSize; /** Sector Size of the volume. This will affect the file size. */ ULONG SectorSize; /** Length of the optional VolumeSecurityDescriptor provided. Set 0 will disable the option. */ ULONG VolumeSecurityDescriptorLength; /** Optional Volume Security descriptor. See InitializeSecurityDescriptor */ CHAR VolumeSecurityDescriptor[VOLUME_SECURITY_DESCRIPTOR_MAX_SIZE]; } DOKAN_OPTIONS, *PDOKAN_OPTIONS; /** * \struct DOKAN_FILE_INFO * \brief Dokan file information on the current operation. */ typedef struct _DOKAN_FILE_INFO { /** * Context that can be used to carry information between operations. * The context can carry whatever type like \c HANDLE, struct, int, * internal reference that will help the implementation understand the request context of the event. */ ULONG64 Context; /** Reserved. Used internally by Dokan library. Never modify. */ ULONG64 DokanContext; /** A pointer to DOKAN_OPTIONS which was passed to \ref DokanMain or \ref DokanCreateFileSystem. */ PDOKAN_OPTIONS DokanOptions; /** * Reserved. Used internally by Dokan library. Never modify. * If the processing for the event requires extra data to be associated with it * then a pointer to that data can be placed here */ PVOID ProcessingContext; /** * Process ID for the thread that originally requested a given I/O operation. */ ULONG ProcessId; /** * Requesting a directory file. * Must be set in \ref DOKAN_OPERATIONS.ZwCreateFile if the file appears to be a folder. */ UCHAR IsDirectory; /** * Flag indicating whether the file or directory must be deleted during * \ref DOKAN_OPERATIONS.Cleanup. During * \ref DOKAN_OPERATIONS.SetFileDisposition, it mirrors the requested * \c FILE_DISPOSITION_DELETE flag. * * If a prior \ref DOKAN_OPERATIONS.ZwCreateFile call with * \c FILE_DELETE_ON_CLOSE or \ref DOKAN_OPERATIONS.SetFileDisposition with * \c FILE_DISPOSITION_DELETE succeeds and the object remains marked for * deletion, the driver sets this field to \c TRUE on the * \ref DOKAN_OPERATIONS.Cleanup request of the last open handle to enter * kernel cleanup dispatch on that object, without waiting for earlier * in-flight cleanups on the same object to return from user mode. * * Under concurrent closes on the same object, this Cleanup can arrive * while another handle's Cleanup (\c DeletePending set to \c FALSE) is * still queued or running; see \ref DOKAN_OPERATIONS.Cleanup. */ UCHAR DeletePending; /** Read or write is paging IO. */ UCHAR PagingIo; /** Read or write is synchronous IO. */ UCHAR SynchronousIo; /** Read or write directly from data source without cache */ UCHAR Nocache; /** If \c TRUE, write to the current end of file instead of using the Offset parameter. */ UCHAR WriteToEndOfFile; /** * TRUE if the current request carries SL_CASE_SENSITIVE (i.e. opened without * OBJ_CASE_INSENSITIVE, such as FILE_FLAG_POSIX_SEMANTICS). * Populated only during \ref DOKAN_OPERATIONS.ZwCreateFile (\c FALSE on * subsequent callbacks); filesystems that need it later must persist it * in \ref Context. * Note: the current \c dokan3.sys driver still keys FCBs by mount-wide case * sensitivity (\c DOKAN_OPTION_CASE_SENSITIVE), so filesystems must not * resolve distinct case-colliding files on a case-insensitive mount until * a future \c dokan3.sys update adds per-request FCB case keying. */ UCHAR CaseSensitive; } DOKAN_FILE_INFO, *PDOKAN_FILE_INFO; /** Exception raised when Dokan APIs are called before \ref DokanInit. */ #define DOKAN_EXCEPTION_NOT_INITIALIZED 0x0f0ff0ff /** Exception raised when \ref DokanInit fails to initialize resources. */ #define DOKAN_EXCEPTION_INITIALIZATION_FAILED 0x0fbadbad /** Exception raised when \ref DokanShutdown fails to release resources. */ #define DOKAN_EXCEPTION_SHUTDOWN_FAILED 0x0fbadf00 /** * Explicit zero-on-disk AllocationSize sentinel. * When AllocationSize is 0 (or any negative value other than * DOKAN_ALLOCATION_SIZE_ZERO) and EndOfFile > 0, Dokan auto-computes a * cluster-aligned AllocationSize from EndOfFile (making ZeroMemory-initialized * structs safe by default). Set AllocationSize.QuadPart to * DOKAN_ALLOCATION_SIZE_ZERO to report a literal 0-byte AllocationSize on a * non-empty file (for example, cloud placeholders or sparse files). * * Note: the current \c dokan3.sys driver copies reported \c AllocationSize * directly into \c AdvancedFCBHeader.AllocationSize (\c sys/fileinfo.c), which * can affect kernel oplock, byte-range lock, and truncation header checks when * \c AllocationSize < \c EndOfFile until a future \c dokan3.sys update clamps * the FCB header to \c max(reported, RoundUp(FileSize)). */ #define DOKAN_ALLOCATION_SIZE_ZERO (-(LONGLONG)1) /** * \defgroup DOKAN_FIND DOKAN_FIND * \brief Flags passed in FindFlags to \ref DOKAN_OPERATIONS.FindFiles and * \ref DOKAN_OPERATIONS.FindFilesWithPattern. */ /** @{ */ /** * Start a new enumeration from the beginning of the directory. Set on every * new enumeration (including the initial scan and restarts after errors), and * omitted on continuation chunks following \c STATUS_MORE_ENTRIES. */ #define DOKAN_FIND_RESTART_SCAN 0x00000001 /** * Advisory hint that the caller requested at most a single matching entry. * If a filesystem honors this hint and more entries remain in the directory, * it must return \c STATUS_MORE_ENTRIES; returning \c STATUS_SUCCESS caches * the emitted entries as the complete directory and serves later queries from * that cache. */ #define DOKAN_FIND_SINGLE_ENTRY 0x00000002 /** @} */ /** * \struct DOKAN_FILE_INFORMATION * \brief NT-native file metadata returned by \ref DOKAN_OPERATIONS.GetFileInformation. */ typedef struct _DOKAN_FILE_INFORMATION { /** Bitmask of FILE_ATTRIBUTE_* flags. */ ULONG FileAttributes; /** Number of hard links to the file. */ ULONG NumberOfLinks; /** File creation time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER CreationTime; /** File last access time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER LastAccessTime; /** File last write time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER LastWriteTime; /** File metadata change time. If 0, Dokan defaults to LastWriteTime. */ LARGE_INTEGER ChangeTime; /** * File allocation size in bytes. Positive values are reported verbatim; * \ref DOKAN_ALLOCATION_SIZE_ZERO reports 0; 0 (or any other negative value) * auto-aligns EndOfFile to \ref DOKAN_OPTIONS.AllocationUnitSize. */ LARGE_INTEGER AllocationSize; /** Logical file size (end-of-file offset) in bytes. */ LARGE_INTEGER EndOfFile; /** 64-bit FileId; zero-extended little-endian into the low 64 bits of FILE_ID_128. */ ULONG64 FileIndex; /** Reparse point tag for FileAttributeTagInformation, FileStatInformation, and FileStatLxInformation. */ ULONG ReparseTag; /** * Effective access mask for FileStatInformation and FileStatLxInformation. * If 0, Dokan defaults to \c FILE_ALL_ACCESS. */ ACCESS_MASK EffectiveAccess; } DOKAN_FILE_INFORMATION, *PDOKAN_FILE_INFORMATION; /** * \struct DOKAN_FIND_DATA * \brief NT-native directory entry passed to \ref PFillFindData during directory enumeration. */ typedef struct _DOKAN_FIND_DATA { /** Bitmask of FILE_ATTRIBUTE_* flags. */ ULONG FileAttributes; /** Reparse point tag for FileIdExtd* directory queries. */ ULONG ReparseTag; /** Entry creation time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER CreationTime; /** Entry last access time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER LastAccessTime; /** Entry last write time (100-nanosecond intervals since January 1, 1601 UTC). */ LARGE_INTEGER LastWriteTime; /** Entry metadata change time. If 0, Dokan defaults to LastWriteTime. */ LARGE_INTEGER ChangeTime; /** * Entry allocation size in bytes. Positive values are reported verbatim; * \ref DOKAN_ALLOCATION_SIZE_ZERO reports 0; 0 (or any other negative value) * auto-aligns EndOfFile to \ref DOKAN_OPTIONS.AllocationUnitSize. */ LARGE_INTEGER AllocationSize; /** Logical entry size (end-of-file offset) in bytes. */ LARGE_INTEGER EndOfFile; /** 64-bit FileId; zero-extended little-endian into FILE_ID_128 for FileIdExtd* queries. */ ULONG64 FileIndex; /** * Non-empty NUL-terminated directory entry component name (at most 32767 * WCHARs). Copied by \ref PFillFindData before returning; must remain valid * only for the duration of the \ref PFillFindData call. Passing \c NULL or * an empty string fails the enumeration with \c STATUS_INVALID_PARAMETER; * exceeding 32767 WCHARs fails with \c STATUS_NAME_TOO_LONG. */ LPCWSTR FileName; } DOKAN_FIND_DATA, *PDOKAN_FIND_DATA; /** * \brief FillFindData Used to add an entry in FindFiles / FindFilesWithPattern operations. * \param FindData Directory entry metadata to append. * \param DokanFileInfo Information about the directory handle being enumerated. * \return 1 if memory allocation failed or the entry is invalid, otherwise 0. */ typedef int(WINAPI *PFillFindData)(_In_ const DOKAN_FIND_DATA *FindData, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \struct DOKAN_STREAM_DATA * \brief NT-native stream entry passed to \ref PFillFindStreamData during * \ref DOKAN_OPERATIONS.FindStreams enumeration. */ typedef struct _DOKAN_STREAM_DATA { /** Logical stream size in bytes. */ LARGE_INTEGER StreamSize; /** * Stream allocation size in bytes. Positive values are reported verbatim; * \ref DOKAN_ALLOCATION_SIZE_ZERO reports 0; 0 (or any other negative value) * auto-aligns StreamSize to \ref DOKAN_OPTIONS.AllocationUnitSize. */ LARGE_INTEGER StreamAllocationSize; /** * Non-empty NUL-terminated NT stream name (for example, \c "::$DATA" or * \c ":alt:$DATA", at most 32767 WCHARs). Copied by \ref PFillFindStreamData * before returning. Passing \c NULL or an empty string fails the query with * \c STATUS_INVALID_PARAMETER; exceeding 32767 WCHARs fails with * \c STATUS_NAME_TOO_LONG. */ LPCWSTR StreamName; } DOKAN_STREAM_DATA, *PDOKAN_STREAM_DATA; /** * \brief FillFindStreamData Used to add an entry in FindStreams. * \param FindStreamData Stream metadata entry to append. * \param FindStreamContext Opaque context passed to \ref DOKAN_OPERATIONS.FindStreams. * \return FALSE if the buffer is full or the entry is invalid, otherwise TRUE. */ typedef BOOL(WINAPI *PFillFindStreamData)( _In_ const DOKAN_STREAM_DATA *FindStreamData, _In_ PVOID FindStreamContext); // clang-format off /** * \struct DOKAN_OPERATIONS * \brief Dokan API callbacks interface * * DOKAN_OPERATIONS is a struct of callbacks that describe all Dokan API operations * that will be called when Windows access to the filesystem. * * If an error occurs, return NTSTATUS (https://support.microsoft.com/en-us/kb/113996). * Win32 Error can be converted to \c NTSTATUS with \ref DokanNtStatusFromWin32 * * All callbacks can be set to \c NULL or return \c STATUS_NOT_IMPLEMENTED * if supporting one of them is not desired. Be aware that returning such values to important callbacks * such as DOKAN_OPERATIONS.ZwCreateFile / DOKAN_OPERATIONS.ReadFile / ... would make the filesystem not work or become unstable. */ typedef struct _DOKAN_OPERATIONS { /** * \brief CreateFile Dokan API callback * * CreateFile is called each time a request is made on a file system object. * * When \c FILE_OPEN_IF, \c FILE_OVERWRITE_IF, or \c FILE_SUPERSEDE successfully opens an * existing file, \c STATUS_OBJECT_NAME_COLLISION should be returned instead of \c STATUS_SUCCESS . * This will inform Dokan that the file has been opened and not created during the request. * * If the file is a directory, CreateFile is also called. * In this case, CreateFile should return \c STATUS_SUCCESS when that directory * can be opened and DOKAN_FILE_INFO.IsDirectory has to be set to \c TRUE. * On the other hand, if DOKAN_FILE_INFO.IsDirectory is set to \c TRUE * but the path targets a file, \c STATUS_NOT_A_DIRECTORY must be returned. * * DOKAN_FILE_INFO.Context can be used to store per-open state (like a \c HANDLE * or a heap-allocated context struct) that can be retrieved in all other requests * related to the handle. Any underlying OS file handle should be closed in * \ref DOKAN_OPERATIONS.Cleanup so share modes are released synchronously on * \c CloseHandle, while heap-allocated Context memory must remain valid for * post-cleanup paging I/O and be freed in \ref DOKAN_OPERATIONS.CloseFile. * * \param FileName File path requested by the Kernel on the FileSystem. * \param SecurityContext SecurityContext, see https://msdn.microsoft.com/en-us/library/windows/hardware/ff550613(v=vs.85).aspx * \param DesiredAccess Specifies an ACCESS_MASK value that determines the requested access to the object. * \param FileAttributes Specifies one or more FILE_ATTRIBUTE_XXX flags, which represent the file attributes to set if a file is created or overwritten. * \param ShareAccess Type of share access, which is specified as zero or any combination of FILE_SHARE_* flags. * \param CreateDisposition Specifies the action to perform if the file does or does not exist. * \param CreateOptions Specifies the options to apply when the driver creates or opens the file. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see See ZwCreateFile for more information about the parameters of this callback (MSDN). * \see DokanMapKernelToUserCreateFileFlags */ NTSTATUS(DOKAN_CALLBACK *ZwCreateFile)( _In_ LPCWSTR FileName, _In_ PDOKAN_IO_SECURITY_CONTEXT SecurityContext, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG FileAttributes, _In_ ULONG ShareAccess, _In_ ULONG CreateDisposition, _In_ ULONG CreateOptions, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief Cleanup Dokan API callback * * Cleanup request before \ref CloseFile is called. * * When \ref DOKAN_FILE_INFO.DeletePending is \c TRUE, the file or directory * must be deleted during Cleanup. Because Cleanup cannot fail, the filesystem * must ensure ahead of time (for example, in \ref SetFileDisposition or * \ref ZwCreateFile) that deletion can safely happen during Cleanup. * See \ref SetFileDisposition for details. * * When multiple handles on the same file or directory are closed concurrently, * the driver sets \ref DOKAN_FILE_INFO.DeletePending to \c TRUE on the last * open handle to enter kernel cleanup dispatch on that object without waiting * for earlier in-flight cleanups on that object to return from user mode. * Consequently, the Cleanup with \c DeletePending set to \c TRUE can arrive in * user mode while another handle's Cleanup (\c DeletePending set to \c FALSE) * on the same object is still queued or running. * * Because of this concurrent delivery, a Cleanup with \c DeletePending set to * \c TRUE must not assume other handles on the same object have already * finished Cleanup: filesystems that defer unlinking until every per-handle * Cleanup completes must latch the confirmed delete decision so the last * completing Cleanup unlinks the object even if it arrives with * \c DeletePending set to \c FALSE. Conversely, a Cleanup with * \c DeletePending set to \c FALSE must tolerate the object already being * unlinked (completing per-handle teardown without crashing or assuming a path * lookup succeeds) and must not clear or undo a deletion already confirmed or * performed by the concurrent \c DeletePending Cleanup. * * \param FileName File path requested by the Kernel on the FileSystem. * \param DokanFileInfo Information about the file or directory. * \see SetFileDisposition */ void(DOKAN_CALLBACK *Cleanup)( _In_ LPCWSTR FileName, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief CloseFile Dokan API callback * * Clean remaining Context * * CloseFile is called at the end of the life of the context. * Anything remaining in \ref DOKAN_FILE_INFO.Context must be cleared before returning. * * \param FileName File path requested by the Kernel on the FileSystem. * \param DokanFileInfo Information about the file or directory. */ void(DOKAN_CALLBACK *CloseFile)( _In_ LPCWSTR FileName, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief ReadFile Dokan API callback * * ReadFile callback on the file previously opened in DOKAN_OPERATIONS.ZwCreateFile. * It can be called by different threads at the same time, so the read/context has to be thread safe. * * When apps make use of memory mapped files, DOKAN_OPERATIONS.WriteFile or DOKAN_OPERATIONS.ReadFile * functions may be invoked after DOKAN_OPERATIONS.Cleanup in order to complete the I/O operations. * The file system application should also properly work in this case. * * \param FileName File path requested by the Kernel on the FileSystem. * \param Buffer Read buffer that has to be filled with the read result. * \param BufferLength Buffer length and read size to continue with. * \param ReadLength Total data size that has been read. * \param Offset Offset from where the read has to be continued. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see WriteFile */ NTSTATUS(DOKAN_CALLBACK *ReadFile)( _In_ LPCWSTR FileName, _Out_ LPVOID Buffer, _In_ DWORD BufferLength, _Out_ LPDWORD ReadLength, _In_ LONGLONG Offset, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief WriteFile Dokan API callback * * WriteFile callback on the file previously opened in DOKAN_OPERATIONS.ZwCreateFile * It can be called by different threads at the same time, so the write/context has to be thread safe. * * When apps make use of memory mapped files ( DOKAN_FILE_INFO.PagingIo ), * DOKAN_OPERATIONS.WriteFile or DOKAN_OPERATIONS.ReadFile * functions may be invoked after DOKAN_OPERATIONS.Cleanup in order to complete the I/O operations. * The file system application should also properly work in this case. * This type of request should follow Windows rules like not extending the current file size. * * \param FileName File path requested by the Kernel on the FileSystem. * \param Buffer Data that has to be written. * \param NumberOfBytesToWrite Buffer length and write size to continue with. * \param NumberOfBytesWritten Total number of bytes that have been written. * \param Offset Offset from where the write has to be continued. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see ReadFile */ NTSTATUS(DOKAN_CALLBACK *WriteFile)( _In_ LPCWSTR FileName, _In_ LPCVOID Buffer, _In_ DWORD NumberOfBytesToWrite, _Out_ LPDWORD NumberOfBytesWritten, _In_ LONGLONG Offset, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief FlushFileBuffers Dokan API callback * * Clears buffers for this context and causes any buffered data to be written to the file. * * \param FileName File path requested by the Kernel on the FileSystem. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *FlushFileBuffers)( _In_ LPCWSTR FileName, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief GetFileInformation Dokan API callback * * Get NT-native metadata for a file or directory. * * \param FileName File path requested by the Kernel on the FileSystem. * \param Buffer \ref DOKAN_FILE_INFORMATION struct to fill (zero-initialized by Dokan before the call). * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *GetFileInformation)( _In_ LPCWSTR FileName, _Out_ PDOKAN_FILE_INFORMATION Buffer, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief FindFiles Dokan API callback * * List files in the requested directory. * \ref DOKAN_OPERATIONS.FindFilesWithPattern is checked first. If it is not implemented or * returns \c STATUS_NOT_IMPLEMENTED, then FindFiles is called, if assigned. * * To stream large directories incrementally, implementations may keep a per-handle cursor * in \ref DOKAN_FILE_INFO.Context, emit a chunk of entries via \a FillFindData, and return * \c STATUS_MORE_ENTRIES. Every new enumeration (including the initial scan and restarts * after errors) carries \ref DOKAN_FIND_RESTART_SCAN (the cursor must be reset to the start); * continuation chunks omit it until \c STATUS_SUCCESS or an error is returned. Each * \c STATUS_MORE_ENTRIES return from \c FindFiles must emit at least one entry via * \a FillFindData (streaming backends that receive empty pages with a continuation token, * such as cloud listing APIs, should loop internally over empty pages); returning * \c STATUS_MORE_ENTRIES with zero entries fails with \c STATUS_INTERNAL_ERROR. * For non-root directories, any \c "." and \c ".." entries must appear in the initial chunk * (continuation-chunk \c "." and \c ".." entries are ignored, and missing ones are synthesized * only on the initial chunk). \ref DOKAN_FIND_SINGLE_ENTRY is an advisory hint (suppressed when * Dokan falls back to \c FindFiles for a non-\c "*" search pattern); if an implementation honors * it and more entries remain, it must return \c STATUS_MORE_ENTRIES (returning \c STATUS_SUCCESS * caches the emitted entries as the complete directory and serves later queries from cache). * Dokan serializes concurrent directory-enumeration callbacks on the same open handle, so a * concurrent query waiting behind a scan longer than \ref DOKAN_OPTIONS.Timeout may be canceled * by the driver. Simple implementations may ignore \a FindFlags, emit all entries, and return * \c STATUS_SUCCESS. * * \param FileName File path requested by the Kernel on the FileSystem. * \param FillFindData Callback invoked with each \ref DOKAN_FIND_DATA entry. * \param FindFlags Bitmask of \ref DOKAN_FIND flags (\c DOKAN_FIND_RESTART_SCAN, * \c DOKAN_FIND_SINGLE_ENTRY). * \param DokanFileInfo Information about the directory handle. * \return \c STATUS_SUCCESS when enumeration completes, \c STATUS_MORE_ENTRIES when more chunks * remain, or an appropriate \c NTSTATUS error. * \see FindFilesWithPattern */ NTSTATUS(DOKAN_CALLBACK *FindFiles)( _In_ LPCWSTR FileName, _In_ PFillFindData FillFindData, _In_ ULONG FindFlags, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief FindFilesWithPattern Dokan API callback * * Same as \ref DOKAN_OPERATIONS.FindFiles but with a search pattern.\n * The search pattern is a Windows MS-DOS-style expression. * It can contain wild cards and extended characters or none of them. See \ref DokanIsNameInExpression. * * If the function is not implemented, \ref DOKAN_OPERATIONS.FindFiles * will be called instead and the result will be filtered internally by the library. * * Like \ref FindFiles, every new enumeration (including the initial scan and restarts * after errors) carries \ref DOKAN_FIND_RESTART_SCAN, while continuation chunks after * \c STATUS_MORE_ENTRIES omit it. Streaming implementations should store their per-handle * cursor in \ref DOKAN_FILE_INFO.Context, ensure forward progress on \c STATUS_MORE_ENTRIES * (unlike \c FindFiles, \c FindFilesWithPattern may return \c STATUS_MORE_ENTRIES with zero * matching entries while advancing past a non-matching page), * and emit \c "." / \c ".." only in the initial chunk (continuation-chunk \c "." / \c ".." * entries are ignored). \ref DOKAN_FIND_SINGLE_ENTRY is an advisory hint: if honored while * more entries remain, the callback must return \c STATUS_MORE_ENTRIES (returning * \c STATUS_SUCCESS caches the emitted entries as the complete directory and serves later * queries from cache). Dokan serializes concurrent directory-enumeration callbacks on the * same open handle (so a concurrent query waiting behind a scan longer than * \ref DOKAN_OPTIONS.Timeout may be canceled by the driver). * * \param PathName Path requested by the Kernel on the FileSystem. * \param SearchPattern Search pattern. * \param FillFindData Callback invoked with each matching \ref DOKAN_FIND_DATA entry. * \param FindFlags Bitmask of \ref DOKAN_FIND flags (\c DOKAN_FIND_RESTART_SCAN, * \c DOKAN_FIND_SINGLE_ENTRY). * \param DokanFileInfo Information about the directory handle. * \return \c STATUS_SUCCESS when enumeration completes, \c STATUS_MORE_ENTRIES when more chunks * remain, or an appropriate \c NTSTATUS error. * \see FindFiles * \see DokanIsNameInExpression */ NTSTATUS(DOKAN_CALLBACK *FindFilesWithPattern)( _In_ LPCWSTR PathName, _In_ LPCWSTR SearchPattern, _In_ PFillFindData FillFindData, _In_ ULONG FindFlags, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetFileBasicInformation Dokan API callback * * Atomically updates file timestamps and/or attributes from \c FileBasicInformation. * Per [MS-FSCC], a timestamp of 0 means do not change, -1 freezes automatic timestamp * updates on the handle, and -2 restores automatic updates. A \c FileAttributes value of 0 * means do not modify attributes. * * \param FileName File path requested by the Kernel on the FileSystem. * \param BasicInfo Pointer to \ref DOKAN_BASIC_INFORMATION containing timestamps and attributes. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *SetFileBasicInformation)( _In_ LPCWSTR FileName, _In_ const DOKAN_BASIC_INFORMATION *BasicInfo, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetFileDisposition Dokan API callback * * Sets or clears delete disposition on a file or directory (distinguished via * \ref DOKAN_FILE_INFO.IsDirectory). * * Legacy \c FileDispositionInformation is normalized to \c FILE_DISPOSITION_DELETE or * \c FILE_DISPOSITION_DO_NOT_DELETE; \c FileDispositionInformationEx forwards its * \c FILE_DISPOSITION_* flags verbatim. \c (DispositionFlags & FILE_DISPOSITION_DELETE) * is canonical; \ref DOKAN_FILE_INFO.DeletePending mirrors it for convenience. * * Note: \c FILE_DISPOSITION_POSIX_SEMANTICS and \c FILE_DISPOSITION_ON_CLOSE are not * yet kernel-backed in the current \c dokan3.sys driver; filesystems must not unlink * or detach namespace entries immediately inside SetFileDisposition until a future * \c dokan3.sys update supports them. * * The object should not be unlinked here; instead validate that deletion can succeed * (for example, checking that a directory is empty and returning \c STATUS_DIRECTORY_NOT_EMPTY * otherwise). When \c STATUS_SUCCESS is returned with \c FILE_DISPOSITION_DELETE set * (and the disposition is not later cleared or rejected by the kernel), the last open * handle to enter kernel cleanup dispatch receives a \ref Cleanup call with * \ref DOKAN_FILE_INFO.DeletePending set to \c TRUE. Under concurrent closes, that * \ref Cleanup call can arrive while another handle's \ref Cleanup on the same object * is still queued or running (see \ref Cleanup). * * \param FileName File or directory path requested by the Kernel on the FileSystem. * \param DispositionFlags Bitmask of \c FILE_DISPOSITION_* flags. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see Cleanup */ NTSTATUS(DOKAN_CALLBACK *SetFileDisposition)( _In_ LPCWSTR FileName, _In_ ULONG DispositionFlags, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief MoveFile Dokan API callback * * Move or rename a file, directory, or alternate data stream to a new destination. * Legacy \c FileRenameInformation is normalized to \c FILE_RENAME_REPLACE_IF_EXISTS or 0; * \c FileRenameInformationEx passes its \c FILE_RENAME_* flags in \a RenameFlags. * * Note: \c FILE_RENAME_POSIX_SEMANTICS and \c FILE_RENAME_IGNORE_READONLY_ATTRIBUTE are * not yet kernel-backed in the current \c dokan3.sys driver (\c dokan3.sys still lacks * FCB locking on \c FileRenameInformationEx and POSIX detach semantics until a future * \c dokan3.sys update supports them). * * \param FileName Path for the file or directory to be moved. * \param NewFileName Path for the new location of the file or directory. * \param RenameFlags Bitmask of \c FILE_RENAME_* flags (such as \c FILE_RENAME_REPLACE_IF_EXISTS). * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *MoveFile)( _In_ LPCWSTR FileName, _In_ LPCWSTR NewFileName, _In_ ULONG RenameFlags, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetEndOfFile Dokan API callback * * SetEndOfFile is used to truncate or extend a file (physical file size). * * \param FileName File path requested by the Kernel on the FileSystem. * \param ByteOffset File length to set. * \param DokanFileInfo Information about the file or directory. * \see FileEndOfFileInformation (MSDN) * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *SetEndOfFile)( _In_ LPCWSTR FileName, _In_ LONGLONG ByteOffset, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetAllocationSize Dokan API callback * * SetAllocationSize is used to truncate or extend a file. * * \param FileName File path requested by the Kernel on the FileSystem. * \param AllocSize File length to set. * \param DokanFileInfo Information about the file or directory. * \see FileAllocationInformation (MSDN) * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *SetAllocationSize)( _In_ LPCWSTR FileName, _In_ LONGLONG AllocSize, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetValidDataLength Dokan API callback * * Sets the valid data length (VDL) of a file via \c FileValidDataLengthInformation. * Optional callback: leave \c NULL to return \c STATUS_NOT_IMPLEMENTED. * Dokan centrally validates that the target is not a directory, \a ValidDataLength is * non-negative, and the handle was opened with \c SeManageVolumePrivilege enabled. * * \param FileName File path requested by the Kernel on the FileSystem. * \param ValidDataLength New valid data length in bytes. * \param DokanFileInfo Information about the file. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *SetValidDataLength)( _In_ LPCWSTR FileName, _In_ LONGLONG ValidDataLength, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief LockFile Dokan API callback * * Lock file at a specific offset and data length. * This is only used if \ref DOKAN_OPTION_FILELOCK_USER_MODE is enabled. * * \param FileName File path requested by the Kernel on the FileSystem. * \param ByteOffset Offset from where the lock has to be continued. * \param Length Data length to lock. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see UnlockFile */ NTSTATUS(DOKAN_CALLBACK *LockFile)( _In_ LPCWSTR FileName, _In_ LONGLONG ByteOffset, _In_ LONGLONG Length, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief UnlockFile Dokan API callback * * Unlock file at a specific offset and data length. * This is only used if \ref DOKAN_OPTION_FILELOCK_USER_MODE is enabled. * * \param FileName File path requested by the Kernel on the FileSystem. * \param ByteOffset Offset from where the lock has to be continued. * \param Length Data length to lock. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see LockFile */ NTSTATUS(DOKAN_CALLBACK *UnlockFile)( _In_ LPCWSTR FileName, _In_ LONGLONG ByteOffset, _In_ LONGLONG Length, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief GetDiskFreeSpace Dokan API callback * * Retrieves information about the amount of space that is available on a disk volume. * It consists of the total amount of space, the total amount of free space, and * the total amount of free space available to the user that is associated with the calling thread. * * Neither GetDiskFreeSpace nor \ref GetVolumeInformation * save the DOKAN_FILE_INFO.Context. * Before these methods are called, \ref ZwCreateFile may not be called. * (ditto \ref CloseFile and \ref Cleanup) * * \param FreeBytesAvailable Amount of available space. * \param TotalNumberOfBytes Total size of storage space * \param TotalNumberOfFreeBytes Amount of free space * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or \c NTSTATUS appropriate to the request result. * \see GetDiskFreeSpaceEx function (MSDN) * \see GetVolumeInformation */ NTSTATUS(DOKAN_CALLBACK *GetDiskFreeSpace)( _Out_ PULONGLONG FreeBytesAvailable, _Out_ PULONGLONG TotalNumberOfBytes, _Out_ PULONGLONG TotalNumberOfFreeBytes, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief GetVolumeInformation Dokan API callback * * Retrieves information about the file system and volume associated with the specified root directory. * * Neither GetVolumeInformation nor GetDiskFreeSpace * save the \ref DOKAN_FILE_INFO#Context. * Before these methods are called, \ref ZwCreateFile may not be called. * (ditto \ref CloseFile and \ref Cleanup) * * VolumeName length can be anything that fit in the provided buffer. * But some Windows component expect it to be no longer than 32 characters * that why it is recommended to set a value under this limit. * * FileSystemName could be anything up to 10 characters. * But Windows check few feature availability based on file system name. * For this, it is recommended to set NTFS or FAT here. * * \c FILE_READ_ONLY_VOLUME is automatically added to the * FileSystemFlags if \ref DOKAN_OPTION_WRITE_PROTECT was * specified in DOKAN_OPTIONS when the volume was mounted. * * The returned \p VolumeSerialNumber is cached per mounted instance and is * also used to populate \c FileIdInformation::VolumeSerialNumber. If a * \c FileIdInformation query arrives before any volume query has succeeded, * Dokan may invoke \ref GetVolumeInformation lazily to populate the cache. * * \param VolumeNameBuffer A pointer to a buffer that receives the name of a specified volume. * \param VolumeNameSize The length of a volume name buffer. * \param VolumeSerialNumber A pointer to a variable that receives the volume serial number. * \param MaximumComponentLength A pointer to a variable that receives the maximum length. * \param FileSystemFlags A pointer to a variable that receives flags associated with the specified file system. * \param FileSystemNameBuffer A pointer to a buffer that receives the name of the file system. * \param FileSystemNameSize The length of the file system name buffer. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see GetVolumeInformation function (MSDN) * \see GetDiskFreeSpace */ NTSTATUS(DOKAN_CALLBACK *GetVolumeInformation)( _Out_ LPWSTR VolumeNameBuffer, _In_ DWORD VolumeNameSize, _Out_ LPDWORD VolumeSerialNumber, _Out_ LPDWORD MaximumComponentLength, _Out_ LPDWORD FileSystemFlags, _Out_ LPWSTR FileSystemNameBuffer, _In_ DWORD FileSystemNameSize, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief Mounted Dokan API callback * * Called when Dokan successfully mounts the volume. * * If \ref DOKAN_OPTION_MOUNT_MANAGER is enabled and the drive letter requested is busy, * the MountPoint can contain a different drive letter that the mount manager assigned us. * * \param MountPoint The mount point assign to the instance. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. The value is currently not used by the library. * \see Unmounted */ NTSTATUS(DOKAN_CALLBACK *Mounted)( _In_ LPCWSTR MountPoint, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief Unmounted Dokan API callback * * Called when Dokan is unmounting the volume. * * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or \c NTSTATUS appropriate to the request result. The value is currently not used by the library. * \see Mounted */ NTSTATUS(DOKAN_CALLBACK *Unmounted)( _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief GetFileSecurity Dokan API callback * * Get specified information about the security of a file or directory. * * Return \c STATUS_NOT_IMPLEMENTED to let dokan library build a sddl of the current process user with authenticate user rights for context menu. * Return \c STATUS_BUFFER_OVERFLOW if buffer size is too small. * * \since Supported since version 0.6.0. The version must be specified in \ref DOKAN_OPTIONS.Version. * \param FileName File path requested by the Kernel on the FileSystem. * \param SecurityInformation A SECURITY_INFORMATION value that identifies the security information being requested. * \param SecurityDescriptor A pointer to a buffer that receives a copy of the security descriptor of the requested file. * \param BufferLength Specifies the size, in bytes, of the buffer. * \param LengthNeeded A pointer to the variable that receives the number of bytes necessary to store the complete security descriptor. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see SetFileSecurity * \see GetFileSecurity function (MSDN) */ NTSTATUS(DOKAN_CALLBACK *GetFileSecurity)( _In_ LPCWSTR FileName, _In_ PSECURITY_INFORMATION SecurityInformation, _Out_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG BufferLength, _Out_ PULONG LengthNeeded, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief SetFileSecurity Dokan API callback * * Sets the security of a file or directory object. * * \since Supported since version 0.6.0. The version must be specified in \ref DOKAN_OPTIONS.Version. * \param FileName File path requested by the Kernel on the FileSystem. * \param SecurityInformation Structure that identifies the contents of the security descriptor pointed by \a SecurityDescriptor param. * \param SecurityDescriptor A pointer to a SECURITY_DESCRIPTOR structure. * \param BufferLength Specifies the size, in bytes, of the buffer. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. * \see GetFileSecurity * \see SetFileSecurity function (MSDN) */ NTSTATUS(DOKAN_CALLBACK *SetFileSecurity)( _In_ LPCWSTR FileName, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ ULONG BufferLength, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); /** * \brief FindStreams Dokan API callback * * Retrieve all NTFS Streams informations on the file. * This is only called if \ref DOKAN_OPTION_ALT_STREAM is enabled. * * \since Supported since version 0.8.0. The version must be specified in \ref DOKAN_OPTIONS.Version. * \param FileName File path requested by the Kernel on the FileSystem. * \param FillFindStreamData Callback invoked with each \ref DOKAN_STREAM_DATA entry. * \param FindStreamContext Context for the event to pass to the callback FillFindStreamData. * \param DokanFileInfo Information about the file or directory. * \return \c STATUS_SUCCESS on success or NTSTATUS appropriate to the request result. */ NTSTATUS(DOKAN_CALLBACK *FindStreams)( _In_ LPCWSTR FileName, _In_ PFillFindStreamData FillFindStreamData, _In_ PVOID FindStreamContext, _Inout_ PDOKAN_FILE_INFO DokanFileInfo); } DOKAN_OPERATIONS, *PDOKAN_OPERATIONS; // clang-format on /** * \defgroup DokanMainResult DokanMainResult * \brief \ref DokanMain \ref DokanCreateFileSystem returns error codes */ /** @{ */ /** Dokan mount succeed. */ #define DOKAN_SUCCESS 0 /** Dokan mount error. */ #define DOKAN_ERROR -1 /** Dokan mount failed - Bad drive letter. */ #define DOKAN_DRIVE_LETTER_ERROR -2 /** Dokan mount failed - Can't install driver. */ #define DOKAN_DRIVER_INSTALL_ERROR -3 /** Dokan mount failed - Driver answer that something is wrong. */ #define DOKAN_START_ERROR -4 /** * Dokan mount failed. * Can't assign a drive letter or mount point. * Probably already used by another volume. */ #define DOKAN_MOUNT_ERROR -5 /** * Dokan mount failed. * Mount point is invalid. */ #define DOKAN_MOUNT_POINT_ERROR -6 /** * Dokan mount failed. * Requested an incompatible version. */ #define DOKAN_VERSION_ERROR -7 /** @} */ /** * \defgroup Dokan Dokan */ /** @{ */ /** * \brief Initialize all required Dokan internal resources. * * This needs to be called only once before trying to use \ref DokanMain or \ref DokanCreateFileSystem for the first time. * Otherwise both will fail and raise an exception. */ VOID DOKANAPI DokanInit(); /** * \brief Release all allocated resources by \ref DokanInit when they are no longer needed. * * This should be called when the application no longer expects to create a new FileSystem with * \ref DokanMain or \ref DokanCreateFileSystem and after all devices are unmount. */ VOID DOKANAPI DokanShutdown(); /** * \brief Mount a new Dokan Volume. * * This function block until the device is unmounted. * If the mount fails, it will directly return a \ref DokanMainResult error. * * See \ref DokanCreateFileSystem to create mount Dokan Volume asynchronously. * * \param DokanOptions a \ref DOKAN_OPTIONS that describe the mount. * \param DokanOperations Instance of \ref DOKAN_OPERATIONS that will be called for each request made by the kernel. * \return \ref DokanMainResult status. */ int DOKANAPI DokanMain(PDOKAN_OPTIONS DokanOptions, PDOKAN_OPERATIONS DokanOperations); /** * \brief Mount a new Dokan Volume. * * It is mandatory to have called \ref DokanInit previously to use this API. * * This function returns directly on device mount or on failure. * See \ref DokanMainResult for possible errors. * * \ref DokanWaitForFileSystemClosed can be used to wait until the device is unmount. * * \param DokanOptions a \ref DOKAN_OPTIONS that describe the mount. * \param DokanOperations Instance of \ref DOKAN_OPERATIONS that will be called for each request made by the kernel. * \param DokanInstance Dokan mount instance context that can be used for related instance calls like \ref DokanIsFileSystemRunning . * \return \ref DokanMainResult status. */ int DOKANAPI DokanCreateFileSystem(_In_ PDOKAN_OPTIONS DokanOptions, _In_ PDOKAN_OPERATIONS DokanOperations, _Out_ DOKAN_HANDLE *DokanInstance); /** * \brief Check if the FileSystem is still running or not. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \return Whether the FileSystem is still running or not. */ BOOL DOKANAPI DokanIsFileSystemRunning(_In_ DOKAN_HANDLE DokanInstance); /** * \brief Wait until the FileSystem is unmount. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param dwMilliseconds The time-out interval, in milliseconds. See WaitForSingleObject. * \return See WaitForSingleObject for a description of return values. */ DWORD DOKANAPI DokanWaitForFileSystemClosed(_In_ DOKAN_HANDLE DokanInstance, _In_ DWORD dwMilliseconds); /** * \brief Register callback for FileSystem unmount. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param WaitHandle Handle to wait handle registration. This handle needs to be closed by calling UnregisterWait, UnregisterWaitEx or \ref DokanUnregisterWaitForFileSystemClosed to unregister the callback . * \param Callback Callback function to be called from a worker thread when file system is unmounted . * \param Context A context parameter to send to callback function . * \param dwMilliseconds The time-out interval, in milliseconds. See RegisterWaitForSingleObject. * \return TRUE if successful, FALSE otherwise. */ BOOL DOKANAPI DokanRegisterWaitForFileSystemClosed( _In_ DOKAN_HANDLE DokanInstance, _Out_ PHANDLE WaitHandle, _In_ WAITORTIMERCALLBACKFUNC Callback, _In_ PVOID Context, ULONG dwMilliseconds); /** * \brief Unregister callback for FileSystem unmount. * * \param WaitHandle Handle returned as WaitHandle parameter in previous call to \ref DokanRegisterWaitForFileSystemClosed . * \param WaitForCallbacks Indicates whether to wait for callbacks to complete before returning. Normally set to TRUE unless called from same thread as callback function. * \return TRUE if successful, FALSE otherwise. */ BOOL DOKANAPI DokanUnregisterWaitForFileSystemClosed(_In_ HANDLE WaitHandle, BOOL WaitForCallbacks); /** * \brief Unmount the Dokan instance. * * Unmount and wait until all resources of the \c DokanInstance are released. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . */ VOID DOKANAPI DokanCloseHandle(_In_ DOKAN_HANDLE DokanInstance); /** * \brief Unmount a Dokan device from a driver letter. * * \param DriveLetter Dokan driver letter to unmount. * \return \c TRUE if device was unmounted or \c FALSE in case of failure or device not found. */ BOOL DOKANAPI DokanUnmount(WCHAR DriveLetter); /** * \brief Unmount a Dokan device from a mount point * * \param MountPoint Mount point to unmount (\c "Z", \c "Z:", \c "Z:\\", * \c "Z:\\MyMountPoint"). * \return \c TRUE if device was unmounted or \c FALSE in case of failure or * device not found. */ BOOL DOKANAPI DokanRemoveMountPoint(LPCWSTR MountPoint); /** * \brief Checks whether Name matches Expression per [MS-FSA 2.1.4.4] * * Matches \a Name against \a Expression using Windows MS-DOS/NTFS wildcard * semantics (similar to \c FsRtlIsNameInExpression):\n * \c * (asterisk) Matches zero or more characters (including \c .).\n * ? (question mark) Matches any single character (including \c .).\n * \c DOS_STAR (\c < less than) Matches zero or more characters without consuming * the final \c . in \a Name.\n * \c DOS_QM (\c > greater than) Matches any single non-\c . character, or zero * characters when positioned at \c . or end of \a Name.\n * \c DOS_DOT (\c " quotation mark) Matches a literal \c ., or zero characters at * end of \a Name.\n * When \a IgnoreCase is \c TRUE, characters are case-folded using the OS Unicode * case-folding table (\c RtlUpcaseUnicodeChar). * * \param Expression Expression that can contain any of the above wildcards. * \param Name Name to check. * \param IgnoreCase \c TRUE for case-insensitive matching, \c FALSE for exact * case matching. * \return \c TRUE if \a Name matches \a Expression, \c FALSE otherwise. */ BOOL DOKANAPI DokanIsNameInExpression(_In_opt_ LPCWSTR Expression, _In_opt_ LPCWSTR Name, _In_ BOOL IgnoreCase); /** * \brief Get the version of Dokan. * The returned ULONG is the version number without the dots. * \return The version of Dokan */ ULONG DOKANAPI DokanVersion(); /** * \brief Get the version of the Dokan driver. * The returned ULONG is the version number without the dots. * \return The version of Dokan driver or 0 on failure. */ ULONG DOKANAPI DokanDriverVersion(); /** * \brief Extends the timeout of the current IO operation in driver. * * \param Timeout Extended time in milliseconds requested. * \param DokanFileInfo \ref DOKAN_FILE_INFO of the operation to extend. * \return If the operation was successful. */ BOOL DOKANAPI DokanResetTimeout(ULONG Timeout, PDOKAN_FILE_INFO DokanFileInfo); /** * \brief Get the handle to Access Token. * * This method needs be called in \ref DOKAN_OPERATIONS.ZwCreateFile callback. * The caller must call CloseHandle * for the returned handle. * * \param DokanFileInfo \ref DOKAN_FILE_INFO of the operation to extend. * \return A handle to the account token for the user on whose behalf the code is running. */ HANDLE DOKANAPI DokanOpenRequestorToken(PDOKAN_FILE_INFO DokanFileInfo); /** * \brief Get active Dokan mount points. * * Returned array needs to be released by calling * \ref DokanReleaseMountPointList. When no matching mount points exist, this * function returns a valid non-NULL allocation with \c *nbRead set to 0, which * must still be released with \ref DokanReleaseMountPointList. * * \param uncOnly Get only instances that have UNC Name. * \param nbRead Number of instances successfully retrieved. * \return Allocated array of DOKAN_MOUNT_POINT_INFO (possibly with * \c *nbRead == 0 when empty), or \c NULL on error. */ PDOKAN_MOUNT_POINT_INFO DOKANAPI DokanGetMountPointList(BOOL uncOnly, PULONG nbRead); /** * \brief Release Mount point list resources from \ref DokanGetMountPointList. * * After \ref 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. * * \param list Allocated array of DOKAN_MOUNT_POINT_INFO from \ref * DokanGetMountPointList. */ VOID DOKANAPI DokanReleaseMountPointList(PDOKAN_MOUNT_POINT_INFO list); /** * \brief Convert \ref 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 * * \param DesiredAccess DesiredAccess from \ref DOKAN_OPERATIONS.ZwCreateFile. * \param FileAttributes FileAttributes from \ref DOKAN_OPERATIONS.ZwCreateFile. * \param CreateOptions CreateOptions from \ref DOKAN_OPERATIONS.ZwCreateFile. * \param CreateDisposition CreateDisposition from \ref DOKAN_OPERATIONS.ZwCreateFile. * \param outDesiredAccess New CreateFile dwDesiredAccess. * \param outFileAttributesAndFlags New CreateFile dwFlagsAndAttributes. * \param outCreationDisposition New CreateFile dwCreationDisposition. * \see CreateFile function (MSDN) */ VOID DOKANAPI DokanMapKernelToUserCreateFileFlags( ACCESS_MASK DesiredAccess, ULONG FileAttributes, ULONG CreateOptions, ULONG CreateDisposition, ACCESS_MASK *outDesiredAccess, DWORD *outFileAttributesAndFlags, DWORD *outCreationDisposition); /** * \defgroup DokanNotify Dokan Notify * \brief Dokan User FS file-change notification * * The application implementing the user file system can notify * the Dokan kernel driver of external file- and directory-changes. * * For example, the mirror application can notify the driver about * changes made in the mirrored directory so that those changes will * be automatically reflected in the implemented mirror file system. * * The FilePath passed to the respective DokanNotify* functions must be an * absolute path targeting the mounted volume. Supported path forms are * drive-letter paths (e.g. `M:\ChangedFile.txt`), NTFS directory mount point * paths (e.g. `C:\Dokan\ChangedFile.txt`), UNC paths (e.g. * `\\server\share\ChangedFile.txt`), and Win32 extended-length paths * (`\\?\...` and `\\?\UNC\...`). Mount prefix matching is case-insensitive * using Windows ordinal comparison, and redundant trailing backslashes are * normalized. * * These functions SHOULD NOT be called from within the implemented * file system and thus be independent of any Dokan file system operation. * @{ */ /** * \brief Notify dokan that a file or a directory has been created. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param FilePath Absolute path to the file or directory, including the mount-point of the file system. * \param IsDirectory Indicates if the path is a directory. * \return \c TRUE if notification succeeded. */ BOOL DOKANAPI DokanNotifyCreate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory); /** * \brief Notify dokan that a file or a directory has been deleted. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param FilePath Absolute path to the file or directory, including the mount-point of the file system. * \param IsDirectory Indicates if the path was a directory. * \return \c TRUE if notification succeeded. */ BOOL DOKANAPI DokanNotifyDelete(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath, _In_ BOOL IsDirectory); /** * \brief Notify dokan that file or directory attributes have changed. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param FilePath Absolute path to the file or directory, including the mount-point of the file system. * \return \c TRUE if notification succeeded. */ BOOL DOKANAPI DokanNotifyUpdate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath); /** * \brief Notify dokan that file or directory extended attributes have changed. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param FilePath Absolute path to the file or directory, including the mount-point of the file system. * \return \c TRUE if notification succeeded. */ BOOL DOKANAPI DokanNotifyXAttrUpdate(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR FilePath); /** * \brief Notify dokan that a file or a directory has been renamed. This method * supports in-place rename for file/directory within the same parent. * * \param DokanInstance The dokan mount context created by \ref DokanCreateFileSystem . * \param OldPath Old, absolute path to the file or directory, including the mount-point of the file system. * \param NewPath New, absolute path to the file or directory, including the mount-point of the file system. * \param IsDirectory Indicates if the path is a directory. * \param IsInSameDirectory Indicates if the file or directory have the same parent directory. * \return \c TRUE if notification succeeded. */ BOOL DOKANAPI DokanNotifyRename(_In_ DOKAN_HANDLE DokanInstance, _In_ LPCWSTR OldPath, _In_ LPCWSTR NewPath, _In_ BOOL IsDirectory, _In_ BOOL IsInSameDirectory); /**@}*/ /** * \brief Convert WIN32 error to NTSTATUS * * https://support.microsoft.com/en-us/kb/113996 * * \param Error Win32 Error to convert * \return NTSTATUS associate to the ERROR. */ NTSTATUS DOKANAPI DokanNtStatusFromWin32(DWORD Error); /** @} */ #ifdef __cplusplus } #endif #endif // DOKAN_H_