xref: /reactos/sdk/include/ddk/rxprocs.h (revision cc578af6)
1 #ifndef _RDBSSPROCS_
2 #define _RDBSSPROCS_
3 
4 #include "backpack.h"
5 #include "rxlog.h"
6 #include "rxtimer.h"
7 #include "rxstruc.h"
8 
9 extern PVOID RxNull;
10 
11 #define RxLogFailure(DO, Originator, Event, Status) \
12     RxLogEventDirect(DO, Originator, Event, Status, __LINE__)
13 
14 VOID
15 NTAPI
16 RxLogEventDirect(
17     _In_ PRDBSS_DEVICE_OBJECT DeviceObject,
18     _In_ PUNICODE_STRING OriginatorId,
19     _In_ ULONG EventId,
20     _In_ NTSTATUS Status,
21     _In_ ULONG Line);
22 
23 VOID
24 NTAPI
25 RxLogEventWithAnnotation(
26     _In_ PRDBSS_DEVICE_OBJECT DeviceObject,
27     _In_ ULONG EventId,
28     _In_ NTSTATUS Status,
29     _In_ PVOID DataBuffer,
30     _In_ USHORT DataBufferLength,
31     _In_ PUNICODE_STRING Annotation,
32     _In_ ULONG AnnotationCount);
33 
34 NTSTATUS
35 RxPrefixClaim(
36     _In_ PRX_CONTEXT RxContext);
37 
38 VOID
39 RxpPrepareCreateContextForReuse(
40     _In_ PRX_CONTEXT RxContext);
41 
42 NTSTATUS
43 RxLowIoCompletionTail(
44     _In_ PRX_CONTEXT RxContext);
45 
46 LUID
47 RxGetUid(
48     _In_ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext);
49 
50 ULONG
51 RxGetSessionId(
52     _In_ PIO_STACK_LOCATION IrpSp);
53 
54 #if (_WIN32_WINNT >= 0x0600)
55 NTSTATUS
56 RxFindOrCreateConnections(
57     _In_ PRX_CONTEXT RxContext,
58     _In_ PIRP Irp,
59     _In_ PUNICODE_STRING CanonicalName,
60     _In_ NET_ROOT_TYPE NetRootType,
61     _In_ BOOLEAN TreeConnect,
62     _Out_ PUNICODE_STRING LocalNetRootName,
63     _Out_ PUNICODE_STRING FilePathName,
64     _Inout_ PLOCK_HOLDING_STATE LockState,
65     _In_ PRX_CONNECTION_ID RxConnectionId);
66 #else
67 NTSTATUS
68 RxFindOrCreateConnections(
69     _In_ PRX_CONTEXT RxContext,
70     _In_ PUNICODE_STRING CanonicalName,
71     _In_ NET_ROOT_TYPE NetRootType,
72     _Out_ PUNICODE_STRING LocalNetRootName,
73     _Out_ PUNICODE_STRING FilePathName,
74     _Inout_ PLOCK_HOLDING_STATE LockState,
75     _In_ PRX_CONNECTION_ID RxConnectionId);
76 #endif
77 
78 typedef enum _RX_NAME_CONJURING_METHODS
79 {
80     VNetRoot_As_Prefix,
81     VNetRoot_As_UNC_Name,
82     VNetRoot_As_DriveLetter
83 } RX_NAME_CONJURING_METHODS;
84 
85 VOID
86 RxConjureOriginalName(
87     _Inout_ PFCB Fcb,
88     _Inout_ PFOBX Fobx,
89     _Out_ PULONG ActualNameLength,
90     _Out_writes_bytes_( *LengthRemaining) PWCHAR OriginalName,
91     _Inout_ PLONG LengthRemaining,
92     _In_ RX_NAME_CONJURING_METHODS NameConjuringMethod);
93 
94 #if (_WIN32_WINNT >= 0x0600)
95 NTSTATUS
96 RxCompleteMdl(
97     _In_ PRX_CONTEXT RxContext,
98     _In_ PIRP Irp);
99 #else
100 NTSTATUS
101 NTAPI
102 RxCompleteMdl(
103     _In_ PRX_CONTEXT RxContext);
104 #endif
105 
106 #if (_WIN32_WINNT >= 0x0600)
107 VOID
108 RxLockUserBuffer(
109     _In_ PRX_CONTEXT RxContext,
110     _In_ PIRP Irp,
111     _In_ LOCK_OPERATION Operation,
112     _In_ ULONG BufferLength);
113 
114 PVOID
115 RxMapSystemBuffer(
116     _In_ PRX_CONTEXT RxContext,
117     _In_ PIRP Irp);
118 #else
119 VOID
120 RxLockUserBuffer(
121     _In_ PRX_CONTEXT RxContext,
122     _In_ LOCK_OPERATION Operation,
123     _In_ ULONG BufferLength);
124 
125 PVOID
126 RxMapSystemBuffer(
127     _In_ PRX_CONTEXT RxContext);
128 #endif
129 
130 #define FCB_MODE_EXCLUSIVE 1
131 #define FCB_MODE_SHARED 2
132 #define FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE 3
133 #define FCB_MODE_SHARED_STARVE_EXCLUSIVE 4
134 
135 #define CHANGE_BUFFERING_STATE_CONTEXT ((PRX_CONTEXT)IntToPtr(0xffffffff))
136 #define CHANGE_BUFFERING_STATE_CONTEXT_WAIT ((PRX_CONTEXT)IntToPtr(0xfffffffe))
137 
138 NTSTATUS
139 __RxAcquireFcb(
140     _Inout_ PFCB Fcb,
141     _Inout_opt_ PRX_CONTEXT RxContext,
142     _In_ ULONG Mode
143 #ifdef RDBSS_TRACKER
144     ,
145     _In_ ULONG LineNumber,
146     _In_ PCSTR FileName,
147     _In_ ULONG SerialNumber
148 #endif
149     );
150 
151 #ifdef  RDBSS_TRACKER
152 #define RxAcquireExclusiveFcb(R, F) __RxAcquireFcb((F), (R), FCB_MODE_EXCLUSIVE, __LINE__, __FILE__, 0)
153 #else
154 #define RxAcquireExclusiveFcb(R, F) __RxAcquireFcb((F), (R), FCB_MODE_EXCLUSIVE)
155 #endif
156 
157 #define RX_GET_MRX_FCB(F) ((PMRX_FCB)((F)))
158 
159 #ifdef  RDBSS_TRACKER
160 #define RxAcquireSharedFcb(R, F) __RxAcquireFcb((F), (R), FCB_MODE_SHARED, __LINE__, __FILE__, 0)
161 #else
162 #define RxAcquireSharedFcb(R, F) __RxAcquireFcb((F), (R), FCB_MODE_SHARED)
163 #endif
164 
165 #ifdef  RDBSS_TRACKER
166 #define RxAcquireSharedFcbWaitForEx(R, F) __RxAcquireFcb((F),(R), FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE, __LINE__, __FILE__,0)
167 #else
168 #define RxAcquireSharedFcbWaitForEx(R, F) __RxAcquireFcb((F), (R), FCB_MODE_SHARED_WAIT_FOR_EXCLUSIVE)
169 #endif
170 
171 VOID
172 __RxReleaseFcb(
173     _Inout_opt_ PRX_CONTEXT RxContext,
174     _Inout_ PMRX_FCB MrxFcb
175 #ifdef RDBSS_TRACKER
176     ,
177     _In_ ULONG LineNumber,
178     _In_ PCSTR FileName,
179     _In_ ULONG SerialNumber
180 #endif
181     );
182 
183 #ifdef  RDBSS_TRACKER
184 #define RxReleaseFcb(R, F) __RxReleaseFcb((R), RX_GET_MRX_FCB(F), __LINE__, __FILE__, 0)
185 #else
186 #define RxReleaseFcb(R, F) __RxReleaseFcb((R), RX_GET_MRX_FCB(F))
187 #endif
188 
189 VOID
190 __RxReleaseFcbForThread(
191     _Inout_opt_ PRX_CONTEXT RxContext,
192     _Inout_ PMRX_FCB MrxFcb,
193     _In_ ERESOURCE_THREAD ResourceThreadId
194 #ifdef RDBSS_TRACKER
195     ,
196     _In_ ULONG LineNumber,
197     _In_ PCSTR FileName,
198     _In_ ULONG SerialNumber
199 #endif
200     );
201 
202 #ifdef  RDBSS_TRACKER
203 #define RxReleaseFcbForThread(R, F, T) __RxReleaseFcbForThread((R), RX_GET_MRX_FCB(F), (T), __LINE__, __FILE__, 0)
204 #else
205 #define RxReleaseFcbForThread(R, F, T) __RxReleaseFcbForThread((R), RX_GET_MRX_FCB(F), (T))
206 #endif
207 
208 #ifdef RDBSS_TRACKER
209 VOID
210 RxTrackerUpdateHistory(
211     _Inout_opt_ PRX_CONTEXT RxContext,
212     _Inout_ PMRX_FCB MrxFcb,
213     _In_ ULONG Operation,
214     _In_ ULONG LineNumber,
215     _In_ PCSTR FileName,
216     _In_ ULONG SerialNumber);
217 #else
218 #define RxTrackerUpdateHistory(R, F, O, L, F, S) { NOTHING; }
219 #endif
220 
221 VOID
222 RxTrackPagingIoResource(
223     _Inout_ PVOID Instance,
224     _In_ ULONG Type,
225     _In_ ULONG Line,
226     _In_ PCSTR File);
227 
228 #define RxIsFcbAcquiredShared(Fcb) ExIsResourceAcquiredSharedLite((Fcb)->Header.Resource)
229 #define RxIsFcbAcquiredExclusive(Fcb) ExIsResourceAcquiredExclusiveLite((Fcb)->Header.Resource)
230 #define RxIsFcbAcquired(Fcb) (ExIsResourceAcquiredSharedLite((Fcb)->Header.Resource) ||  \
231 			      ExIsResourceAcquiredExclusiveLite((Fcb)->Header.Resource))
232 
233 #define RxAcquirePagingIoResource(RxContext, Fcb)                         \
234     ExAcquireResourceExclusiveLite((Fcb)->Header.PagingIoResource, TRUE); \
235     if (RxContext != NULL)                                                \
236     {                                                                     \
237         (RxContext)->FcbPagingIoResourceAcquired = TRUE;                  \
238     }                                                                     \
239     RxTrackPagingIoResource(Fcb, 1, __LINE__, __FILE__)
240 
241 #ifndef __REACTOS__
242 #define RxAcquirePagingIoResourceShared(RxContext, Fcb, Flag)             \
243     ExAcquireResourceSharedLite((Fcb)->Header.PagingIoResource, Flag);    \
244     if (AcquiredFile)                                                     \
245     {                                                                     \
246         if (RxContext != NULL)                                            \
247 	{                                                                 \
248             ((PRX_CONTEXT)RxContext)->FcbPagingIoResourceAcquired = TRUE; \
249         }                                                                 \
250         RxTrackPagingIoResource(Fcb, 2, __LINE__, __FILE__);              \
251     }
252 #else
253 #define RxAcquirePagingIoResourceShared(RxContext, Fcb, Flag)                             \
254     {                                                                                     \
255         BOOLEAN AcquiredFile;                                                             \
256         AcquiredFile = ExAcquireResourceSharedLite((Fcb)->Header.PagingIoResource, Flag); \
257         if (AcquiredFile)                                                                 \
258         {                                                                                 \
259             if (RxContext != NULL)                                                        \
260 	    {                                                                             \
261                 ((PRX_CONTEXT)RxContext)->FcbPagingIoResourceAcquired = TRUE;             \
262             }                                                                             \
263             RxTrackPagingIoResource(Fcb, 2, __LINE__, __FILE__);                          \
264         }                                                                                 \
265     }
266 #endif
267 
268 #define RxReleasePagingIoResource(RxContext, Fcb)         \
269     RxTrackPagingIoResource(Fcb, 3, __LINE__, __FILE__);  \
270     if (RxContext != NULL)                                \
271     {                                                     \
272         (RxContext)->FcbPagingIoResourceAcquired = FALSE; \
273     }                                                     \
274     ExReleaseResourceLite((Fcb)->Header.PagingIoResource)
275 
276 #define RxReleasePagingIoResourceForThread(RxContext, Fcb, Thread) \
277     RxTrackPagingIoResource(Fcb, 3, __LINE__, __FILE__);           \
278     if (RxContext != NULL)                                         \
279     {                                                              \
280         (RxContext)->FcbPagingIoResourceAcquired = FALSE;          \
281     }                                                              \
282     ExReleaseResourceForThreadLite((Fcb)->Header.PagingIoResource, (Thread))
283 
284 #ifdef __REACTOS__
285 VOID
286 __RxWriteReleaseResources(
287     PRX_CONTEXT RxContext,
288     BOOLEAN ResourceOwnerSet
289 #ifdef RDBSS_TRACKER
290     ,
291     ULONG LineNumber,
292     PCSTR FileName,
293     ULONG SerialNumber
294 #endif
295     );
296 
297 #ifdef  RDBSS_TRACKER
298 #define RxWriteReleaseResources(R, B) __RxWriteReleaseResources((R), (B), __LINE__, __FILE__, 0)
299 #else
300 #define RxWriteReleaseResources(R, B) __RxWriteReleaseResources((R), (B))
301 #endif
302 #endif
303 
304 BOOLEAN
305 NTAPI
306 RxAcquireFcbForLazyWrite(
307     _In_ PVOID Null,
308     _In_ BOOLEAN Wait);
309 
310 VOID
311 NTAPI
312 RxReleaseFcbFromLazyWrite(
313     _In_ PVOID Null);
314 
315 BOOLEAN
316 NTAPI
317 RxAcquireFcbForReadAhead(
318     _In_ PVOID Null,
319     _In_ BOOLEAN Wait);
320 
321 VOID
322 NTAPI
323 RxReleaseFcbFromReadAhead(
324     _In_ PVOID Null);
325 
326 BOOLEAN
327 NTAPI
328 RxNoOpAcquire(
329     _In_ PVOID Fcb,
330     _In_ BOOLEAN Wait);
331 
332 VOID
333 NTAPI
334 RxNoOpRelease(
335     _In_ PVOID Fcb);
336 
337 #define RxConvertToSharedFcb(R, F) ExConvertExclusiveToSharedLite(RX_GET_MRX_FCB(F)->Header.Resource)
338 
339 VOID
340 RxVerifyOperationIsLegal(
341     _In_ PRX_CONTEXT RxContext);
342 
343 VOID
344 RxPrePostIrp(
345     _In_ PVOID Context,
346     _In_ PIRP Irp);
347 
348 VOID
349 NTAPI
350 RxAddToWorkque(
351     _In_ PRX_CONTEXT RxContext,
352     _In_ PIRP Irp);
353 
354 NTSTATUS
355 RxFsdPostRequest(
356     _In_ PRX_CONTEXT RxContext);
357 
358 #define QuadAlign(V) (ALIGN_UP(V, ULONGLONG))
359 
360 VOID
361 RxCompleteRequest_Real(
362     _In_ PRX_CONTEXT RxContext,
363     _In_ PIRP Irp,
364     _In_ NTSTATUS Status);
365 
366 NTSTATUS
367 RxCompleteRequest(
368     _In_ PRX_CONTEXT pContext,
369     _In_ NTSTATUS Status);
370 
371 #if (_WIN32_WINNT >= 0x600)
372 NTSTATUS
373 RxConstructSrvCall(
374     _In_ PRX_CONTEXT RxContext,
375     _In_ PIRP Irp,
376     _In_ PSRV_CALL SrvCall,
377     _Out_ PLOCK_HOLDING_STATE LockHoldingState);
378 #else
379 NTSTATUS
380 RxConstructSrvCall(
381     _In_ PRX_CONTEXT RxContext,
382     _In_ PSRV_CALL SrvCall,
383     _Out_ PLOCK_HOLDING_STATE LockHoldingState);
384 #endif
385 
386 #define RxCompleteAsynchronousRequest(C, S) RxCompleteRequest(C, S)
387 
388 NTSTATUS
389 RxConstructNetRoot(
390     _In_ PRX_CONTEXT RxContext,
391     _In_ PSRV_CALL SrvCall,
392     _In_ PNET_ROOT NetRoot,
393     _In_ PV_NET_ROOT VirtualNetRoot,
394     _Out_ PLOCK_HOLDING_STATE LockHoldingState);
395 
396 #if (_WIN32_WINNT >= 0x0600)
397 NTSTATUS
398 RxConstructVirtualNetRoot(
399     _In_ PRX_CONTEXT RxContext,
400     _In_ PIRP Irp,
401     _In_ PUNICODE_STRING CanonicalName,
402     _In_ NET_ROOT_TYPE NetRootType,
403     _In_ BOOLEAN TreeConnect,
404     _Out_ PV_NET_ROOT *VirtualNetRootPointer,
405     _Out_ PLOCK_HOLDING_STATE LockHoldingState,
406     _Out_ PRX_CONNECTION_ID  RxConnectionId);
407 
408 NTSTATUS
409 RxFindOrConstructVirtualNetRoot(
410     _In_ PRX_CONTEXT RxContext,
411     _In_ PIRP Irp,
412     _In_ PUNICODE_STRING CanonicalName,
413     _In_ NET_ROOT_TYPE NetRootType,
414     _In_ PUNICODE_STRING RemainingName);
415 #else
416 NTSTATUS
417 RxConstructVirtualNetRoot(
418     _In_ PRX_CONTEXT RxContext,
419     _In_ PUNICODE_STRING CanonicalName,
420     _In_ NET_ROOT_TYPE NetRootType,
421     _Out_ PV_NET_ROOT *VirtualNetRootPointer,
422     _Out_ PLOCK_HOLDING_STATE LockHoldingState,
423     _Out_ PRX_CONNECTION_ID  RxConnectionId);
424 
425 NTSTATUS
426 RxFindOrConstructVirtualNetRoot(
427     _In_ PRX_CONTEXT RxContext,
428     _In_ PUNICODE_STRING CanonicalName,
429     _In_ NET_ROOT_TYPE NetRootType,
430     _In_ PUNICODE_STRING RemainingName);
431 #endif
432 
433 #if (_WIN32_WINNT >= 0x0600)
434 NTSTATUS
435 RxLowIoLockControlShell(
436     _In_ PRX_CONTEXT RxContext,
437     _In_ PIRP Irp,
438     _In_ PFCB Fcb);
439 #else
440 NTSTATUS
441 RxLowIoLockControlShell(
442     _In_ PRX_CONTEXT RxContext);
443 #endif
444 
445 NTSTATUS
446 NTAPI
447 RxChangeBufferingState(
448     PSRV_OPEN SrvOpen,
449     PVOID Context,
450     BOOLEAN ComputeNewState);
451 
452 VOID
453 NTAPI
454 RxIndicateChangeOfBufferingStateForSrvOpen(
455     PMRX_SRV_CALL SrvCall,
456     PMRX_SRV_OPEN SrvOpen,
457     PVOID SrvOpenKey,
458     PVOID Context);
459 
460 NTSTATUS
461 NTAPI
462 RxPrepareToReparseSymbolicLink(
463     PRX_CONTEXT RxContext,
464     BOOLEAN SymbolicLinkEmbeddedInOldPath,
465     PUNICODE_STRING NewPath,
466     BOOLEAN NewPathIsAbsolute,
467     PBOOLEAN ReparseRequired);
468 
469 VOID
470 RxReference(
471     _Inout_ PVOID Instance);
472 
473 VOID
474 RxDereference(
475     _Inout_ PVOID Instance,
476     _In_ LOCK_HOLDING_STATE LockHoldingState);
477 
478 VOID
479 RxWaitForStableCondition(
480     _In_ PRX_BLOCK_CONDITION Condition,
481     _Inout_ PLIST_ENTRY TransitionWaitList,
482     _Inout_ PRX_CONTEXT RxContext,
483     _Out_opt_ NTSTATUS *AsyncStatus);
484 
485 VOID
486 RxUpdateCondition(
487     _In_ RX_BLOCK_CONDITION NewConditionValue,
488     _Out_ PRX_BLOCK_CONDITION Condition,
489     _In_ OUT PLIST_ENTRY TransitionWaitList);
490 
491 #if (_WIN32_WINNT >= 0x0600)
492 NTSTATUS
493 RxCloseAssociatedSrvOpen(
494     _In_opt_ PRX_CONTEXT RxContext,
495     _In_ PFOBX Fobx);
496 #else
497 NTSTATUS
498 RxCloseAssociatedSrvOpen(
499     _In_ PFOBX Fobx,
500     _In_opt_ PRX_CONTEXT RxContext);
501 #endif
502 
503 NTSTATUS
504 NTAPI
505 RxFinalizeConnection(
506     _Inout_ PNET_ROOT NetRoot,
507     _Inout_opt_ PV_NET_ROOT VNetRoot,
508     _In_ LOGICAL ForceFilesClosed);
509 
510 #if DBG
511 VOID
512 RxDumpWantedAccess(
513     _In_ PSZ where1,
514     _In_ PSZ where2,
515     _In_ PSZ wherelogtag,
516     _In_ ACCESS_MASK DesiredAccess,
517     _In_ ULONG DesiredShareAccess);
518 
519 VOID
520 RxDumpCurrentAccess(
521     _In_ PSZ where1,
522     _In_ PSZ where2,
523     _In_ PSZ wherelogtag,
524     _In_ PSHARE_ACCESS ShareAccess);
525 #else
526 #define RxDumpWantedAccess(w1,w2,wlt,DA,DSA) {NOTHING;}
527 #define RxDumpCurrentAccess(w1,w2,wlt,SA)  {NOTHING;}
528 #endif
529 
530 NTSTATUS
531 RxCheckShareAccessPerSrvOpens(
532     _In_ PFCB Fcb,
533     _In_ ACCESS_MASK DesiredAccess,
534     _In_ ULONG DesiredShareAccess);
535 
536 VOID
537 RxUpdateShareAccessPerSrvOpens(
538     _In_ PSRV_OPEN SrvOpen);
539 
540 VOID
541 RxRemoveShareAccessPerSrvOpens(
542     _Inout_ PSRV_OPEN SrvOpen);
543 
544 #if DBG
545 NTSTATUS
546 RxCheckShareAccess(
547     _In_ ACCESS_MASK DesiredAccess,
548     _In_ ULONG DesiredShareAccess,
549     _Inout_ PFILE_OBJECT FileObject,
550     _Inout_ PSHARE_ACCESS ShareAccess,
551     _In_ BOOLEAN Update,
552     _In_ PSZ where,
553     _In_ PSZ wherelogtag);
554 
555 VOID
556 RxRemoveShareAccess(
557     _Inout_ PFILE_OBJECT FileObject,
558     _Inout_ PSHARE_ACCESS ShareAccess,
559     _In_ PSZ where,
560     _In_ PSZ wherelogtag);
561 
562 VOID
563 RxSetShareAccess(
564     _In_ ACCESS_MASK DesiredAccess,
565     _In_ ULONG DesiredShareAccess,
566     _Inout_ PFILE_OBJECT FileObject,
567     _Out_ PSHARE_ACCESS ShareAccess,
568     _In_ PSZ where,
569     _In_ PSZ wherelogtag);
570 
571 VOID
572 RxUpdateShareAccess(
573     _Inout_ PFILE_OBJECT FileObject,
574     _Inout_ PSHARE_ACCESS ShareAccess,
575     _In_ PSZ where,
576     _In_ PSZ wherelogtag);
577 #else
578 #define RxCheckShareAccess(a1, a2, a3, a4, a5, a6, a7) IoCheckShareAccess(a1, a2, a3, a4, a5)
579 #define RxRemoveShareAccess(a1, a2, a3, a4) IoRemoveShareAccess(a1, a2)
580 #define RxSetShareAccess(a1, a2, a3, a4, a5, a6) IoSetShareAccess(a1, a2, a3, a4)
581 #define RxUpdateShareAccess(a1, a2, a3, a4) IoUpdateShareAccess(a1, a2)
582 #endif
583 
584 NTSTATUS
585 NTAPI
586 RxDriverEntry(
587     _In_ PDRIVER_OBJECT DriverObject,
588     _In_ PUNICODE_STRING RegistryPath);
589 
590 VOID
591 NTAPI
592 RxUnload(
593     _In_ PDRIVER_OBJECT DriverObject);
594 
595 VOID
596 RxInitializeMinirdrDispatchTable(
597     _In_ PDRIVER_OBJECT DriverObject);
598 
599 ULONG
600 RxGetNetworkProviderPriority(
601     _In_ PUNICODE_STRING DeviceName);
602 
603 VOID
604 RxPrepareRequestForReuse(
605     PCHANGE_BUFFERING_STATE_REQUEST Request);
606 
607 VOID
608 RxpDiscardChangeBufferingStateRequests(
609     _Inout_ PLIST_ENTRY DiscardedRequests);
610 
611 VOID
612 RxGatherRequestsForSrvOpen(
613     _Inout_ PSRV_CALL SrvCall,
614     _In_ PSRV_OPEN SrvOpen,
615     _Inout_ PLIST_ENTRY RequestsListHead);
616 
617 NTSTATUS
618 RxpLookupSrvOpenForRequestLite(
619     _In_ PSRV_CALL SrvCall,
620     _Inout_ PCHANGE_BUFFERING_STATE_REQUEST Request);
621 
622 VOID
623 RxProcessChangeBufferingStateRequestsForSrvOpen(
624     PSRV_OPEN SrvOpen);
625 
626 NTSTATUS
627 RxPurgeFobxFromCache(
628     PFOBX FobxToBePurged);
629 
630 BOOLEAN
631 RxPurgeFobx(
632     PFOBX pFobx);
633 
634 VOID
635 RxUndoScavengerFinalizationMarking(
636     PVOID Instance);
637 
638 ULONG
639 RxTableComputePathHashValue(
640     _In_ PUNICODE_STRING Name);
641 
642 VOID
643 RxExtractServerName(
644     _In_ PUNICODE_STRING FilePathName,
645     _Out_ PUNICODE_STRING SrvCallName,
646     _Out_ PUNICODE_STRING RestOfName);
647 
648 VOID
649 NTAPI
650 RxCreateNetRootCallBack(
651     _In_ PMRX_CREATENETROOT_CONTEXT CreateNetRootContext);
652 
653 PVOID
654 RxAllocateObject(
655     _In_ NODE_TYPE_CODE NodeType,
656     _In_opt_ PMINIRDR_DISPATCH MRxDispatch,
657     _In_ ULONG NameLength);
658 
659 VOID
660 RxFreeObject(
661     _In_ PVOID pObject);
662 
663 NTSTATUS
664 RxInitializeSrvCallParameters(
665     _In_ PRX_CONTEXT RxContext,
666     _Inout_ PSRV_CALL SrvCall);
667 
668 VOID
669 RxAddVirtualNetRootToNetRoot(
670     _In_ PNET_ROOT NetRoot,
671     _In_ PV_NET_ROOT VNetRoot);
672 
673 VOID
674 RxRemoveVirtualNetRootFromNetRoot(
675     _In_ PNET_ROOT NetRoot,
676     _In_ PV_NET_ROOT VNetRoot);
677 
678 PVOID
679 RxAllocateFcbObject(
680     _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject,
681     _In_ NODE_TYPE_CODE NodeType,
682     _In_ POOL_TYPE PoolType,
683     _In_ ULONG NameSize,
684     _In_opt_ PVOID AlreadyAllocatedObject);
685 
686 VOID
687 RxFreeFcbObject(
688     _In_ PVOID Object);
689 
690 VOID
691 RxPurgeFcb(
692     _In_ PFCB Fcb);
693 
694 BOOLEAN
695 RxFinalizeNetFcb(
696     _Out_ PFCB ThisFcb,
697     _In_ BOOLEAN RecursiveFinalize,
698     _In_ BOOLEAN ForceFinalize,
699     _In_ LONG ReferenceCount);
700 
701 BOOLEAN
702 RxIsThisACscAgentOpen(
703     _In_ PRX_CONTEXT RxContext);
704 
705 VOID
706 NTAPI
707 RxCheckFcbStructuresForAlignment(
708     VOID);
709 
710 NTSTATUS
711 RxInitializeWorkQueueDispatcher(
712    _In_ PRX_WORK_QUEUE_DISPATCHER Dispatcher);
713 
714 VOID
715 RxInitializeWorkQueue(
716    _In_ PRX_WORK_QUEUE WorkQueue,
717    _In_ WORK_QUEUE_TYPE WorkQueueType,
718    _In_ ULONG MaximumNumberOfWorkerThreads,
719    _In_ ULONG MinimumNumberOfWorkerThreads);
720 
721 NTSTATUS
722 RxSpinUpWorkerThread(
723    _In_ PRX_WORK_QUEUE WorkQueue,
724    _In_ PRX_WORKERTHREAD_ROUTINE Routine,
725    _In_ PVOID Parameter);
726 
727 VOID
728 RxSpinUpWorkerThreads(
729    _In_ PRX_WORK_QUEUE WorkQueue);
730 
731 VOID
732 NTAPI
733 RxSpinUpRequestsDispatcher(
734     _In_ PVOID Dispatcher);
735 
736 VOID
737 RxpWorkerThreadDispatcher(
738    _In_ PRX_WORK_QUEUE WorkQueue,
739    _In_ PLARGE_INTEGER WaitInterval);
740 
741 VOID
742 NTAPI
743 RxBootstrapWorkerThreadDispatcher(
744    _In_ PVOID WorkQueue);
745 
746 PRX_PREFIX_ENTRY
747 RxTableLookupName_ExactLengthMatch(
748     _In_ PRX_PREFIX_TABLE ThisTable,
749     _In_ PUNICODE_STRING  Name,
750     _In_ ULONG HashValue,
751     _In_opt_ PRX_CONNECTION_ID RxConnectionId);
752 
753 PVOID
754 RxTableLookupName(
755     _In_ PRX_PREFIX_TABLE ThisTable,
756     _In_ PUNICODE_STRING Name,
757     _Out_ PUNICODE_STRING RemainingName,
758     _In_opt_ PRX_CONNECTION_ID RxConnectionId);
759 
760 VOID
761 RxOrphanSrvOpens(
762     _In_ PV_NET_ROOT ThisVNetRoot);
763 
764 VOID
765 RxOrphanThisFcb(
766     _In_ PFCB Fcb);
767 
768 VOID
769 RxOrphanSrvOpensForThisFcb(
770     _In_ PFCB Fcb,
771     _In_ PV_NET_ROOT ThisVNetRoot,
772     _In_ BOOLEAN OrphanAll);
773 
774 #define RxEqualConnectionId(C1, C2) RtlEqualMemory(C1, C2, sizeof(RX_CONNECTION_ID))
775 
776 NTSTATUS
777 NTAPI
778 RxLockOperationCompletion(
779     _In_ PVOID Context,
780     _In_ PIRP Irp);
781 
782 VOID
783 NTAPI
784 RxUnlockOperation(
785     _In_ PVOID Context,
786     _In_ PFILE_LOCK_INFO LockInfo);
787 
788 #if (_WIN32_WINNT >= 0x0600)
789 NTSTATUS
790 RxPostStackOverflowRead(
791     _In_ PRX_CONTEXT RxContext,
792     _In_ PFCB Fcb);
793 #else
794 NTSTATUS
795 RxPostStackOverflowRead(
796     _In_ PRX_CONTEXT RxContext);
797 #endif
798 
799 VOID
800 NTAPI
801 RxCancelRoutine(
802     _In_ PDEVICE_OBJECT DeviceObject,
803     _In_ PIRP Irp);
804 
805 #ifdef __REACTOS__
806 #define RxWriteCacheingAllowed(F, S) (                              \
807     BooleanFlagOn((F)->FcbState, FCB_STATE_WRITECACHING_ENABLED) && \
808     !BooleanFlagOn((S)->Flags, SRVOPEN_FLAG_DONTUSE_WRITE_CACHING))
809 #endif
810 
811 #endif
812