36#define USE_DEFAULT_PRIORITY_BOOST ((CHAR) 0x7F)
42#define FXREQUEST_STATE_TAG (PVOID) 'tatS'
47#define FXREQUEST_QUEUE_TAG (PVOID) 'ueuQ'
52#define FXREQUEST_COMPLETE_TAG (PVOID) 'pmoC'
58#define FXREQUEST_HOLD_TAG (PVOID) 'dloH'
63#define FXREQUEST_FWDPRG_TAG (PVOID) 'PdwF'
69#define FXREQUEST_DCRC_TAG (PVOID) 'CRCD'
72#if defined(EVENT_TRACING)
73#include "FxRequest.hpp.tmh"
77#if (FX_CORE_MODE == FX_CORE_USER_MODE)
78#define WDF_REQUEST_SEND_OPTION_IMPERSONATION_FLAGS \
79 (WDF_REQUEST_SEND_OPTION_IMPERSONATE_CLIENT | \
80 WDF_REQUEST_SEND_OPTION_IMPERSONATION_IGNORE_FAILURE)
82#define FxIrpStackFlagsFromSendFlags(sendFlags) \
83 ((WUDFX_IRP_STACK_FLAGS) \
84 ((sendFlags) & WDF_REQUEST_SEND_OPTION_IMPERSONATION_FLAGS))
546 "WdfRequestGetCompletionParams will not return valid information if the"
547 " request is not formatted using WdfIoTargetFormatxxx DDIs"
691 return (WDFMEMORY)
handle;
794 "Completing WDFREQUEST 0x%p for IRP 0x%p with "
795 "Information 0x%I64x, %!STATUS!",
798 if (fxDevice !=
NULL) {
848 "Completing WDFREQUEST 0x%p for IRP 0x%p with "
849 "Information 0x%I64x, %!STATUS!",
859 VerifyPreProcessSendAndForget
933#if (FX_CORE_MODE == FX_CORE_USER_MODE)
948#if (FX_CORE_MODE == FX_CORE_USER_MODE)
1060 VerifyInsertIrpQueue,
1184 VerifyStopAcknowledge,
1224 VerifierBreakpoint_RequestEarlyDisposeDeferred
1236 VerifyRequestIsCancelable
1242 VerifyRequestIsNotCancelable
1248 VerifyRequestIsInCallerContext
1254 VerifyRequestIsInEvtIoStopContext
1260 VerifyRequestIsNotCompleted
1266 VerifyRequestIsTagRequest
1272 VerifyRequestIsAllocatedFromIo
1278 VerifyRequestIsCurrentStackValid
1284 VerifyRequestCanBeCompleted
1326 VerifyCompleteInternal,
basic_ios< char, char_traits< char > > ios
#define GetStatus(BaseIoAddress, Status)
__inline CHAR GetDefaultPriorityBoost(VOID)
UCHAR GetMajorFunction(VOID)
IWudfIoIrp * GetIoIrp(VOID)
ULONG GetParameterIoctlCodeBufferMethod(VOID)
KPROCESSOR_MODE GetRequestorMode(VOID)
VOID SetStatus(__in NTSTATUS Status)
PIO_STACK_LOCATION GetCurrentIrpStackLocation(VOID)
VOID CopyCurrentIrpStackLocationToNext(VOID)
VOID SetInformation(__in ULONG_PTR Information)
PVOID GetParameterIoctlType3InputBuffer(VOID)
ULONG_PTR GetInformation()
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
VOID __inline SetPriorityBoost(CCHAR PriorityBoost)
__inline FxIrp * GetSubmitFxIrp(VOID)
VOID ClearFieldsForReuse(VOID)
UCHAR m_RequestBaseStaticFlags
FxRequestContext * m_RequestContext
MdIoCsqIrpContext m_CsqContext
_Must_inspect_result_ NTSTATUS GetMemoryObject(__deref_out IFxMemory **Memory, __out PVOID *Buffer, __out size_t *Length)
__inline NTSTATUS CompleteWithInformation(__in NTSTATUS Status, __in ULONG_PTR Information)
VOID StopAcknowledge(__in BOOLEAN Requeue)
NTSTATUS CompleteInternal(__in NTSTATUS Status)
_Must_inspect_result_ FxIoQueue * GetCurrentQueue(VOID)
FxIoQueue * m_ForwardProgressQueue
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES RequestAttributes, __in_opt MdIrp Irp, __in_opt FxIoTarget *Target, __in FxRequestIrpOwnership Ownership, __in FxRequestConstructorCaller Caller, __deref_out FxRequest **Request)
_Must_inspect_result_ NTSTATUS InsertHeadIrpQueue(__in FxIrpQueue *IrpQueue, __out_opt ULONG *pRequestCount)
_Must_inspect_result_ NTSTATUS GetParameters(__out PWDF_REQUEST_PARAMETERS Parameters)
__inline CfxDevice * GetDevice(VOID)
VOID PreProcessSendAndForget(VOID)
static _Must_inspect_result_ FxRequest * GetNextRequest(__in FxIrpQueue *IrpQueue)
__inline PLIST_ENTRY GetListEntry(__in FxListEntryNames Index)
VOID ClearPowerStopState(VOID)
VOID __inline SetPresented(VOID)
friend FxRequestSystemBuffer
static __inline FxRequest * RetrieveFromCsqContext(__in PMdIoCsqIrpContext pCsqContext)
__inline BOOLEAN IsInIrpQueue(__in FxIrpQueue *pIrpQueue)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsTagRequest)
FX_DECLARE_VF_FUNCTION_P1(VOID, VerifyCompleteInternal, _In_ NTSTATUS)
FxRequestCompletionState SetCompletionState(__in FxRequestCompletionState NewState)
_Must_inspect_result_ NTSTATUS GetDeviceControlOutputMdl(__out PMDL *pMdl)
__inline PMdIoCsqIrpContext GetCsqContext(VOID)
virtual ULONG ReleaseOverride(__in WDFOBJECT_OFFSET Offset, __in PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsDriverOwned)
WDFMEMORY GetMemoryHandle(__in USHORT Offset)
friend FxRequestOutputBuffer
_Must_inspect_result_ NTSTATUS InsertTailIrpQueue(__in FxIrpQueue *IrpQueue, __out_opt ULONG *pRequestCount)
VOID PostProcessCompletionForReserved(__in FxRequestCompletionState State, __in FxIoQueue *Queue)
__inline VOID SetCurrentQueue(__in FxIoQueue *Queue)
__inline NTSTATUS CompleteWithPriority(__in NTSTATUS Status, __in CCHAR PriorityBoost)
__inline FxIoQueue * GetIoQueue(VOID)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyProbeAndLock)
_Must_inspect_result_ NTSTATUS ProbeAndLockForRead(__in PVOID Buffer, __in ULONG Length, __deref_out FxRequestMemory **pMemoryObject)
NTSTATUS SetInformation(__in ULONG_PTR Information)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsAllocatedFromIo)
__inline NTSTATUS Complete(__in NTSTATUS Status)
__inline VOID SetReserved()
__inline VOID ClearFieldsForReuse(VOID)
_Must_inspect_result_ NTSTATUS GetMdl(__out PMDL *pMdl)
friend VOID GetTriageInfo(VOID)
__inline VOID CopyCompletionParams(__in PWDF_REQUEST_COMPLETION_PARAMS Params)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsCancelable)
__inline VOID MarkRemovedFromIrpQueue(VOID)
FxRequestOutputBuffer m_OutputBuffer
BOOLEAN m_ForwardRequestToParent
FX_DECLARE_VF_FUNCTION(VOID, VerifyPreProcessSendAndForget)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsNotCancelable)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsInCallerContext)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsCurrentStackValid)
__inline BOOLEAN IsRequestForwardedToParent(VOID)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsNotCompleted)
__inline BOOLEAN IsCancelled(VOID)
FX_DECLARE_VF_FUNCTION_P1(NTSTATUS, VerifyStopAcknowledge, _In_ BOOLEAN)
__inline BOOLEAN IsPowerStopAcknowledged(VOID)
__inline VOID SetInternalContext(PVOID Context)
_Must_inspect_result_ NTSTATUS ProbeAndLockForWrite(__in PVOID Buffer, __in ULONG Length, __deref_out FxRequestMemory **pMemoryObject)
VOID PostProcessCompletionForDriverRequest(__in FxRequestCompletionState State, __in FxIoQueue *Queue)
__inline VOID SetForwardProgressQueue(__in FxIoQueue *Queue)
VOID SetImpersonationFlags(_In_ ULONG Flags)
_Must_inspect_result_ NTSTATUS GetDeviceControlOutputMemoryObject(__deref_out IFxMemory **MemoryObject, __out PVOID *Buffer, __out size_t *Length)
LIST_ENTRY m_ForwardProgressList
VOID __inline SetStatus(__in NTSTATUS Status)
static _Must_inspect_result_ NTSTATUS _CreateForPackage(__in CfxDevice *Device, __in PWDF_OBJECT_ATTRIBUTES RequestAttributes, __in MdIrp Irp, __deref_out FxRequest **Request)
LIST_ENTRY m_OwnerListEntry
FX_DECLARE_VF_FUNCTION_P1(NTSTATUS, VerifyInsertIrpQueue, _In_ FxIrpQueue *)
VOID AssignMemoryBuffers(__in WDF_DEVICE_IO_TYPE IoType)
VOID ReleaseIrpReference(VOID)
__inline BOOLEAN IsPowerStopAcknowledgedWithRequeue(VOID)
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestCanBeCompleted)
LIST_ENTRY m_OwnerListEntry2
PIO_STACK_LOCATION GetCurrentIrpStackLocation(VOID)
__inline VOID CopyCurrentIrpStackLocationToNext(VOID)
_Must_inspect_result_ NTSTATUS GetIrp(__deref_out MdIrp *ppIrp)
FX_DECLARE_VF_FUNCTION(VOID, VerifierBreakpoint_RequestEarlyDisposeDeferred)
VOID PostProcessCompletion(__in FxRequestCompletionState State, __in FxIoQueue *Queue)
_Must_inspect_result_ NTSTATUS GetFileObject(__deref_out_opt FxFileObject **pFileObject)
FxRequestSystemBuffer m_SystemBuffer
FX_DECLARE_VF_FUNCTION(NTSTATUS, VerifyRequestIsInEvtIoStopContext)
__inline BOOLEAN IsReserved()
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
_Must_inspect_result_ NTSTATUS Impersonate(_In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ PFN_WDF_REQUEST_IMPERSONATE EvtRequestImpersonate, _In_opt_ PVOID Context)
static _Must_inspect_result_ NTSTATUS PeekRequest(__in FxIrpQueue *IrpQueue, __in_opt FxRequest *TagRequest, __in_opt MdFileObject FileObject, __out_opt PWDF_REQUEST_PARAMETERS Parameters, __deref_out FxRequest **ppOutRequest)
NTSTATUS CompleteInternalReserved(__in NTSTATUS Status, __in CCHAR PriorityBoost)
virtual ULONG AddRefOverride(__in WDFOBJECT_OFFSET Offset, __in PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
_Must_inspect_result_ NTSTATUS Reuse(__in PWDF_REQUEST_REUSE_PARAMS ReuseParams)
_Must_inspect_result_ NTSTATUS RemoveFromIrpQueue(__in FxIrpQueue *IrpQueue)
VOID PreProcessCompletionForDriverRequest(__in FxRequestCompletionState State, __in FxIoQueue *Queue)
__inline PVOID GetInternalContext(VOID)
static VOID CheckAssumptions(VOID)
static FxRequest * _FromOwnerListEntry(__in FxListEntryNames Index, __in PLIST_ENTRY OwnerListEntry)
VOID PostProcessSendAndForget(VOID)
VOID AddIrpReference(VOID)
#define NT_SUCCESS(StatCode)
#define KMDF_ONLY_CODE_PATH_ASSERT()
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
VOID Request VerifyRequestIsDriverOwned(FxDriverGlobals)
__in MdIrp __in PMdIoCsqIrpContext pCsqContext
return pMemory GetBuffer()
DECLSPEC_SELECTANY const ULONG_PTR FxHandleValueMask
#define FxIrpStackFlagsFromSendFlags(sendFlags)
@ FxListEntryForwardProgress
@ FxRequestPowerStopAcknowledged
@ FxRequestPowerStopAcknowledgedWithRequeue
@ FxRequestPowerStopUnknown
NTSTATUS(* PFN_FX_QUEUE_REQUEST_COMPLETE)(__in FxRequest *Request, __in FxIoQueue *Queue, __in_opt WDFCONTEXT Context)
return pRequest GetRequestorMode()
return pRequest GetInformation()
_Must_inspect_result_ _In_ WDFREQUEST _In_ SECURITY_IMPERSONATION_LEVEL _In_ PFN_WDF_REQUEST_IMPERSONATE EvtRequestImpersonate
FxRequestConstructorCaller
@ FxRequestBaseStaticSystemBufferValid
@ FxRequestBaseStaticOutputBufferValid
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
PFILE_OBJECT MdFileObject
#define _Must_inspect_result_
#define METHOD_OUT_DIRECT
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IRP_MJ_DEVICE_CONTROL
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
FxRequest * GetRequest(VOID)
__inline VOID SetMdl(__in PMDL Mdl)
FxRequestOutputBuffer(VOID)
virtual _Must_inspect_result_ PMDL GetMdl(VOID)
virtual USHORT GetFlags(VOID)
__inline VOID ClearBufferMdl(VOID)
__inline VOID SetBuffer(__in PVOID Buffer)
virtual ULONG AddRef(__in PVOID Tag, __in LONG Line, __in_opt PSTR File)
__inline BOOLEAN IsBufferSet(VOID)
virtual VOID Delete(VOID)
virtual size_t GetBufferSize(VOID)
virtual PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__inline VOID ClearBufferMdl(VOID)
virtual VOID Delete(VOID)
__inline VOID SetBuffer(PVOID Buffer)
virtual size_t GetBufferSize(VOID)
__inline BOOLEAN IsBufferSet(VOID)
virtual PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__inline VOID SetMdl(PMDL Mdl)
virtual USHORT GetFlags(VOID)
FxRequestSystemBuffer(VOID)
FxRequest * GetRequest(VOID)
virtual ULONG AddRef(__in PVOID Tag, __in LONG Line, __in_opt PSTR File)
virtual _Must_inspect_result_ PMDL GetMdl(VOID)
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_DEVICE_REQUEST
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_In_ PWDFDEVICE_INIT _In_ PWDF_OBJECT_ATTRIBUTES RequestAttributes
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
_In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_IO_TYPE IoType
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
_In_ WDFREQUEST _In_ PWDF_REQUEST_REUSE_PARAMS ReuseParams
FORCEINLINE VOID WDF_REQUEST_COMPLETION_PARAMS_INIT(_Out_ PWDF_REQUEST_COMPLETION_PARAMS Params)
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
_Must_inspect_result_ _In_ WDFREQUEST _In_ size_t _Out_ WDFMEMORY * MemoryObject
_In_ WDFREQUEST _In_ BOOLEAN Requeue
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
_Must_inspect_result_ _In_ ULONG Flags
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel