[RXCE]
[reactos.git] / reactos / sdk / include / ddk / mrx.h
1 #ifndef _RXMINIRDR_
2 #define _RXMINIRDR_
3
4 #define RxShouldPostCompletion() ((KeGetCurrentIrql() >= DISPATCH_LEVEL))
5
6 #define RX_REGISTERMINI_FLAG_DONT_PROVIDE_UNCS 0x00000001
7 #define RX_REGISTERMINI_FLAG_DONT_PROVIDE_MAILSLOTS 0x00000002
8 #define RX_REGISTERMINI_FLAG_DONT_INIT_DRIVER_DISPATCH 0x00000004
9 #define RX_REGISTERMINI_FLAG_DONT_INIT_PREFIX_N_SCAVENGER 0x00000008
10
11 NTSTATUS
12 NTAPI
13 RxRegisterMinirdr(
14 _Out_ PRDBSS_DEVICE_OBJECT *DeviceObject,
15 _Inout_ PDRIVER_OBJECT DriverObject,
16 _In_ PMINIRDR_DISPATCH MrdrDispatch,
17 _In_ ULONG Controls,
18 _In_ PUNICODE_STRING DeviceName,
19 _In_ ULONG DeviceExtensionSize,
20 _In_ DEVICE_TYPE DeviceType,
21 _In_ ULONG DeviceCharacteristics);
22
23 VOID
24 NTAPI
25 RxpUnregisterMinirdr(
26 _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject);
27
28 NTSTATUS
29 NTAPI
30 RxStartMinirdr(
31 _In_ PRX_CONTEXT RxContext,
32 _Out_ PBOOLEAN PostToFsp);
33
34 NTSTATUS
35 NTAPI
36 RxStopMinirdr(
37 _In_ PRX_CONTEXT RxContext,
38 _Out_ PBOOLEAN PostToFsp);
39
40 NTSTATUS
41 NTAPI
42 RxFsdDispatch(
43 _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject,
44 _In_ PIRP Irp);
45
46 typedef
47 NTSTATUS
48 (NTAPI *PMRX_CALLDOWN) (
49 _Inout_ PRX_CONTEXT RxContext);
50
51 typedef
52 NTSTATUS
53 (NTAPI *PMRX_CALLDOWN_CTX) (
54 _Inout_ PRX_CONTEXT RxContext,
55 _Inout_ PRDBSS_DEVICE_OBJECT RxDeviceObject);
56
57 typedef
58 NTSTATUS
59 (NTAPI *PMRX_CHKDIR_CALLDOWN) (
60 _Inout_ PRX_CONTEXT RxContext,
61 _In_ PUNICODE_STRING DirectoryName);
62
63 typedef
64 NTSTATUS
65 (NTAPI *PMRX_CHKFCB_CALLDOWN) (
66 _In_ PFCB Fcb1,
67 _In_ PFCB Fcb2);
68
69 typedef enum _RX_BLOCK_CONDITION {
70 Condition_Uninitialized = 0,
71 Condition_InTransition,
72 Condition_Closing,
73 Condition_Good,
74 Condition_Bad,
75 Condition_Closed
76 } RX_BLOCK_CONDITION, *PRX_BLOCK_CONDITION;
77
78 #define StableCondition(X) ((X) >= Condition_Good)
79
80 typedef
81 VOID
82 (NTAPI *PMRX_NETROOT_CALLBACK) (
83 _Inout_ PMRX_CREATENETROOT_CONTEXT CreateContext);
84
85 typedef
86 VOID
87 (NTAPI *PMRX_EXTRACT_NETROOT_NAME) (
88 _In_ PUNICODE_STRING FilePathName,
89 _In_ PMRX_SRV_CALL SrvCall,
90 _Out_ PUNICODE_STRING NetRootName,
91 _Out_opt_ PUNICODE_STRING RestOfName);
92
93 typedef struct _MRX_CREATENETROOT_CONTEXT
94 {
95 PRX_CONTEXT RxContext;
96 PV_NET_ROOT pVNetRoot;
97 KEVENT FinishEvent;
98 NTSTATUS VirtualNetRootStatus;
99 NTSTATUS NetRootStatus;
100 RX_WORK_QUEUE_ITEM WorkQueueItem;
101 PMRX_NETROOT_CALLBACK Callback;
102 } MRX_CREATENETROOT_CONTEXT, *PMRX_CREATENETROOT_CONTEXT;
103
104 typedef
105 NTSTATUS
106 (NTAPI *PMRX_CREATE_V_NET_ROOT) (
107 _Inout_ PMRX_CREATENETROOT_CONTEXT Context);
108
109 typedef
110 NTSTATUS
111 (NTAPI *PMRX_UPDATE_NETROOT_STATE) (
112 _Inout_ PMRX_NET_ROOT NetRoot);
113
114 typedef struct _MRX_SRVCALL_CALLBACK_CONTEXT
115 {
116 PMRX_SRVCALLDOWN_STRUCTURE SrvCalldownStructure;
117 ULONG CallbackContextOrdinal;
118 PRDBSS_DEVICE_OBJECT RxDeviceObject;
119 NTSTATUS Status;
120 PVOID RecommunicateContext;
121 } MRX_SRVCALL_CALLBACK_CONTEXT, *PMRX_SRVCALL_CALLBACK_CONTEXT;
122
123 typedef
124 VOID
125 (NTAPI *PMRX_SRVCALL_CALLBACK) (
126 _Inout_ PMRX_SRVCALL_CALLBACK_CONTEXT Context);
127
128 typedef struct _MRX_SRVCALLDOWN_STRUCTURE
129 {
130 KEVENT FinishEvent;
131 LIST_ENTRY SrvCalldownList;
132 PRX_CONTEXT RxContext;
133 PMRX_SRV_CALL SrvCall;
134 PMRX_SRVCALL_CALLBACK CallBack;
135 BOOLEAN CalldownCancelled;
136 ULONG NumberRemaining;
137 ULONG NumberToWait;
138 ULONG BestFinisherOrdinal;
139 PRDBSS_DEVICE_OBJECT BestFinisher;
140 MRX_SRVCALL_CALLBACK_CONTEXT CallbackContexts[1];
141 } MRX_SRVCALLDOWN_STRUCTURE, *PMRX_SRVCALLDOWN_STRUCTURE;
142
143 typedef
144 NTSTATUS
145 (NTAPI *PMRX_CREATE_SRVCALL) (
146 _Inout_ PMRX_SRV_CALL SrvCall,
147 _Inout_ PMRX_SRVCALL_CALLBACK_CONTEXT SrvCallCallBackContext);
148
149 typedef
150 NTSTATUS
151 (NTAPI *PMRX_SRVCALL_WINNER_NOTIFY)(
152 _Inout_ PMRX_SRV_CALL SrvCall,
153 _In_ BOOLEAN ThisMinirdrIsTheWinner,
154 _Inout_ PVOID RecommunicateContext);
155
156 typedef
157 NTSTATUS
158 (NTAPI *PMRX_DEALLOCATE_FOR_FCB) (
159 _Inout_ PMRX_FCB Fcb);
160
161 typedef
162 NTSTATUS
163 (NTAPI *PMRX_DEALLOCATE_FOR_FOBX) (
164 _Inout_ PMRX_FOBX Fobx);
165
166 typedef
167 NTSTATUS
168 (NTAPI *PMRX_IS_LOCK_REALIZABLE) (
169 _Inout_ PMRX_FCB Fcb,
170 _In_ PLARGE_INTEGER ByteOffset,
171 _In_ PLARGE_INTEGER Length,
172 _In_ ULONG LowIoLockFlags);
173
174 typedef
175 NTSTATUS
176 (NTAPI *PMRX_FORCECLOSED_CALLDOWN) (
177 _Inout_ PMRX_SRV_OPEN SrvOpen);
178
179 typedef
180 NTSTATUS
181 (NTAPI *PMRX_FINALIZE_SRVCALL_CALLDOWN) (
182 _Inout_ PMRX_SRV_CALL SrvCall,
183 _In_ BOOLEAN Force);
184
185 typedef
186 NTSTATUS
187 (NTAPI *PMRX_FINALIZE_V_NET_ROOT_CALLDOWN) (
188 _Inout_ PMRX_V_NET_ROOT VirtualNetRoot,
189 _In_ PBOOLEAN Force);
190
191 typedef
192 NTSTATUS
193 (NTAPI *PMRX_FINALIZE_NET_ROOT_CALLDOWN) (
194 _Inout_ PMRX_NET_ROOT NetRoot,
195 _In_ PBOOLEAN Force);
196
197 typedef
198 ULONG
199 (NTAPI *PMRX_EXTENDFILE_CALLDOWN) (
200 _Inout_ PRX_CONTEXT RxContext,
201 _Inout_ PLARGE_INTEGER NewFileSize,
202 _Out_ PLARGE_INTEGER NewAllocationSize);
203
204 typedef
205 NTSTATUS
206 (NTAPI *PMRX_CHANGE_BUFFERING_STATE_CALLDOWN) (
207 _Inout_ PRX_CONTEXT RxContext,
208 _Inout_ PMRX_SRV_OPEN SrvOpen,
209 _In_ PVOID MRxContext);
210
211 typedef
212 NTSTATUS
213 (NTAPI *PMRX_PREPARSE_NAME) (
214 _Inout_ PRX_CONTEXT RxContext,
215 _In_ PUNICODE_STRING Name);
216
217 typedef
218 NTSTATUS
219 (NTAPI *PMRX_GET_CONNECTION_ID) (
220 _Inout_ PRX_CONTEXT RxContext,
221 _Inout_ PRX_CONNECTION_ID UniqueId);
222
223 typedef
224 NTSTATUS
225 (NTAPI *PMRX_COMPUTE_NEW_BUFFERING_STATE) (
226 _Inout_ PMRX_SRV_OPEN SrvOpen,
227 _In_ PVOID MRxContext,
228 _Out_ PULONG NewBufferingState);
229
230 typedef enum _LOWIO_OPS {
231 LOWIO_OP_READ = 0,
232 LOWIO_OP_WRITE,
233 LOWIO_OP_SHAREDLOCK,
234 LOWIO_OP_EXCLUSIVELOCK,
235 LOWIO_OP_UNLOCK,
236 LOWIO_OP_UNLOCK_MULTIPLE,
237 LOWIO_OP_FSCTL,
238 LOWIO_OP_IOCTL,
239 LOWIO_OP_NOTIFY_CHANGE_DIRECTORY,
240 LOWIO_OP_CLEAROUT,
241 LOWIO_OP_MAXIMUM
242 } LOWIO_OPS;
243
244 typedef
245 NTSTATUS
246 (NTAPI *PLOWIO_COMPLETION_ROUTINE) (
247 _In_ PRX_CONTEXT RxContext);
248
249 typedef LONGLONG RXVBO;
250
251 typedef struct _LOWIO_LOCK_LIST
252 {
253 struct _LOWIO_LOCK_LIST * Next;
254 ULONG LockNumber;
255 RXVBO ByteOffset;
256 LONGLONG Length;
257 BOOLEAN ExclusiveLock;
258 ULONG Key;
259 } LOWIO_LOCK_LIST, *PLOWIO_LOCK_LIST;
260
261 typedef struct _XXCTL_LOWIO_COMPONENT
262 {
263 ULONG Flags;
264 union
265 {
266 ULONG FsControlCode;
267 ULONG IoControlCode;
268 };
269 ULONG InputBufferLength;
270 PVOID pInputBuffer;
271 ULONG OutputBufferLength;
272 PVOID pOutputBuffer;
273 UCHAR MinorFunction;
274 } XXCTL_LOWIO_COMPONENT;
275
276 typedef struct _LOWIO_CONTEXT
277 {
278 USHORT Operation;
279 USHORT Flags;
280 PLOWIO_COMPLETION_ROUTINE CompletionRoutine;
281 PERESOURCE Resource;
282 ERESOURCE_THREAD ResourceThreadId;
283 union
284 {
285 struct
286 {
287 ULONG Flags;
288 PMDL Buffer;
289 RXVBO ByteOffset;
290 ULONG ByteCount;
291 ULONG Key;
292 PNON_PAGED_FCB NonPagedFcb;
293 } ReadWrite;
294 struct
295 {
296 union
297 {
298 PLOWIO_LOCK_LIST LockList;
299 LONGLONG Length;
300 };
301 ULONG Flags;
302 RXVBO ByteOffset;
303 ULONG Key;
304 } Locks;
305 XXCTL_LOWIO_COMPONENT FsCtl;
306 XXCTL_LOWIO_COMPONENT IoCtl;
307 struct
308 {
309 BOOLEAN WatchTree;
310 ULONG CompletionFilter;
311 ULONG NotificationBufferLength;
312 PVOID pNotificationBuffer;
313 } NotifyChangeDirectory;
314 } ParamsFor;
315 } LOWIO_CONTEXT;
316
317 #define LOWIO_CONTEXT_FLAG_SYNCCALL 0x01
318 #define LOWIO_CONTEXT_FLAG_SAVEUNLOCKS 0x2
319 #define LOWIO_CONTEXT_FLAG_LOUDOPS 0x04
320 #define LOWIO_CONTEXT_FLAG_CAN_COMPLETE_AT_DPC_LEVEL 0x08
321
322 #define LOWIO_READWRITEFLAG_PAGING_IO 0x01
323
324 #define RDBSS_MANAGE_SRV_CALL_EXTENSION 0x01
325 #define RDBSS_MANAGE_NET_ROOT_EXTENSION 0x02
326 #define RDBSS_MANAGE_V_NET_ROOT_EXTENSION 0x04
327 #define RDBSS_MANAGE_FCB_EXTENSION 0x08
328 #define RDBSS_MANAGE_SRV_OPEN_EXTENSION 0x10
329 #define RDBSS_MANAGE_FOBX_EXTENSION 0x20
330 #define RDBSS_NO_DEFERRED_CACHE_READAHEAD 0x1000
331
332 typedef struct _MINIRDR_DISPATCH
333 {
334 NODE_TYPE_CODE NodeTypeCode;
335 NODE_BYTE_SIZE NodeByteSize;
336 ULONG MRxFlags;
337 ULONG MRxSrvCallSize;
338 ULONG MRxNetRootSize;
339 ULONG MRxVNetRootSize;
340 ULONG MRxFcbSize;
341 ULONG MRxSrvOpenSize;
342 ULONG MRxFobxSize;
343 PMRX_CALLDOWN_CTX MRxStart;
344 PMRX_CALLDOWN_CTX MRxStop;
345 PMRX_CALLDOWN MRxCancel;
346 PMRX_CALLDOWN MRxCreate;
347 PMRX_CALLDOWN MRxCollapseOpen;
348 PMRX_CALLDOWN MRxShouldTryToCollapseThisOpen;
349 PMRX_CALLDOWN MRxFlush;
350 PMRX_CALLDOWN MRxZeroExtend;
351 PMRX_CALLDOWN MRxTruncate;
352 PMRX_CALLDOWN MRxCleanupFobx;
353 PMRX_CALLDOWN MRxCloseSrvOpen;
354 PMRX_DEALLOCATE_FOR_FCB MRxDeallocateForFcb;
355 PMRX_DEALLOCATE_FOR_FOBX MRxDeallocateForFobx;
356 PMRX_IS_LOCK_REALIZABLE MRxIsLockRealizable;
357 PMRX_FORCECLOSED_CALLDOWN MRxForceClosed;
358 PMRX_CHKFCB_CALLDOWN MRxAreFilesAliased;
359 PMRX_CALLDOWN MRxOpenPrintFile;
360 PMRX_CALLDOWN MRxClosePrintFile;
361 PMRX_CALLDOWN MRxWritePrintFile;
362 PMRX_CALLDOWN MRxEnumeratePrintQueue;
363 PMRX_CALLDOWN MRxClosedSrvOpenTimeOut;
364 PMRX_CALLDOWN MRxClosedFcbTimeOut;
365 PMRX_CALLDOWN MRxQueryDirectory;
366 PMRX_CALLDOWN MRxQueryFileInfo;
367 PMRX_CALLDOWN MRxSetFileInfo;
368 PMRX_CALLDOWN MRxSetFileInfoAtCleanup;
369 PMRX_CALLDOWN MRxQueryEaInfo;
370 PMRX_CALLDOWN MRxSetEaInfo;
371 PMRX_CALLDOWN MRxQuerySdInfo;
372 PMRX_CALLDOWN MRxSetSdInfo;
373 PMRX_CALLDOWN MRxQueryQuotaInfo;
374 PMRX_CALLDOWN MRxSetQuotaInfo;
375 PMRX_CALLDOWN MRxQueryVolumeInfo;
376 PMRX_CALLDOWN MRxSetVolumeInfo;
377 PMRX_CHKDIR_CALLDOWN MRxIsValidDirectory;
378 PMRX_COMPUTE_NEW_BUFFERING_STATE MRxComputeNewBufferingState;
379 PMRX_CALLDOWN MRxLowIOSubmit[LOWIO_OP_MAXIMUM+1];
380 PMRX_EXTENDFILE_CALLDOWN MRxExtendForCache;
381 PMRX_EXTENDFILE_CALLDOWN MRxExtendForNonCache;
382 PMRX_CHANGE_BUFFERING_STATE_CALLDOWN MRxCompleteBufferingStateChangeRequest;
383 PMRX_CREATE_V_NET_ROOT MRxCreateVNetRoot;
384 PMRX_FINALIZE_V_NET_ROOT_CALLDOWN MRxFinalizeVNetRoot;
385 PMRX_FINALIZE_NET_ROOT_CALLDOWN MRxFinalizeNetRoot;
386 PMRX_UPDATE_NETROOT_STATE MRxUpdateNetRootState;
387 PMRX_EXTRACT_NETROOT_NAME MRxExtractNetRootName;
388 PMRX_CREATE_SRVCALL MRxCreateSrvCall;
389 PMRX_CREATE_SRVCALL MRxCancelCreateSrvCall;
390 PMRX_SRVCALL_WINNER_NOTIFY MRxSrvCallWinnerNotify;
391 PMRX_FINALIZE_SRVCALL_CALLDOWN MRxFinalizeSrvCall;
392 PMRX_CALLDOWN MRxDevFcbXXXControlFile;
393 PMRX_PREPARSE_NAME MRxPreparseName;
394 PMRX_GET_CONNECTION_ID MRxGetConnectionId;
395 ULONG ScavengerTimeout;
396 } MINIRDR_DISPATCH, *PMINIRDR_DISPATCH;
397
398 #endif