1#ifndef _RX_CONTEXT_STRUCT_DEFINED_
2#define _RX_CONTEXT_STRUCT_DEFINED_
4#define RX_TOPLEVELIRP_CONTEXT_SIGNATURE 'LTxR'
38#define RxInitializeTopLevelIrpContext(a,b,c) __RxInitializeTopLevelIrpContext(a,b,c,0)
57typedef struct _RX_FCBTRACKER_CALLINFO
64} RX_FCBTRACKER_CALLINFO, *PRX_FCBTRACKER_CALLINFO;
65#define RDBSS_TRACKER_HISTORY_SIZE 32
68#define MRX_CONTEXT_FIELD_COUNT 4
70#if (_WIN32_WINNT >= 0x0600)
270 volatile LONG AcquireReleaseFcbTrackerX;
271 volatile ULONG TrackerHistoryPointer;
272 RX_FCBTRACKER_CALLINFO TrackerHistory[RDBSS_TRACKER_HISTORY_SIZE];
275 ULONG ShadowCritOwner;
314#define RX_CONTEXT_PRESERVED_FLAGS (RX_CONTEXT_FLAG_FROM_POOL | \
315 RX_CONTEXT_FLAG_MUST_SUCCEED_ALLOCATED | \
316 RX_CONTEXT_FLAG_IN_FSP)
318#define RX_CONTEXT_INITIALIZATION_FLAGS (RX_CONTEXT_FLAG_WAIT | \
319 RX_CONTEXT_FLAG_MUST_SUCCEED | \
320 RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING)
345#define RxSaveAndSetExceptionNoBreakpointFlag(R, F) \
347 F = FlagOn(R->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT); \
348 SetFlag(R->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT); \
351#define RxRestoreExceptionNoBreakpointFlag(R, F) \
353 ClearFlag(R->Flags, RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT); \
354 SetFlag(R->Flags, F); \
357#define RxSaveAndSetExceptionNoBreakpointFlag(R, F)
358#define RxRestoreExceptionNoBreakpointFlag(R, F)
365 _In_ ULONG CapturedRxContextSerialNumber,
368#define RxItsTheSameContext() { __RxItsTheSameContext(RxContext, CapturedRxContextSerialNumber, __LINE__, __FILE__); }
370#define RxItsTheSameContext() { NOTHING; }
375#define MINIRDR_CALL_THROUGH(STATUS, DISPATCH, FUNC, ARGLIST) \
378 ASSERT(NodeType(DISPATCH) == RDBSS_NTC_MINIRDR_DISPATCH); \
379 if (DISPATCH->FUNC == NULL) \
381 STATUS = STATUS_NOT_IMPLEMENTED; \
385 STATUS = DISPATCH->FUNC ARGLIST; \
389#define MINIRDR_CALL(STATUS, CONTEXT, DISPATCH, FUNC, ARGLIST) \
392 ASSERT(NodeType(DISPATCH) == RDBSS_NTC_MINIRDR_DISPATCH); \
393 if (DISPATCH->FUNC == NULL) \
395 STATUS = STATUS_NOT_IMPLEMENTED; \
399 if (!BooleanFlagOn((CONTEXT)->Flags, RX_CONTEXT_FLAG_CANCELLED)) \
401 RtlZeroMemory(&((CONTEXT)->MRxContext[0]), \
402 sizeof((CONTEXT)->MRxContext)); \
403 STATUS = DISPATCH->FUNC ARGLIST; \
407 STATUS = STATUS_CANCELLED; \
412#define RxWaitSync(RxContext) \
413 (RxContext)->Flags |= RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \
414 KeWaitForSingleObject(&(RxContext)->SyncEvent, \
415 Executive, KernelMode, FALSE, NULL)
417#define RxSignalSynchronousWaiter(RxContext) \
418 (RxContext)->Flags &= ~RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS; \
419 KeSetEvent(&(RxContext)->SyncEvent, 0, FALSE)
421#define RxInsertContextInSerializationQueue(SerializationQueue, RxContext) \
422 (RxContext)->Flags |= RX_CONTEXT_FLAG_IN_SERIALIZATION_QUEUE; \
423 InsertTailList(SerializationQueue, &((RxContext)->RxContextSerializationQLinks))
438 RxContextSerializationQLinks);
442 Context->RxContextSerializationQLinks.Flink =
NULL;
443 Context->RxContextSerializationQLinks.Blink =
NULL;
449#define RxTransferList(Destination, Source) \
450 if (IsListEmpty((Source))) \
451 InitializeListHead((Destination)); \
454 *(Destination) = *(Source); \
455 (Destination)->Flink->Blink = (Destination); \
456 (Destination)->Blink->Flink = (Destination); \
457 InitializeListHead((Source)); \
460#define RxTransferListWithMutex(Destination, Source, Mutex) \
462 ExAcquireFastMutex(Mutex); \
463 RxTransferList(Destination, Source); \
464 ExReleaseFastMutex(Mutex); \
508#define RxDereferenceAndDeleteRxContext(RXCONTEXT) \
510 RxDereferenceAndDeleteRxContext_Real((RXCONTEXT)); \
511 (RXCONTEXT) = NULL; \
514#define RxDereferenceAndDeleteRxContext(RXCONTEXT) \
516 RxDereferenceAndDeleteRxContext_Real((RXCONTEXT)); \
532#if (_WIN32_WINNT >= 0x0600)
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
#define RemoveEntryList(Entry)
#define IsListEmpty(ListHead)
struct _FileName FileName
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
enum _FSINFOCLASS FS_INFORMATION_CLASS
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
NTSTATUS(NTAPI * PMRX_CALLDOWN)(_Inout_ PRX_CONTEXT RxContext)
DWORD SECURITY_INFORMATION
VOID __RxItsTheSameContext(_In_ PRX_CONTEXT RxContext, _In_ ULONG CapturedRxContextSerialNumber, _In_ ULONG Line, _In_ PCSTR File)
struct _NT_CREATE_PARAMETERS * PNT_CREATE_PARAMETERS
NPAGED_LOOKASIDE_LIST RxContextLookasideList
VOID NTAPI RxInitializeContext(_In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ ULONG InitialContextFlags, _Inout_ PRX_CONTEXT RxContext)
@ RX_CONTEXT_FLAG_RECURSIVE_CALL
@ RX_CONTEXT_FLAG_CREATE_MAILSLOT
@ RX_CONTEXT_FLAG_IN_SERIALIZATION_QUEUE
@ RX_CONTEXT_FLAG_THIS_DEVICE_TOP_LEVEL
@ RX_CONTEXT_FLAG_SYNC_EVENT_WAITERS
@ RX_CONTEXT_FLAG_WAITING_FOR_RESOURCE
@ RX_CONTEXT_FLAG_NO_PREPOSTING_NEEDED
@ RX_CONTEXT_FLAG_FROM_POOL
@ RX_CONTEXT_FLAG_CANCELLED
@ RX_CONTEXT_FLAG_FSP_DELAYED_OVERFLOW_QUEUE
@ RX_CONTEXT_FLAG_POST_ON_STABLE_CONDITION
@ RX_CONTEXT_FLAG_MINIRDR_INVOKED
@ RX_CONTEXT_FLAG_MUST_SUCCEED_ALLOCATED
@ RX_CONTEXT_FLAG_WRITE_THROUGH
@ RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING
@ RX_CONTEXT_FLAG_BYPASS_VALIDOP_CHECK
@ RX_CONTEXT_FLAG_BLOCKED_PIPE_RESUME
@ RX_CONTEXT_FLAG_MUST_SUCCEED
@ RX_CONTEXT_FLAG_NO_COMPLETE_FROM_FSP
@ RX_CONTEXT_FLAG_DEFERRED_WRITE
@ RX_CONTEXT_FLAG_ASYNC_OPERATION
@ RX_CONTEXT_FLAG_MAILSLOT_REPARSE
@ RX_CONTEXT_FLAG_FSP_CRITICAL_OVERFLOW_QUEUE
@ RX_CONTEXT_FLAG_STACK_IO_CONTEZT
@ RX_CONTEXT_FLAG_NO_EXCEPTION_BREAKPOINT
@ RX_CONTEXT_FLAG_NEEDRECONNECT
@ RX_CONTEXT_FLAG_VERIFY_READ
@ RX_CONTEXT_FLAG_MINIRDR_INITIATED
@ RXCONTEXT_FLAG4LOWIO_LOCK_FCB_RESOURCE_HELD
@ RXCONTEXT_FLAG4LOWIO_THIS_READ_ENLARGED
@ RXCONTEXT_FLAG4LOWIO_LOCK_BUFFERED_ON_ENTRY
@ RXCONTEXT_FLAG4LOWIO_READAHEAD
@ RXCONTEXT_FLAG4LOWIO_LOCK_OPERATION_COMPLETED
@ RXCONTEXT_FLAG4LOWIO_PIPE_OPERATION
@ RXCONTEXT_FLAG4LOWIO_PIPE_SYNC_OPERATION
@ RXCONTEXT_FLAG4LOWIO_LOCK_WAS_QUEUED_IN_LOCKMANAGER
@ RXCONTEXT_FLAG4LOWIO_THIS_IO_FAST
@ RXCONTEXT_FLAG4LOWIO_THIS_IO_BUFFERED
VOID NTAPI RxPrepareContextForReuse(_Inout_ PRX_CONTEXT RxContext)
FAST_MUTEX RxContextPerFileSerializationMutex
FORCEINLINE PRX_CONTEXT RxRemoveFirstContextFromSerializationQueue(PLIST_ENTRY SerializationQueue)
NTSTATUS(NTAPI * PRX_DISPATCH)(_In_ PRX_CONTEXT RxContext)
VOID NTAPI RxResumeBlockedOperations_Serially(_Inout_ PRX_CONTEXT RxContext, _Inout_ PLIST_ENTRY BlockingIoQ)
struct _RX_TOPLEVELIRP_CONTEXT * PRX_TOPLEVELIRP_CONTEXT
#define MRX_CONTEXT_FIELD_COUNT
VOID __RxInitializeTopLevelIrpContext(_Inout_ PRX_TOPLEVELIRP_CONTEXT TopLevelContext, _In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ ULONG Flags)
VOID NTAPI RxReinitializeContext(_Inout_ PRX_CONTEXT RxContext)
VOID RxRemoveOperationFromBlockingQueue(_Inout_ PRX_CONTEXT RxContext)
VOID NTAPI RxDereferenceAndDeleteRxContext_Real(_In_ PRX_CONTEXT RxContext)
struct _NT_CREATE_PARAMETERS NT_CREATE_PARAMETERS
struct _RX_CONTEXT RX_CONTEXT
PIRP RxGetTopIrpIfRdbssIrp(VOID)
BOOLEAN RxIsThisTheTopLevelIrp(_In_ PIRP Irp)
VOID RxCancelBlockingOperation(_Inout_ PRX_CONTEXT RxContext)
VOID RxResumeBlockedOperations_ALL(_Inout_ PRX_CONTEXT RxContext)
struct _RX_CONTEXT * PRX_CONTEXT
NTSTATUS RxCancelNotifyChangeDirectoryRequestsForVNetRoot(PV_NET_ROOT VNetRoot, BOOLEAN ForceFilesClosed)
BOOLEAN RxTryToBecomeTheTopLevelIrp(_Inout_ PRX_TOPLEVELIRP_CONTEXT TopLevelContext, _In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ BOOLEAN ForceTopLevel)
struct _RX_TOPLEVELIRP_CONTEXT RX_TOPLEVELIRP_CONTEXT
VOID RxUnwindTopLevelIrp(_Inout_ PRX_TOPLEVELIRP_CONTEXT TopLevelContext)
VOID RxCancelNotifyChangeDirectoryRequestsForFobx(PFOBX Fobx)
struct _DFS_NAME_CONTEXT_ * PDFS_NAME_CONTEXT
PRDBSS_DEVICE_OBJECT RxGetTopDeviceObjectIfRdbssIrp(VOID)
@ RX_CONTEXT_CREATE_FLAG_SPECIAL_PATH
@ RX_CONTEXT_CREATE_FLAG_UNC_NAME
@ RX_CONTEXT_CREATE_FLAG_REPARSE
@ RX_CONTEXT_CREATE_FLAG_STRIPPED_TRAILING_BACKSLASH
@ RX_CONTEXT_CREATE_FLAG_ADDEDBACKSLASH
PRX_CONTEXT NTAPI RxCreateRxContext(_In_ PIRP Irp, _In_ PRDBSS_DEVICE_OBJECT RxDeviceObject, _In_ ULONG InitialContextFlags)
struct _LIST_ENTRY * Flink
ACCESS_MASK DesiredAccess
PIO_SECURITY_CONTEXT SecurityContext
LARGE_INTEGER AllocationSize
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
PDFS_NAME_CONTEXT DfsNameContext
RX_WORK_QUEUE_ITEM WorkQueueItem
ULONG_PTR InformationToReturn
PVOID WriteOnlyOpenRetryContext
NT_CREATE_PARAMETERS NtCreateParameters
BOOLEAN ThisIsATreeConnectOpen
LIST_ENTRY OverflowListEntry
BOOLEAN FcbResourceAcquired
struct _RX_CONTEXT::@2156::@2171 QueryEa
PWCH AlsoCanonicalNameBuffer
struct _RX_CONTEXT::@2156::@2168 Create
PIO_SECURITY_CONTEXT pSecurityContext
volatile PVOID LockManagerContext
PUNICODE_STRING LoudCompletionString
ULONG ReturnedCreateInformation
BOOLEAN TryForScavengingOnSharingViolation
UNICODE_STRING UserDomainName
PMRX_CALLDOWN MRxCancelRoutine
BOOLEAN TreeConnectOpenDeferred
struct _RX_CONTEXT::@2156::@2174 QueryQuota
LIST_ENTRY ContextListEntry
LOWIO_CONTEXT LowIoContext
PFILE_GET_QUOTA_INFORMATION SidList
struct _RX_CONTEXT::@2154::@2163 PrefixClaim
PVOID MRxContext[MRX_CONTEXT_FIELD_COUNT]
PNON_PAGED_FCB NonPagedFcb
UCHAR MustSucceedDescriptorNumber
struct _RX_CONTEXT::@2154::@2162 Info
PRX_DISPATCH ResumeRoutine
PRX_PREFIX_ENTRY NetNamePrefixEntry
PETHREAD LastExecutionThread
volatile ULONG ReferenceCount
FILE_INFORMATION_CLASS FileInformationClass
IO_STATUS_BLOCK IoStatusBlock
struct _RX_CONTEXT::@2156::@2170 NotifyChangeDirectory
PIO_STACK_LOCATION CurrentIrpSp
PMRX_V_NET_ROOT pVNetRoot
struct _RX_CONTEXT::@2156::@2169 QueryDirectory
SECURITY_INFORMATION SecurityInformation
PSECURITY_DESCRIPTOR SecurityDescriptor
struct _RX_CONTEXT::@2156::@2176 DosVolumeFunction
PRDBSS_DEVICE_OBJECT RxDeviceObject
struct _RX_CONTEXT::@2156::@2173 SetSecurity
UNICODE_STRING SuppliedPathName
NODE_TYPE_CODE NodeTypeCode
LIST_ENTRY BlockedOperations
UNICODE_STRING TransportName
PMRX_SRV_OPEN pRelevantSrvOpen
ULONGLONG ForceLonglongAligmentDummyField
NET_ROOT_TYPE NetRootType
PDEVICE_OBJECT RealDevice
struct _RX_CONTEXT::@2156::@2172 QuerySecurity
struct _RX_CONTEXT::@2156::@2175 SetQuota
PVOID StoredStatusAlignment
LIST_ENTRY RxContextSerializationQLinks
PFAST_MUTEX BlockedOpsMutex
FS_INFORMATION_CLASS FsInformationClass
NODE_BYTE_SIZE NodeByteSize
BOOLEAN ReturnSingleEntry
RX_SCAVENGER_ENTRY ScavengerEntry
BOOLEAN ScavengingAlreadyTried
BOOLEAN FcbPagingIoResourceAcquired
PRDBSS_DEVICE_OBJECT RxDeviceObject
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ ULONG Flags
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST