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