[FLTMGR]
[reactos.git] / reactos / drivers / filters / fltmgr / fltmgr.h
1 #ifndef _FLTMGR_H
2 #define _FLTMGR_H
3
4 // Hack - our SDK reports NTDDI_VERSION as 0x05020100 (from _WIN32_WINNT 0x502)
5 // which doesn't pass the FLT_MGR_BASELINE check in fltkernel.h
6 #define NTDDI_VERSION NTDDI_WS03SP1
7
8 #include <ntifs.h>
9 #include <fltkernel.h>
10 #include <pseh/pseh2.h>
11
12 #define DRIVER_NAME L"RosFltMgr"
13
14 #define FLT_MAJOR_VERSION 0x02
15 #define FLT_MINOR_VERSION 0x00 //win2k3
16
17 #define FM_TAG_DISPATCH_TABLE 'ifMF'
18 #define FM_TAG_REGISTRY_DATA 'rtMF'
19 #define FM_TAG_DEV_OBJ_PTRS 'ldMF'
20 #define FM_TAG_UNICODE_STRING 'suMF'
21 #define FM_TAG_FILTER 'lfMF'
22
23
24 typedef struct _DRIVER_DATA
25 {
26 PDRIVER_OBJECT DriverObject;
27 PDEVICE_OBJECT DeviceObject;
28 UNICODE_STRING ServiceKey;
29
30 PFAST_IO_DISPATCH FastIoDispatch;
31
32 FAST_MUTEX FilterAttachLock;
33
34 } DRIVER_DATA, *PDRIVER_DATA;
35
36
37 typedef enum _FLT_OBJECT_FLAGS
38 {
39 FLT_OBFL_DRAINING = 1,
40 FLT_OBFL_ZOMBIED = 2,
41 FLT_OBFL_TYPE_INSTANCE = 0x1000000,
42 FLT_OBFL_TYPE_FILTER = 0x2000000,
43 FLT_OBFL_TYPE_VOLUME = 0x4000000
44
45 } FLT_OBJECT_FLAGS, *PFLT_OBJECT_FLAGS;
46
47 typedef enum _FLT_FILTER_FLAGS
48 {
49 FLTFL_MANDATORY_UNLOAD_IN_PROGRESS = 1,
50 FLTFL_FILTERING_INITIATED = 2
51
52 } FLT_FILTER_FLAGS, *PFLT_FILTER_FLAGS;
53
54 typedef struct _FLT_OBJECT // size = 0x14
55 {
56 volatile FLT_OBJECT_FLAGS Flags;
57 ULONG PointerCount;
58 EX_RUNDOWN_REF RundownRef;
59 LIST_ENTRY PrimaryLink;
60
61 } FLT_OBJECT, *PFLT_OBJECT;
62
63 typedef struct _FLT_RESOURCE_LIST_HEAD
64 {
65 ERESOURCE rLock;
66 LIST_ENTRY rList;
67 ULONG rCount;
68
69 } FLT_RESOURCE_LIST_HEAD, *PFLT_RESOURCE_LIST_HEAD;
70
71 typedef struct _FLT_MUTEX_LIST_HEAD
72 {
73 FAST_MUTEX mLock;
74 LIST_ENTRY mList;
75 ULONG mCount;
76
77 } FLT_MUTEX_LIST_HEAD, *PFLT_MUTEX_LIST_HEAD;
78
79 typedef struct _FLT_FILTER // size = 0x120
80 {
81 FLT_OBJECT Base;
82 PVOID Frame; //FLTP_FRAME
83 UNICODE_STRING Name;
84 UNICODE_STRING DefaultAltitude;
85 FLT_FILTER_FLAGS Flags;
86 PDRIVER_OBJECT DriverObject;
87 FLT_RESOURCE_LIST_HEAD InstanceList;
88 PVOID VerifierExtension;
89 PFLT_FILTER_UNLOAD_CALLBACK FilterUnload;
90 PFLT_INSTANCE_SETUP_CALLBACK InstanceSetup;
91 PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK InstanceQueryTeardown;
92 PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownStart;
93 PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownComplete;
94 PVOID SupportedContextsListHead; //PALLOCATE_CONTEXT_HEADER
95 PVOID SupportedContexts; //PALLOCATE_CONTEXT_HEADER
96 PVOID PreVolumeMount;
97 PVOID PostVolumeMount;
98 PFLT_GENERATE_FILE_NAME GenerateFileName;
99 PFLT_NORMALIZE_NAME_COMPONENT NormalizeNameComponent;
100 PFLT_NORMALIZE_CONTEXT_CLEANUP NormalizeContextCleanup;
101 PFLT_OPERATION_REGISTRATION Operations;
102 PFLT_FILTER_UNLOAD_CALLBACK OldDriverUnload;
103 FLT_MUTEX_LIST_HEAD ActiveOpens;
104 FLT_MUTEX_LIST_HEAD PortList;
105 EX_PUSH_LOCK PortLock;
106
107 } FLT_FILTER, *PFLT_FILTER;
108
109 typedef enum _FLT_INSTANCE_FLAGS
110 {
111 INSFL_CAN_BE_DETACHED = 0x01,
112 INSFL_DELETING = 0x02,
113 INSFL_INITING = 0x04
114
115 } FLT_INSTANCE_FLAGS, *PFLT_INSTANCE_FLAGS;
116
117 typedef struct _FLT_INSTANCE // size = 0x144
118 {
119 FLT_OBJECT Base;
120 ULONG OperationRundownRef;
121 PVOID Volume; //PFLT_VOLUME
122 PFLT_FILTER Filter;
123 FLT_INSTANCE_FLAGS Flags;
124 UNICODE_STRING Altitude;
125 UNICODE_STRING Name;
126 LIST_ENTRY FilterLink;
127 ERESOURCE ContextLock;
128 PVOID Context;
129 PVOID TrackCompletionNodes;
130 PVOID CallbackNodes;
131
132 } FLT_INSTANCE, *PFLT_INSTANCE;
133
134
135
136
137
138 VOID
139 FltpExInitializeRundownProtection(
140 _Out_ PEX_RUNDOWN_REF RundownRef
141 );
142
143 BOOLEAN
144 FltpExAcquireRundownProtection(
145 _Inout_ PEX_RUNDOWN_REF RundownRef
146 );
147
148 BOOLEAN
149 FltpExReleaseRundownProtection(
150 _Inout_ PEX_RUNDOWN_REF RundownRef
151 );
152
153 NTSTATUS
154 NTAPI
155 FltpObjectRundownWait(
156 _Inout_ PEX_RUNDOWN_REF RundownRef
157 );
158
159 BOOLEAN
160 FltpExRundownCompleted(
161 _Inout_ PEX_RUNDOWN_REF RundownRef
162 );
163
164 /////////// FIXME: put these into the correct header
165 NTSTATUS
166 FltpGetBaseDeviceObjectName(_In_ PDEVICE_OBJECT DeviceObject,
167 _Inout_ PUNICODE_STRING ObjectName);
168
169 NTSTATUS
170 FltpGetObjectName(_In_ PVOID Object,
171 _Inout_ PUNICODE_STRING ObjectName);
172
173 NTSTATUS
174 FltpReallocateUnicodeString(_In_ PUNICODE_STRING String,
175 _In_ SIZE_T NewLength,
176 _In_ BOOLEAN CopyExisting);
177
178 VOID
179 FltpFreeUnicodeString(_In_ PUNICODE_STRING String);
180 ////////////////////////////////////////////////
181
182
183
184
185
186
187
188
189
190
191
192
193 //FM ? ? -fltmgr.sys - Unrecognized FltMgr tag(update pooltag.w)
194 //FMac - fltmgr.sys - ASCII String buffers
195 //FMas - fltmgr.sys - ASYNC_IO_COMPLETION_CONTEXT structure
196 //FMcb - fltmgr.sys - FLT_CCB structure
197 //FMcr - fltmgr.sys - Context registration structures
198 //FMct - fltmgr.sys - TRACK_COMPLETION_NODES structure
199 //FMdl - fltmgr.sys - Array of DEVICE_OBJECT pointers
200 //FMea - fltmgr.sys - EA buffer for create
201 //FMfc - fltmgr.sys - FLTMGR_FILE_OBJECT_CONTEXT structure
202 //FMfi - fltmgr.sys - Fast IO dispatch table
203 //FMfk - fltmgr.sys - Byte Range Lock structure
204 //FMfl - fltmgr.sys - FLT_FILTER structure
205 //FMfn - fltmgr.sys - NAME_CACHE_NODE structure
206 //FMfr - fltmgr.sys - FLT_FRAME structure
207 //FMfz - fltmgr.sys - FILE_LIST_CTRL structure
208 //FMib - fltmgr.sys - Irp SYSTEM buffers
209 //FMic - fltmgr.sys - IRP_CTRL structure
210 //FMin - fltmgr.sys - FLT_INSTANCE name
211 //FMil - fltmgr.sys - IRP_CTRL completion node stack
212 //FMis - fltmgr.sys - FLT_INSTANCE structure
213 //FMla - fltmgr.sys - Per - processor IRPCTRL lookaside lists
214 //FMnc - fltmgr.sys - NAME_CACHE_CREATE_CTRL structure
215 //FMng - fltmgr.sys - NAME_GENERATION_CONTEXT structure
216 //FMol - fltmgr.sys - OPLOCK_CONTEXT structure
217 //FMos - fltmgr.sys - Operation status ctrl structure
218 //FMpl - fltmgr.sys - Cache aware pushLock
219 //FMpr - fltmgr.sys - FLT_PRCB structure
220 //FMrl - fltmgr.sys - FLT_OBJECT rundown logs
221 //FMrp - fltmgr.sys - Reparse point data buffer
222 //FMrr - fltmgr.sys - Per - processor Cache - aware rundown ref structure
223 //FMsd - fltmgr.sys - Security descriptors
224 //FMsl - fltmgr.sys - STREAM_LIST_CTRL structure
225 //FMtn - fltmgr.sys - Temporary file names
226 //FMtr - fltmgr.sys - Temporary Registry information
227 //FMts - fltmgr.sys - Tree Stack
228 //FMus - fltmgr.sys - Unicode string
229 //FMvf - fltmgr.sys - FLT_VERIFIER_EXTENSION structure
230 //FMvj - fltmgr.sys - FLT_VERIFIER_OBJECT structure
231 //FMvo - fltmgr.sys - FLT_VOLUME structure
232 //FMwi - fltmgr.sys - Work item structures
233 //FMcn - fltmgr.sys - Non paged context extension structures.
234 //FMtp - fltmgr.sys - Non Paged tx vol context structures.
235 //FMlp - fltmgr.sys - Paged stream list control entry structures.
236
237
238
239
240 /*
241 FltAcquirePushLockExclusive
242 FltAcquirePushLockShared
243 FltAcquireResourceExclusive
244 FltAcquireResourceShared
245 FltAllocateCallbackData
246 FltAllocateContext
247 FltAllocateDeferredIoWorkItem
248 FltAllocateFileLock
249 FltAllocateGenericWorkItem
250 FltAllocatePoolAlignedWithTag
251 FltAttachVolume
252 FltAttachVolumeAtAltitude
253 FltBuildDefaultSecurityDescriptor
254 FltCancelFileOpen
255 FltCancelIo
256 FltCbdqDisable
257 FltCbdqEnable
258 FltCbdqInitialize
259 FltCbdqInsertIo
260 FltCbdqRemoveIo
261 FltCbdqRemoveNextIo
262 FltCheckAndGrowNameControl
263 FltCheckLockForReadAccess
264 FltCheckLockForWriteAccess
265 FltCheckOplock
266 FltClearCallbackDataDirty
267 FltClearCancelCompletion
268 FltClose
269 FltCloseClientPort
270 FltCloseCommunicationPort
271 FltCompareInstanceAltitudes
272 FltCompletePendedPostOperation
273 FltCompletePendedPreOperation
274 FltCreateCommunicationPort
275 FltCreateFile
276 FltCreateFileEx
277 FltCreateSystemVolumeInformationFolder
278 FltCurrentBatchOplock
279 FltDecodeParameters
280 FltDeleteContext
281 FltDeleteFileContext
282 FltDeleteInstanceContext
283 FltDeletePushLock
284 FltDeleteStreamContext
285 FltDeleteStreamHandleContext
286 FltDeleteVolumeContext
287 FltDetachVolume
288 FltDeviceIoControlFile
289 FltDoCompletionProcessingWhenSafe
290 FltEnumerateFilterInformation
291 FltEnumerateFilters
292 FltEnumerateInstanceInformationByFilter
293 FltEnumerateInstanceInformationByVolume
294 FltEnumerateInstances
295 FltEnumerateVolumeInformation
296 FltEnumerateVolumes
297 FltFlushBuffers
298 FltFreeCallbackData
299 FltFreeDeferredIoWorkItem
300 FltFreeFileLock
301 FltFreeGenericWorkItem
302 FltFreePoolAlignedWithTag
303 FltFreeSecurityDescriptor
304 FltFsControlFile
305 FltGetBottomInstance
306 FltGetContexts
307 FltGetDestinationFileNameInformation
308 FltGetDeviceObject
309 FltGetDiskDeviceObject
310 FltGetFileContext
311 FltGetFileNameInformation
312 FltGetFileNameInformationUnsafe
313 FltGetFilterFromInstance
314 FltGetFilterFromName
315 FltGetFilterInformation
316 FltGetInstanceContext
317 FltGetInstanceInformation
318 FltGetIrpName
319 FltGetLowerInstance
320 FltGetRequestorProcess
321 FltGetRequestorProcessId
322 FltGetRoutineAddress
323 FltGetStreamContext
324 FltGetStreamHandleContext
325 FltGetSwappedBufferMdlAddress
326 FltGetTopInstance
327 FltGetTunneledName
328 FltGetUpperInstance
329 FltGetVolumeContext
330 FltGetVolumeFromDeviceObject
331 FltGetVolumeFromFileObject
332 FltGetVolumeFromInstance
333 FltGetVolumeFromName
334 FltGetVolumeGuidName
335 FltGetVolumeInstanceFromName
336 FltGetVolumeName
337 FltGetVolumeProperties
338 FltInitializeFileLock
339 FltInitializeOplock
340 FltInitializePushLock
341 FltIs32bitProcess
342 FltIsCallbackDataDirty
343 FltIsDirectory
344 FltIsIoCanceled
345 FltIsOperationSynchronous
346 FltIsVolumeWritable
347 FltLoadFilter
348 FltLockUserBuffer
349 FltNotifyFilterChangeDirectory
350 FltObjectDereference
351 FltObjectReference
352 FltOpenVolume
353 FltOplockFsctrl
354 FltOplockIsFastIoPossible
355 FltParseFileName
356 FltParseFileNameInformation
357 FltPerformAsynchronousIo
358 FltPerformSynchronousIo
359 FltProcessFileLock
360 FltPurgeFileNameInformationCache
361 FltQueryEaFile
362 FltQueryInformationFile
363 FltQuerySecurityObject
364 FltQueryVolumeInformation
365 FltQueryVolumeInformationFile
366 FltQueueDeferredIoWorkItem
367 FltQueueGenericWorkItem
368 FltReadFile
369 FltReferenceContext
370 FltReferenceFileNameInformation
371 FltRegisterFilter
372 FltReissueSynchronousIo
373 FltReleaseContext
374 FltReleaseContexts
375 FltReleaseFileNameInformation
376 FltReleasePushLock
377 FltReleaseResource
378 FltRequestOperationStatusCallback
379 FltRetainSwappedBufferMdlAddress
380 FltReuseCallbackData
381 FltSendMessage
382 FltSetCallbackDataDirty
383 FltSetCancelCompletion
384 FltSetEaFile
385 FltSetFileContext
386 FltSetInformationFile
387 FltSetInstanceContext
388 FltSetSecurityObject
389 FltSetStreamContext
390 FltSetStreamHandleContext
391 FltSetVolumeContext
392 FltSetVolumeInformation
393 FltStartFiltering
394 FltSupportsFileContexts
395 FltSupportsStreamContexts
396 FltSupportsStreamHandleContexts
397 FltTagFile
398 FltUninitializeFileLock
399 FltUninitializeOplock
400 FltUnloadFilter
401 FltUnregisterFilter
402 FltUntagFile
403 FltWriteFile
404 */
405
406
407
408
409 #endif /* _FLTMGR_H */