Dokan 3.0.0
User mode file system library for windows with FUSE Wrapper
Loading...
Searching...
No Matches
dokani.h
1/*
2 Dokan : user-mode file system library for Windows
3
4 Copyright (C) 2020 - 2025 Google, Inc.
5 Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
6 Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
7
8 http://dokan-dev.github.io
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free
12Software Foundation; either version 3 of the License, or (at your option) any
13later version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT ANY
16WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along
20with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#ifndef DOKANI_H_
24#define DOKANI_H_
25
26#define WIN32_NO_STATUS
27#include <windows.h>
28#undef WIN32_NO_STATUS
29#include <stdio.h>
30
31#include "dokan.h"
32#include "dokanc.h"
33#include "list.h"
34#include "dokan_vector.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40typedef struct _DOKAN_INSTANCE_THREADINFO {
41 PTP_POOL ThreadPool;
42 PTP_CLEANUP_GROUP CleanupGroup;
43 TP_CALLBACK_ENVIRON CallbackEnvironment;
45
55typedef struct _DOKAN_INSTANCE {
57 CRITICAL_SECTION CriticalSection;
62 WCHAR DeviceName[64];
64 WCHAR MountPoint[MAX_PATH];
66 WCHAR UNCName[64];
70 ULONG MountId;
72 PDOKAN_OPTIONS DokanOptions;
74 PDOKAN_OPERATIONS DokanOperations;
76 LIST_ENTRY ListEntry;
80 HANDLE Device;
96} DOKAN_INSTANCE, *PDOKAN_INSTANCE;
97
104typedef struct _DOKAN_OPEN_INFO {
105 CRITICAL_SECTION CriticalSection;
107 PDOKAN_INSTANCE DokanInstance;
108 PDOKAN_VECTOR DirList;
109 PWCHAR DirListSearchPattern;
115 ULONG EventId;
122 LONG64 CloseUserContext;
124 PEVENT_CONTEXT EventContext;
125} DOKAN_OPEN_INFO, *PDOKAN_OPEN_INFO;
126
138typedef struct _DOKAN_IO_BATCH {
140 PDOKAN_INSTANCE DokanInstance;
161 EVENT_CONTEXT EventContext[1];
162} DOKAN_IO_BATCH, *PDOKAN_IO_BATCH;
163
171typedef struct _DOKAN_IO_EVENT {
173 PDOKAN_INSTANCE DokanInstance;
175 PDOKAN_OPEN_INFO DokanOpenInfo;
180 PEVENT_INFORMATION EventResult;
191 PEVENT_CONTEXT EventContext;
196 PDOKAN_IO_BATCH IoBatch;
197} DOKAN_IO_EVENT, *PDOKAN_IO_EVENT;
198
199#define IOEVENT_RESULT_BUFFER_SIZE(ioEvent) \
200 ((ioEvent)->EventResultSize >= offsetof(EVENT_INFORMATION, Buffer) \
201 ? (ioEvent)->EventResultSize - offsetof(EVENT_INFORMATION, Buffer) \
202 : 0)
203
204
205int DokanStart(_In_ PDOKAN_INSTANCE DokanInstance);
206
207BOOL SendToDevice(LPCWSTR DeviceName, DWORD IoControlCode, PVOID InputBuffer,
208 ULONG InputLength, PVOID OutputBuffer, ULONG OutputLength,
209 PULONG ReturnedLength);
210
211VOID
212GetRawDeviceName(LPCWSTR DeviceName, LPWSTR DestinationBuffer,
213 rsize_t DestinationBufferSizeInElements);
214
215VOID ALIGN_ALLOCATION_SIZE(PLARGE_INTEGER size, PDOKAN_OPTIONS DokanOptions);
216
217BOOL DokanMount(PDOKAN_INSTANCE DokanInstance,
218 PDOKAN_OPTIONS DokanOptions);
219
220BOOL IsMountPointDriveLetter(LPCWSTR mountPoint);
221
222VOID EventCompletion(PDOKAN_IO_EVENT EventInfo);
223
224VOID CreateDispatchCommon(PDOKAN_IO_EVENT IoEvent, ULONG SizeOfEventInfo,
225 BOOL UseExtraMemoryPool, BOOL ClearNonPoolBuffer);
226
227VOID DispatchDirectoryInformation(PDOKAN_IO_EVENT IoEvent);
228
229VOID DispatchQueryInformation(PDOKAN_IO_EVENT IoEvent);
230
231VOID DispatchQueryVolumeInformation(PDOKAN_IO_EVENT IoEvent);
232
233VOID DispatchSetInformation(PDOKAN_IO_EVENT IoEvent);
234
235VOID DispatchRead(PDOKAN_IO_EVENT IoEvent);
236
237VOID DispatchWrite(PDOKAN_IO_EVENT IoEvent);
238
239VOID DispatchCreate(PDOKAN_IO_EVENT IoEvent);
240
241VOID DispatchClose(PDOKAN_IO_EVENT IoEvent);
242
243VOID DispatchCleanup(PDOKAN_IO_EVENT IoEvent);
244
245VOID DispatchFlush(PDOKAN_IO_EVENT IoEvent);
246
247VOID DispatchLock(PDOKAN_IO_EVENT IoEvent);
248
249VOID DispatchQuerySecurity(PDOKAN_IO_EVENT IoEvent);
250
251VOID DispatchSetSecurity(PDOKAN_IO_EVENT IoEvent);
252
253BOOL SendReleaseIRP(LPCWSTR DeviceName);
254
255BOOL SendGlobalReleaseIRP(LPCWSTR MountPoint);
256
257VOID CheckFileName(LPWSTR FileName);
258
259VOID ReleaseDokanOpenInfo(PDOKAN_IO_EVENT IoEvent);
260
261VOID DokanNotifyUnmounted(PDOKAN_INSTANCE DokanInstance);
262
263#ifdef __cplusplus
264}
265#endif
266
267#endif // DOKANI_H_
Dokan file information on the current operation.
Definition dokan.h:181
Definition dokani.h:40
Dokan mount instance informations.
Definition dokani.h:55
BOOL FileSystemStopped
Definition dokani.h:90
LIST_ENTRY ListEntry
Definition dokani.h:76
LONG UnmountedCalled
Definition dokani.h:95
HANDLE KeepaliveHandle
Definition dokani.h:88
WCHAR UNCName[64]
Definition dokani.h:66
PDOKAN_OPTIONS DokanOptions
Definition dokani.h:72
CRITICAL_SECTION CriticalSection
Definition dokani.h:57
ULONG DeviceNumber
Definition dokani.h:68
DOKAN_INSTANCE_THREADINFO ThreadInfo
Definition dokani.h:84
HANDLE Device
Definition dokani.h:80
HANDLE GlobalDevice
Definition dokani.h:78
HANDLE NotifyHandle
Definition dokani.h:86
WCHAR MountPoint[MAX_PATH]
Definition dokani.h:64
WCHAR DeviceName[64]
Definition dokani.h:62
PDOKAN_OPERATIONS DokanOperations
Definition dokani.h:74
HANDLE DeviceClosedWaitHandle
Definition dokani.h:82
ULONG MountId
Definition dokani.h:70
Dokan IO batch buffer.
Definition dokani.h:138
BOOL MainPullThread
Definition dokani.h:144
BOOL PoolAllocated
Definition dokani.h:149
DWORD NumberOfBytesTransferred
Definition dokani.h:142
LONG EventContextBatchCount
Definition dokani.h:155
PDOKAN_INSTANCE DokanInstance
Definition dokani.h:140
EVENT_CONTEXT EventContext[1]
Definition dokani.h:161
Dokan IO Event.
Definition dokani.h:171
PDOKAN_INSTANCE DokanInstance
Definition dokani.h:173
BOOL PoolAllocated
Definition dokani.h:187
PDOKAN_OPEN_INFO DokanOpenInfo
Definition dokani.h:175
PEVENT_INFORMATION EventResult
Definition dokani.h:180
PEVENT_CONTEXT EventContext
Definition dokani.h:191
ULONG EventResultSize
Definition dokani.h:182
PDOKAN_IO_BATCH IoBatch
Definition dokani.h:196
DOKAN_FILE_INFO DokanFileInfo
Definition dokani.h:189
Dokan open file informations.
Definition dokani.h:104
LPWSTR CloseFileName
Definition dokani.h:121
ULONG OpenCount
Definition dokani.h:119
BOOLEAN UnimplementedFindFilesWithPattern
Definition dokani.h:111
LONG64 UserContext
Definition dokani.h:113
BOOL IsDirectory
Definition dokani.h:117
ULONG EventId
Definition dokani.h:115
PEVENT_CONTEXT EventContext
Definition dokani.h:124
PDOKAN_INSTANCE DokanInstance
Definition dokani.h:107