1 #ifndef __BUFFRING_H__ 2 #define __BUFFRING_H__ 3 4 #define RX_REQUEST_PREPARED_FOR_HANDLING 0x10000000 5 6 typedef struct _CHANGE_BUFFERING_STATE_REQUEST_ 7 { 8 LIST_ENTRY ListEntry; 9 ULONG Flags; 10 #if (_WIN32_WINNT < 0x0600) 11 PSRV_CALL pSrvCall; 12 #endif 13 PSRV_OPEN SrvOpen; 14 PVOID SrvOpenKey; 15 PVOID MRxContext; 16 } CHANGE_BUFFERING_STATE_REQUEST, *PCHANGE_BUFFERING_STATE_REQUEST; 17 18 typedef struct _RX_BUFFERING_MANAGER_ 19 { 20 BOOLEAN DispatcherActive; 21 BOOLEAN HandlerInactive; 22 BOOLEAN LastChanceHandlerActive; 23 UCHAR Pad; 24 KSPIN_LOCK SpinLock; 25 volatile LONG CumulativeNumberOfBufferingChangeRequests; 26 LONG NumberOfUnhandledRequests; 27 LONG NumberOfUndispatchedRequests; 28 volatile LONG NumberOfOutstandingOpens; 29 LIST_ENTRY DispatcherList; 30 LIST_ENTRY HandlerList; 31 LIST_ENTRY LastChanceHandlerList; 32 RX_WORK_QUEUE_ITEM DispatcherWorkItem; 33 RX_WORK_QUEUE_ITEM HandlerWorkItem; 34 RX_WORK_QUEUE_ITEM LastChanceHandlerWorkItem; 35 FAST_MUTEX Mutex; 36 LIST_ENTRY SrvOpenLists[1]; 37 } RX_BUFFERING_MANAGER, *PRX_BUFFERING_MANAGER; 38 39 #if (_WIN32_WINNT >= 0x0600) 40 #define RxAcquireBufferingManagerMutex(BufMan) ExAcquireFastMutex(&(BufMan)->Mutex) 41 #else 42 #define RxAcquireBufferingManagerMutex(BufMan) \ 43 { \ 44 if (!ExTryToAcquireFastMutex(&(BufMan)->Mutex)) \ 45 { \ 46 ExAcquireFastMutex(&(BufMan)->Mutex); \ 47 } \ 48 } 49 #endif 50 #define RxReleaseBufferingManagerMutex(BufMan) ExReleaseFastMutex(&(BufMan)->Mutex) 51 52 VOID 53 RxpProcessChangeBufferingStateRequests( 54 PSRV_CALL SrvCall, 55 BOOLEAN UpdateHandlerState); 56 57 VOID 58 NTAPI 59 RxProcessChangeBufferingStateRequests( 60 _In_ PVOID SrvCall); 61 62 VOID 63 RxProcessFcbChangeBufferingStateRequest( 64 _In_ PFCB Fcb); 65 66 VOID 67 RxPurgeChangeBufferingStateRequestsForSrvOpen( 68 _In_ PSRV_OPEN SrvOpen); 69 70 VOID 71 RxCompleteSrvOpenKeyAssociation( 72 _Inout_ PSRV_OPEN SrvOpen); 73 74 VOID 75 RxInitiateSrvOpenKeyAssociation( 76 _Inout_ PSRV_OPEN SrvOpen); 77 78 NTSTATUS 79 RxInitializeBufferingManager( 80 _In_ PSRV_CALL SrvCall); 81 82 NTSTATUS 83 RxTearDownBufferingManager( 84 _In_ PSRV_CALL SrvCall); 85 86 NTSTATUS 87 RxFlushFcbInSystemCache( 88 _In_ PFCB Fcb, 89 _In_ BOOLEAN SynchronizeWithLazyWriter); 90 91 NTSTATUS 92 RxPurgeFcbInSystemCache( 93 _In_ PFCB Fcb, 94 _In_ PLARGE_INTEGER FileOffset OPTIONAL, 95 _In_ ULONG Length, 96 _In_ BOOLEAN UninitializeCacheMaps, 97 _In_ BOOLEAN FlushFile); 98 99 #endif 100