ReactOS 0.4.15-dev-8102-g108db8f
FxRequestBase Class Reference

#include <fxrequestbase.hpp>

Inheritance diagram for FxRequestBase:
Collaboration diagram for FxRequestBase:

Public Member Functions

__inline VOID SetCompletionRoutine (__in_opt PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine=NULL, __in_opt WDFCONTEXT CompletionContext=NULL)
 
PFN_WDF_REQUEST_COMPLETION_ROUTINE ClearCompletionRoutine (VOID)
 
WDFCONTEXT ClearCompletionContext (VOID)
 
__inline BOOLEAN IsCompletionRoutineSet (VOID)
 
__inline BOOLEAN IsCancelRoutineSet (VOID)
 
__inline FxRequestContextGetContext (VOID)
 
__inline VOID SetContext (__in FxRequestContext *RequestContext=NULL)
 
VOID ContextReleaseAndRestore (VOID)
 
__inline VOID EnableContextDisposeNotification (VOID)
 
__inline BOOLEAN HasContextType (__in FX_REQUEST_CONTEXT_TYPE Type)
 
__inline BOOLEAN HasContext (VOID)
 
__inline MdIrp GetSubmitIrp (VOID)
 
__inline FxIrpGetSubmitFxIrp (VOID)
 
MdIrp SetSubmitIrp (__in_opt MdIrp NewIrp, __in BOOLEAN FreeIrp=TRUE)
 
__inline BOOLEAN CanComplete (VOID)
 
VOID CompleteSubmitted (VOID)
 
_Must_inspect_result_ NTSTATUS ValidateTarget (__in FxIoTarget *Target)
 
__inline FxIoTargetGetTarget (VOID)
 
VOID __inline SetTarget (__in FxIoTarget *Target)
 
__inline UCHAR GetTargetFlags (VOID)
 
__inline VOID SetTargetFlags (__in UCHAR Flags)
 
__inline ULONG ClearTargetFlags (__in UCHAR Flags)
 
__inline VOID SetRequestBaseFlags (__in UCHAR Flags)
 
SHORT GetVerifierFlagsLocked (VOID)
 
__inline SHORT GetVerifierFlags (VOID)
 
__inline VOID SetVerifierFlagsLocked (__in SHORT Flags)
 
__inline VOID SetVerifierFlags (__in SHORT Flags)
 
__inline VOID ClearVerifierFlagsLocked (__in SHORT Flags)
 
__inline VOID ClearVerifierFlags (__in SHORT Flags)
 
__inline VOID VerifierSetFormatted (VOID)
 
__inline VOID VerifierClearFormatted (VOID)
 
__inline BOOLEAN VerifierIsFormatted (VOID)
 
__inline BOOLEAN ShouldClearContext (VOID)
 
_Must_inspect_result_ NTSTATUS CreateTimer (VOID)
 
VOID StartTimer (__in LONGLONG Timeout)
 
_Must_inspect_result_ BOOLEAN CancelTimer (VOID)
 
BOOLEAN Cancel (VOID)
 
BOOLEAN __inline IsAllocatedFromIo (VOID)
 
BOOLEAN __inline IsAllocatedDriver (VOID)
 
BOOLEAN __inline IsCanComplete (VOID)
 
__inline VOID SetCompleted (__in BOOLEAN Value)
 
VOID __inline SetPriorityBoost (CCHAR PriorityBoost)
 
CCHAR __inline GetPriorityBoost (VOID)
 
__inline WDFREQUEST GetHandle (VOID)
 
__inline PVOID GetTraceObjectHandle (VOID)
 
VOID FreeMdls (VOID)
 
DECLSPEC_NORETURN VOID FatalError (__in NTSTATUS Status)
 
VOID ClearFieldsForReuse (VOID)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 

Static Public Member Functions

static __inline FxRequestBase_FromListEntry (__in PLIST_ENTRY Entry)
 
static __inline FxRequestBase_FromDrainEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static __inline FxRequestBase_FromCsqContext (__in PMdIoCsqIrpContext Context)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Public Attributes

union {
   MdIoCsqIrpContext   m_CsqContext
 
   LIST_ENTRY   m_ListEntry
 
}; 
 
union {
   SINGLE_LIST_ENTRY   m_DrainSingleEntry
 
   BOOLEAN   m_NextStackLocationFormatted
 
}; 
 

Protected Member Functions

 FxRequestBase (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in_opt MdIrp Irp, __in FxRequestIrpOwnership Ownership, __in FxRequestConstructorCaller Caller, __in FxObjectType ObjectType=FxObjectTypeExternal)
 
virtual ~FxRequestBase (VOID)
 
 FX_DECLARE_VF_FUNCTION (VOID, VerifyDispose)
 
virtual BOOLEAN Dispose (VOID)
 
VOID CompleteSubmittedNoContext (VOID)
 
VOID ZeroOutDriverContext (VOID)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 

Protected Attributes

FxIrp m_Irp
 
FxIoTargetm_Target
 
FxRequestContextm_RequestContext
 
FxRequestTimerm_Timer
 
FxRequestCancelCallback m_CancelRoutine
 
FxRequestCompletionCallback m_CompletionRoutine
 
WDFCONTEXT m_TargetCompletionContext
 
LONG m_IrpCompletionReferenceCount
 
union {
   UCHAR   m_TargetFlags
 
   struct {
      UCHAR   Completed: 1
 
      UCHAR   FlagsPended: 1
 
      UCHAR   TimerSet: 1
 
      UCHAR   CancelledFromTimer: 1
 
      UCHAR   IgnoreState: 1
 
   }   m_TargetFlagsByName
 
}; 
 
UCHAR m_IrpAllocation
 
BOOLEAN m_Completed
 
BOOLEAN m_Canceled
 
WDFOBJECT_OFFSET_ALIGNED m_SystemBufferOffset
 
union {
   SHORT   m_VerifierFlags
 
   struct {
      SHORT   DriverOwned: 1
 
      SHORT   TagRequest: 1
 
      SHORT   Forwarded: 1
 
      SHORT   DriverDispatch: 1
 
      SHORT   DriverCancelable: 1
 
      SHORT   DriverInprocessContext: 1
 
      SHORT   Cancelled: 1
 
      SHORT   Formatted: 1
 
      SHORT   SentToTarget: 1
 
      SHORT   DriverInEvtIoStopContext: 1
 
   }   m_VeriferFlagsByName
 
}; 
 
LONG m_IrpReferenceCount
 
FxIrpQueuem_IrpQueue
 
WDFOBJECT_OFFSET_ALIGNED m_OutputBufferOffset
 
union {
   UCHAR   m_RequestBaseFlags
 
   struct {
      UCHAR   SystemMdlMapped: 1
 
      UCHAR   OutputMdlMapped: 1
 
      UCHAR   SyncCleanupContext: 1
 
   }   m_RequestBaseFlagsByName
 
}; 
 
union {
   UCHAR   m_RequestBaseStaticFlags
 
   struct {
      UCHAR   SystemBufferValid: 1
 
      UCHAR   OutputBufferValid: 1
 
   }   m_RequestBaseStaticFlagsByName
 
}; 
 
CCHAR m_PriorityBoost
 
BYTE m_CompletionState
 
BOOLEAN m_CanComplete
 
PMDL m_AllocatedMdl
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Static Protected Attributes

static MdDeferredRoutineType _TimerDPC
 

Private Attributes

friend FxIoTarget
 
friend FxSyncRequest
 

Additional Inherited Members

- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 166 of file fxrequestbase.hpp.

Constructor & Destructor Documentation

◆ FxRequestBase()

FxRequestBase::FxRequestBase ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in USHORT  ObjectSize,
__in_opt MdIrp  Irp,
__in FxRequestIrpOwnership  Ownership,
__in FxRequestConstructorCaller  Caller,
__in FxObjectType  ObjectType = FxObjectTypeExternal 
)
protected

Definition at line 32 of file fxrequestbase.cpp.

39 : FxNonPagedObject(FX_TYPE_REQUEST, ObjectSize, FxDriverGlobals, ObjectType),
40 m_Irp(Irp)
41{
42 //
43 // By default requests cannot be completed except for request associated with
44 // IRP allocated from I/O (upper drivers).
45 //
47
48 //
49 // After is all said and done with assigning to m_IrpAllocation value, if
50 // m_Irp().GetIrp == NULL, then m_IrpAllocation can be overridden in
51 // ValidateTarget.
52 //
54 if (Ownership == FxRequestOwnsIrp) {
55 //
56 // Driver writer gave the irp to the framework but still owns it
57 // or there is no irp passed in when the FxRequest was created.
58 //
60 }
61 else {
62 //
63 // Driver writer gave the irp to the framework but still owns it
64 //
66 }
67
68 //
69 // Cleanup request's context in Dispose. Please see Dispose below
70 // for specific scenario we are trying to fix. Enable Dispose only if
71 // driver is v1.11 or above b/c it may be possible that older driver
72 // may have used invalid/bad scenarios similar to this one:
73 // - create target object.
74 // - create one or more driver created requests parented to the target.
75 // - send one or more of these requests to the target (lower stack).
76 // - delete the target object while requests are pending.
77 // Deleting a target while it has a pending request is a valid
78 // operation, what is not valid is for these request to be also
79 // parented to the target at the same time.
80 // In this scenario if we turn on Dispose, the Dispose callback will
81 // be called before the request is completed.
82 // Note that if the driver had specified any Cleanup callbacks on
83 // these requests, these also are called before the requests are
84 // completed.
85 //
86 if (FxDriverGlobals->IsVersionGreaterThanOrEqualTo(1, 11)) {
88 }
89 }
90 else if (Ownership == FxRequestOwnsIrp) {
91 //
92 // The request will own the irp and free it when the request is freed
93 //
95 }
96 else {
97 //
98 // Request is owned by the io queue
99 //
102 }
103
104 m_Target = NULL;
105 m_TargetFlags = 0;
106
108
111
112 m_PriorityBoost = 0;
113
115 m_Timer = NULL;
116
119
121
123
127
129
130 m_VerifierFlags = 0;
134}
MdIrp GetIrp(VOID)
Definition: fxirpum.cpp:15
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
WDFOBJECT_OFFSET_ALIGNED m_OutputBufferOffset
SINGLE_LIST_ENTRY m_DrainSingleEntry
LONG m_IrpCompletionReferenceCount
BOOLEAN m_CanComplete
WDFCONTEXT m_TargetCompletionContext
FxRequestTimer * m_Timer
FxIoTarget * m_Target
FxIrpQueue * m_IrpQueue
UCHAR m_RequestBaseStaticFlags
LIST_ENTRY m_ListEntry
FxRequestContext * m_RequestContext
UCHAR m_RequestBaseFlags
WDFOBJECT_OFFSET_ALIGNED m_SystemBufferOffset
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
@ REQUEST_ALLOCATED_FROM_IO
@ REQUEST_ALLOCATED_DRIVER
@ REQUEST_ALLOCATED_INTERNAL
@ FxRequestConstructorCallerIsDriver
@ FxRequestCompletionStateNone
@ FxRequestOwnsIrp
@ FX_TYPE_REQUEST
Definition: fxtypes.h:53
ObjectType
Definition: metafile.c:81
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629

◆ ~FxRequestBase()

FxRequestBase::~FxRequestBase ( VOID  )
protectedvirtual

Definition at line 136 of file fxrequestbase.cpp.

139{
140 MdIrp irp;
141
142 //
143 // Since m_ListEntry is a union with the CSQ context and the irp have just
144 // come off of a CSQ, we cannot be guaranteed that the m_ListEntry is
145 // initialized to point to itself.
146 //
147 // ASSERT(IsListEmpty(&m_ListEntry));
148
149
150#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
151 //
152 // If an MDL is associated with the request, free it
153 //
154 if (m_AllocatedMdl != NULL) {
156 }
157#endif
158
159 irp = m_Irp.GetIrp();
160
161 //
162 // If the request was created through WdfRequestCreate, formatted, and not
163 // reused, we can still have a request context.
164 //
165 if (m_RequestContext != NULL) {
166 if (irp != NULL) {
168 }
169
170 delete m_RequestContext;
171 }
172
174 m_Irp.FreeIrp();
175 }
176
177 if (m_Timer != NULL) {
178 delete m_Timer;
179 }
180}
VOID FreeIrp(VOID)
Definition: fxirpum.cpp:1648
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
VOID __inline FxMdlFree(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PMDL Mdl)
Definition: fxmdl.h:60
FxIrp * irp
IWudfIrp * MdIrp
Definition: mxum.h:103
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)

Member Function Documentation

◆ _FromCsqContext()

static __inline FxRequestBase * FxRequestBase::_FromCsqContext ( __in PMdIoCsqIrpContext  Context)
inlinestatic

Definition at line 666 of file fxrequestbase.hpp.

669 {
671 }
MdIoCsqIrpContext m_CsqContext
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by FxIoTarget::_RequestCancelled(), and FxIoTarget::DrainPendedRequestsLocked().

◆ _FromDrainEntry()

static __inline FxRequestBase * FxRequestBase::_FromDrainEntry ( __in PSINGLE_LIST_ENTRY  Entry)
inlinestatic

Definition at line 655 of file fxrequestbase.hpp.

658 {
660 }
base of all file and directory entries
Definition: entries.h:83

Referenced by FxIoTarget::_CancelSentRequests().

◆ _FromListEntry()

◆ Cancel()

BOOLEAN FxRequestBase::Cancel ( VOID  )

Definition at line 534 of file fxrequestbase.cpp.

549{
551
553 "Request %p", this);
554
555 //
556 // It is critical to set m_Canceled before we check the reference count.
557 // We could be racing with FxIoTarget::SubmitLocked and if this call executes
558 // before SubmitLocked, the completion reference count will still be zero.
559 // SubmitLocked will check m_Canceled after setting the reference count to
560 // one so that it decrement the count back.
561 //
563
564 //
565 // If the ref count is zero, the irp has completed already. This means we
566 // cannot safely touch the underlying PIRP because we cannot guarantee it
567 // will not be completed from underneath us.
568 //
570 //
571 // Successfully incremented the ref count. The PIRP will not be completed
572 // until the count goes to zero.
573 //
574 // Cancelling the irp handles all 2 states:
575 //
576 // 1) the request is pended in a target. the target will attempt to
577 // complete the request immediately in the cancellation routine, but
578 // will not be able to because of the added count to the ref count
579 // done above. The count will move back to zero below and
580 // CompletedCanceledRequest will complete the request
581 //
582 // 2) The irp is in flight to the target WDM device. In which case the
583 // target WDM device should complete the request immediatley. If
584 // it does not, it becomes the same as the case where the target WDM
585 // device has already pended it and placed a cancellation routine
586 // on the request and the request will (a)synchronously complete
587 //
588 result = m_Irp.Cancel();
589
591 "Request %p, PIRP %p, cancel result %d",
592 this, m_Irp.GetIrp(), result);
593
594 //
595 // If the count goes to zero, the completion routine ran, but deferred
596 // completion ownership to this thread since we had the outstanding
597 // refeference.
598 //
600
601 //
602 // Since completion ownership was claimed, m_Target will be valid
603 // until m_Target->CompleteRequest executes because the target will
604 // not delete while there is outstanding I/O.
605 //
606 ASSERT(m_Target != NULL);
607
610 "Request %p, PIRP %p, completed synchronously in cancel call, "
611 "completing request on target %p", this, m_Irp.GetIrp(), m_Target);
612
614 }
615 }
616 else {
618 "Could not cancel request %p, already completed", this);
619
620 result = FALSE;
621 }
622
623 return result;
624}
unsigned char BOOLEAN
#define InterlockedDecrement
Definition: armddk.h:52
VOID CompleteCanceledRequest(__in FxRequestBase *Request)
BOOLEAN Cancel(VOID)
Definition: fxirpum.cpp:475
#define TRACINGIO
Definition: dbgtrace.h:66
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
__inline LONG FxInterlockedIncrementGTZero(__inout LONG volatile *Target)
Definition: fxglobals.h:1045
GLuint64EXT * result
Definition: glext.h:11304
#define ASSERT(a)
Definition: mode.c:44
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30

Referenced by FxUsbPipeContinuousReader::CancelRepeaters().

◆ CancelTimer()

_Must_inspect_result_ BOOLEAN FxRequestBase::CancelTimer ( VOID  )

Definition at line 766 of file fxrequestbase.cpp.

786{
788 //
789 // If we can successfully cancel the timer, release the reference
790 // taken in StartTimer and mark the timer as not queued.
791 //
792
793 if (m_Timer->Timer.Stop() == FALSE) {
794
796 "Request %p, did not cancel timer", this);
797
798 //
799 // Leave FX_REQUEST_TIMER_SET set. The timer DPC will clear the it
800 //
801
802 return FALSE;
803 }
804
806 "Request %p, canceled timer successfully", this);
807
808 m_TargetFlags &= ~FX_REQUEST_TIMER_SET;
809 }
810
811 return TRUE;
812}
_Must_inspect_result_ __inline BOOLEAN Stop(VOID)
Definition: mxtimerkm.h:273
@ FX_REQUEST_TIMER_SET

Referenced by FxIoTarget::DrainPendedRequestsLocked().

◆ CanComplete()

__inline BOOLEAN FxRequestBase::CanComplete ( VOID  )
inline

Definition at line 334 of file fxrequestbase.hpp.

337 {
338 LONG count;
340 ASSERT(count >= 0);
341 return count == 0 ? TRUE : FALSE;
342 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
long LONG
Definition: pedump.c:60

Referenced by FxIoTarget::DrainPendedRequestsLocked().

◆ ClearCompletionContext()

WDFCONTEXT FxRequestBase::ClearCompletionContext ( VOID  )
inline

Definition at line 198 of file fxrequestbase.hpp.

201 {
202 WDFCONTEXT pContext;
203
204 pContext = m_TargetCompletionContext;
206
207 return pContext;
208 }

Referenced by CompleteSubmitted(), and CompleteSubmittedNoContext().

◆ ClearCompletionRoutine()

PFN_WDF_REQUEST_COMPLETION_ROUTINE FxRequestBase::ClearCompletionRoutine ( VOID  )
inline

Definition at line 185 of file fxrequestbase.hpp.

188 {
190
193
194 return pRoutine;
195 }
FxRequestCompletionCallback m_CompletionRoutine
PFN_WDF_REQUEST_COMPLETION_ROUTINE m_Completion
EVT_WDF_REQUEST_COMPLETION_ROUTINE * PFN_WDF_REQUEST_COMPLETION_ROUTINE
Definition: wdfrequest.h:313

Referenced by CompleteSubmitted(), and CompleteSubmittedNoContext().

◆ ClearFieldsForReuse()

VOID FxRequestBase::ClearFieldsForReuse ( VOID  )

Definition at line 260 of file fxrequestbase.cpp.

263{
264#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
265 if (m_AllocatedMdl != NULL) {
268 }
269#endif
270
273 m_VerifierFlags = 0;
275
278
280
281 if (m_Timer != NULL) {
282 delete m_Timer;
283 m_Timer = NULL;
284 }
285
286 m_Target = NULL;
287 m_TargetFlags = 0;
289
291
295}
VOID __inline SetPriorityBoost(CCHAR PriorityBoost)
BOOLEAN m_NextStackLocationFormatted
__inline VOID SetCompleted(__in BOOLEAN Value)

Referenced by FxRequest::ClearFieldsForReuse().

◆ ClearTargetFlags()

__inline ULONG FxRequestBase::ClearTargetFlags ( __in UCHAR  Flags)
inline

Definition at line 395 of file fxrequestbase.hpp.

398 {
399 ULONG oldFlags;
400
401 oldFlags = m_TargetFlags;
402
403 // Assumes caller is holding appropriate lock
405
406 return oldFlags;
407 }
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by FxIoTarget::_RequestCancelled(), and FxIoTarget::DrainPendedRequestsLocked().

◆ ClearVerifierFlags()

__inline VOID FxRequestBase::ClearVerifierFlags ( __in SHORT  Flags)
inline

Definition at line 479 of file fxrequestbase.hpp.

482 {
483 KIRQL irql;
484
485 ASSERT(GetDriverGlobals()->FxVerifierOn);
486
487 Lock(&irql);
489 Unlock(irql);
490 }
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
__inline VOID ClearVerifierFlagsLocked(__in SHORT Flags)
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127

Referenced by FxIoQueue::DispatchRequestToDriver(), FxIoQueue::RequestCancelable(), FxRequest::Reuse(), and VerifierClearFormatted().

◆ ClearVerifierFlagsLocked()

__inline VOID FxRequestBase::ClearVerifierFlagsLocked ( __in SHORT  Flags)
inline

Definition at line 470 of file fxrequestbase.hpp.

473 {
475 }

Referenced by ClearVerifierFlags().

◆ CompleteSubmitted()

VOID FxRequestBase::CompleteSubmitted ( VOID  )

Definition at line 454 of file fxrequestbase.cpp.

471{
473
475
477
478 if (GetDriverGlobals()->FxVerifierOn) {
479 //
480 // Zero out any values previous driver may have set; when completing the irp
481 // through FxRequest::CompleteInternal, we check to see what the lastest
482 // package was (stored off in the DriverContext). Since the request was
483 // sent off to another devobj, don't assume any valid values in the
484 // DriverContext anymore.
485 //
487
488 //
489 // ClearFormatted also checks for WdfVefiefierOn, but that's OK
490 //
492 }
493
494 if (m_RequestContext != NULL) {
495 //
496 // Always do the copy because the driver can retrieve the parameters
497 // later even if there is no completion routine set.
498 //
501 );
502
504
505 //
506 // Call the completion routine if present. Once we call the completion
507 // routine we can't touch any fields anymore since the request may be resent
508 // down the stack.
509 //
515 }
516 }
518 //
519 // Only put a completion parameters struct on the stack if we have to.
520 // By putting it into a separate function, we can control stack usage
521 // in this way.
522 //
524 }
525
526 //
527 // Release the tag that was acquired when the request was submitted or
528 // pended.
529 //
531}
WDFIOTARGET GetHandle(VOID)
Definition: fxiotarget.hpp:307
VOID CopyStatus(_Out_ PIO_STATUS_BLOCK StatusBlock)
Definition: fxirpum.cpp:1736
__inline FxIrp * GetSubmitFxIrp(VOID)
__inline VOID VerifierClearFormatted(VOID)
VOID CompleteSubmittedNoContext(VOID)
VOID ZeroOutDriverContext(VOID)
WDFCONTEXT ClearCompletionContext(VOID)
PFN_WDF_REQUEST_COMPLETION_ROUTINE ClearCompletionRoutine(VOID)
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
FX_TRACK_DRIVER(fxDriverGlobals)
#define RELEASE(_tag)
Definition: fxobject.hpp:50
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
virtual VOID CopyParameters(__in FxRequestBase *Request)
#define GetHandle(h)
Definition: treelist.c:116

◆ CompleteSubmittedNoContext()

VOID FxRequestBase::CompleteSubmittedNoContext ( VOID  )
protected

Definition at line 416 of file fxrequestbase.cpp.

433{
435
437
438 GetSubmitFxIrp()->CopyStatus(&params.IoStatus);
439
440 RtlZeroMemory(&params.Parameters, sizeof(params.Parameters));
441
442
443 //
444 // Once we call the completion routine we can't touch any fields anymore
445 // since the request may be resent down the stack.
446 //
449 &params,
451}
GLenum const GLfloat * params
Definition: glext.h:5645
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
@ WdfRequestTypeNoFormat
Definition: wdfdevice.h:533

Referenced by CompleteSubmitted().

◆ ContextReleaseAndRestore()

VOID FxRequestBase::ContextReleaseAndRestore ( VOID  )
inline

Definition at line 264 of file fxrequestbase.hpp.

267 {
268 //
269 // This does not free the context, rather it tells the context to release
270 // any references it is holding and restore fields back into the PIRP
271 //
272 if (m_RequestContext != NULL && m_Irp.GetIrp() != NULL) {
275 }
276 }

Referenced by ValidateTarget().

◆ CreateTimer()

_Must_inspect_result_ NTSTATUS FxRequestBase::CreateTimer ( VOID  )

Definition at line 674 of file fxrequestbase.cpp.

694{
695 FxRequestTimer* pTimer;
696 PVOID pResult;
698
699 PFX_DRIVER_GLOBALS FxDriverGlobals = GetDriverGlobals();
700
701 if (m_Timer != NULL) {
702 return STATUS_SUCCESS;
703 }
704
705
706
707
708
709 pTimer = new (FxDriverGlobals) FxRequestTimer();
710
711 if(pTimer == NULL) {
713 }
714
715 status = pTimer->Timer.Initialize(this, _TimerDPC, 0);
716 if(!NT_SUCCESS(status)) {
718 "Failed to initialize timer for request %p", this);
719 delete pTimer;
720 return status;
721 }
722
724
725 if (pResult != NULL) {
726 //
727 // Another value was set before we could set it, free our timer now
728 //
729 delete pTimer;
730 }
731
732 return STATUS_SUCCESS;
733}
LONG NTSTATUS
Definition: precomp.h:26
static MdDeferredRoutineType _TimerDPC
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in_opt PVOID TimerContext, __in MdDeferredRoutine TimerCallback, __in LONG Period)
Definition: mxtimerkm.h:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ Dispose()

BOOLEAN FxRequestBase::Dispose ( VOID  )
protectedvirtual

Reimplemented from FxObject.

Definition at line 206 of file fxrequestbase.cpp.

207{
208 //
209 // Make sure request is not in use.
210 //
211 VerifyDispose(GetDriverGlobals());
212
213 //
214 // Now call Cleanup on any handle context's exposed
215 // to the device driver.
216 //
217 CallCleanup();
218
219 //
220 // Call the request's cleanup (~dtor or Dispose).
221 //
222 if (m_RequestContext != NULL) {
223 if (IsAllocatedFromIo() == FALSE && m_Irp.GetIrp() != NULL) {
224 //
225 // This code allows the following scenario to work correctly b/c
226 // the original request can be completed without worrying that the
227 // new request's context has references on the original request.
228 //
229 // * Driver receives an ioctl request.
230 // * Driver creates a new request.
231 // * Driver formats the new request with buffers from original ioctl.
232 // * Driver sends the new request synchronously.
233 // * Driver retrieves info/status from the new request.
234 // * Driver deletes the new request.
235 // * Driver completes the original request.
236 //
238
239 //
240 // ~dtor cleans up everything. No need to call its Dispose method.
241 //
242 delete m_RequestContext;
244 }
245 else {
246 //
247 // Let request's context know that Dispose is in progress.
248 // RequestContext may receive the following two calls after Dispose:
249 // . ReleaseAndRestore if an IRP is still present.
250 // . Destructor
251 //
253 }
254 }
255
256 return FALSE;
257}
__inline VOID CallCleanup(VOID)
Definition: fxobject.hpp:815
BOOLEAN __inline IsAllocatedFromIo(VOID)
virtual VOID Dispose(VOID)

◆ EnableContextDisposeNotification()

__inline VOID FxRequestBase::EnableContextDisposeNotification ( VOID  )
inline

Definition at line 280 of file fxrequestbase.hpp.

283 {
285 }

◆ FatalError()

DECLSPEC_NORETURN VOID FxRequestBase::FatalError ( __in NTSTATUS  Status)

Definition at line 816 of file fxrequestbase.cpp.

819{
821
822 RtlZeroMemory(&data, sizeof(data));
823
824 data.Queue = NULL;
825 data.Request = (WDFREQUEST) GetTraceObjectHandle();
826 data.Status = Status;
827
830 (ULONG_PTR) &data);
831}
__inline PVOID GetTraceObjectHandle(VOID)
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
Status
Definition: gdiplustypes.h:25
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
uint32_t ULONG_PTR
Definition: typedefs.h:65
@ WDF_QUEUE_FATAL_ERROR
Definition: wdfbugcodes.h:67

◆ FreeMdls()

VOID __inline FxRequestBase::FreeMdls ( VOID  )

Definition at line 31 of file fxrequestbasekm.hpp.

34{
35 PMDL pMdl, pNext;
36
38 return;
39 }
40
41 pMdl = m_Irp.GetIrp()->MdlAddress;
42
43 //
44 // Free any PMDLs that the lower layer allocated. Since we are going
45 // to free the PIRP ourself and not call IoCompleteRequest, we must mimic
46 // the behavior in IoCompleteRequest which does the same thing.
47 //
48 while (pMdl != NULL) {
49 pNext = pMdl->Next;
50
51 if (pMdl->MdlFlags & MDL_PAGES_LOCKED) {
52 MmUnlockPages(pMdl);
53 }
54 else if (GetDriverGlobals()->FxVerifierOn) {
55 DbgPrint("pMdl %p, Flags 0x%x in PIRP %p should be locked",
56 pMdl, pMdl->MdlFlags, m_Irp.GetIrp());
57
59 }
60
61 FxIrpMdlFree(pMdl);
62 pMdl = pNext;
63 }
64
65 m_Irp.GetIrp()->MdlAddress = NULL;
66}
BOOLEAN __inline IsCanComplete(VOID)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
VOID __inline FxIrpMdlFree(__in PMDL Mdl)
Definition: fxmdl.h:75
#define DbgPrint
Definition: hal.h:12
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19

◆ FX_DECLARE_VF_FUNCTION()

FxRequestBase::FX_DECLARE_VF_FUNCTION ( VOID  ,
VerifyDispose   
)
protected

◆ GetContext()

__inline FxRequestContext * FxRequestBase::GetContext ( VOID  )
inline

◆ GetHandle()

__inline WDFREQUEST FxRequestBase::GetHandle ( VOID  )
inline

◆ GetPriorityBoost()

CCHAR __inline FxRequestBase::GetPriorityBoost ( VOID  )
inline

Definition at line 613 of file fxrequestbase.hpp.

616 {
617 return m_PriorityBoost;
618 }

Referenced by FxRequest::CompleteInternal(), and FxRequest::Release().

◆ GetSubmitFxIrp()

◆ GetSubmitIrp()

__inline MdIrp FxRequestBase::GetSubmitIrp ( VOID  )
inline

Definition at line 310 of file fxrequestbase.hpp.

313 {
314 return m_Irp.GetIrp();
315 }

Referenced by __drv_functionClass(), FxUsbPipeContinuousReader::Config(), and ValidateTarget().

◆ GetTarget()

__inline FxIoTarget * FxRequestBase::GetTarget ( VOID  )
inline

Definition at line 357 of file fxrequestbase.hpp.

360 {
361 return m_Target;
362 }

Referenced by FxUsbDevice::_CleanupPipesRequests(), FxRequest::Reuse(), and FxUsbDevice::Start().

◆ GetTargetFlags()

__inline UCHAR FxRequestBase::GetTargetFlags ( VOID  )
inline

Definition at line 375 of file fxrequestbase.hpp.

378 {
379 // Assumes caller is holding appropriate lock
380 return m_TargetFlags;
381 }

Referenced by FxIoTarget::_RequestCancelled(), and FxIoTarget::DrainPendedRequestsLocked().

◆ GetTraceObjectHandle()

__inline PVOID FxRequestBase::GetTraceObjectHandle ( VOID  )
inline

Definition at line 675 of file fxrequestbase.hpp.

678 {
680
682
683 if (handle != NULL) {
684 return handle;
685 }
686 else {
687 return (PVOID) this;
688 }
689 }

Referenced by FxIoTarget::_RequestCancelled(), FxIoTarget::DrainPendedRequestsLocked(), FatalError(), FxRequest::Reuse(), and ValidateTarget().

◆ GetVerifierFlags()

__inline SHORT FxRequestBase::GetVerifierFlags ( VOID  )
inline

Definition at line 430 of file fxrequestbase.hpp.

433 {
434 SHORT flags;
435 KIRQL irql;
436
437 Lock(&irql);
439 Unlock(irql);
440
441 return flags;
442 }
SHORT GetVerifierFlagsLocked(VOID)
GLbitfield flags
Definition: glext.h:7161
short SHORT
Definition: pedump.c:59

Referenced by FxIoQueue::DispatchRequestToDriver(), and VerifierIsFormatted().

◆ GetVerifierFlagsLocked()

SHORT FxRequestBase::GetVerifierFlagsLocked ( VOID  )
inline

Definition at line 420 of file fxrequestbase.hpp.

423 {
424 ASSERT(GetDriverGlobals()->FxVerifierOn);
425 return m_VerifierFlags;
426 }

Referenced by GetVerifierFlags(), and FxRequest::Reuse().

◆ HasContext()

__inline BOOLEAN FxRequestBase::HasContext ( VOID  )
inline

Definition at line 299 of file fxrequestbase.hpp.

302 {
303 return (m_RequestContext != NULL &&
306 }
@ FX_REQUEST_CONTEXT_TYPE_NONE
FX_REQUEST_CONTEXT_TYPE m_RequestType

Referenced by FxPkgIo::EnqueueRequest(), and FxRequest::PreProcessSendAndForget().

◆ HasContextType()

__inline BOOLEAN FxRequestBase::HasContextType ( __in FX_REQUEST_CONTEXT_TYPE  Type)
inline

Definition at line 289 of file fxrequestbase.hpp.

292 {
293 return (m_RequestContext != NULL &&
295 }
Type
Definition: Type.h:7

◆ IsAllocatedDriver()

BOOLEAN __inline FxRequestBase::IsAllocatedDriver ( VOID  )
inline

Definition at line 577 of file fxrequestbase.hpp.

580 {
582 }

Referenced by FxRequest::GetFileObject().

◆ IsAllocatedFromIo()

BOOLEAN __inline FxRequestBase::IsAllocatedFromIo ( VOID  )
inline

◆ IsCancelRoutineSet()

__inline BOOLEAN FxRequestBase::IsCancelRoutineSet ( VOID  )
inline

Definition at line 222 of file fxrequestbase.hpp.

225 {
226 return (m_CancelRoutine.m_Cancel != NULL) ?
227 TRUE : FALSE;
228 }
FxRequestCancelCallback m_CancelRoutine
PFN_WDF_REQUEST_CANCEL m_Cancel

Referenced by FxRequest::CompleteInternal().

◆ IsCanComplete()

BOOLEAN __inline FxRequestBase::IsCanComplete ( VOID  )
inline

Definition at line 586 of file fxrequestbase.hpp.

589 {
590 return m_CanComplete;
591 }

Referenced by FxRequest::CompleteInternal(), FreeMdls(), and FxRequest::Release().

◆ IsCompletionRoutineSet()

__inline BOOLEAN FxRequestBase::IsCompletionRoutineSet ( VOID  )
inline

Definition at line 212 of file fxrequestbase.hpp.

215 {
217 TRUE : FALSE;
218 }

◆ SetCompleted()

__inline VOID FxRequestBase::SetCompleted ( __in BOOLEAN  Value)
inline

Definition at line 595 of file fxrequestbase.hpp.

598 {
600 }
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by FxIoQueue::AllocateReservedRequest(), and ClearFieldsForReuse().

◆ SetCompletionRoutine()

__inline VOID FxRequestBase::SetCompletionRoutine ( __in_opt PFN_WDF_REQUEST_COMPLETION_ROUTINE  CompletionRoutine = NULL,
__in_opt WDFCONTEXT  CompletionContext = NULL 
)
inline

Definition at line 175 of file fxrequestbase.hpp.

179 {
182 }
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
Definition: wdfrequest.h:898
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:895

Referenced by FxUsbPipeContinuousReader::FormatRepeater(), and FxRequest::Reuse().

◆ SetContext()

__inline VOID FxRequestBase::SetContext ( __in FxRequestContext RequestContext = NULL)
inline

Definition at line 241 of file fxrequestbase.hpp.

244 {
245 //
246 // If we are setting to the same value, just return
247 //
248 if (m_RequestContext == RequestContext) {
249 return;
250 }
251
252 //
253 // If we are changing the context to another unique pointer, free the
254 // old context.
255 //
256 if (m_RequestContext != NULL) {
257 delete m_RequestContext;
258 }
259
260 m_RequestContext = RequestContext;
261 }

◆ SetPriorityBoost()

VOID __inline FxRequestBase::SetPriorityBoost ( CCHAR  PriorityBoost)
inline

Definition at line 604 of file fxrequestbase.hpp.

607 {
609 }
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
Definition: wdfrequest.h:1016

Referenced by ClearFieldsForReuse(), FxRequest::Complete(), and FxRequest::CompleteWithPriority().

◆ SetRequestBaseFlags()

__inline VOID FxRequestBase::SetRequestBaseFlags ( __in UCHAR  Flags)
inline

Definition at line 411 of file fxrequestbase.hpp.

414 {
415 // Assumes caller is holding appropriate lock
417 }

◆ SetSubmitIrp()

MdIrp FxRequestBase::SetSubmitIrp ( __in_opt MdIrp  NewIrp,
__in BOOLEAN  FreeIrp = TRUE 
)

Definition at line 382 of file fxrequestbase.cpp.

386{
387 MdIrp pOldIrp, pIrpToFree;
388
389 pIrpToFree = NULL;
390 pOldIrp = m_Irp.SetIrp(NewIrp);
391
392 if (NewIrp != NULL) {
394 }
395
396 //
397 // If there is a previous irp that is not the current value and we
398 // allocated it ourselves and the caller wants us to free it, do so.
399 //
400 if (pOldIrp != NULL &&
401 pOldIrp != NewIrp &&
403 if (FreeIrp) {
404 FxIrp oldIrp(pOldIrp);
405 oldIrp.FreeIrp();
406 }
407 else {
408 pIrpToFree = pOldIrp;
409 }
410 }
411
412 return pIrpToFree;
413}
Definition: fxirp.hpp:28
MdIrp SetIrp(MdIrp irp)
Definition: fxirpkm.hpp:71

Referenced by FxRequest::_Create(), and ValidateTarget().

◆ SetTarget()

VOID __inline FxRequestBase::SetTarget ( __in FxIoTarget Target)
inline

Definition at line 366 of file fxrequestbase.hpp.

369 {
371 }
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by FxUsbPipe::GotoStartState().

◆ SetTargetFlags()

__inline VOID FxRequestBase::SetTargetFlags ( __in UCHAR  Flags)
inline

Definition at line 385 of file fxrequestbase.hpp.

388 {
389 // Assumes caller is holding appropriate lock
391 }

Referenced by FxIoTarget::DrainPendedRequestsLocked().

◆ SetVerifierFlags()

__inline VOID FxRequestBase::SetVerifierFlags ( __in SHORT  Flags)
inline

Definition at line 455 of file fxrequestbase.hpp.

458 {
459 KIRQL irql;
460
461 ASSERT(GetDriverGlobals()->FxVerifierOn);
462
463 Lock(&irql);
465 Unlock(irql);
466 }
__inline VOID SetVerifierFlagsLocked(__in SHORT Flags)

Referenced by FxIoQueue::DispatchRequestToDriver(), FxIoQueue::PeekRequest(), FxIoQueue::RequestCancelable(), FxRequest::Reuse(), and VerifierSetFormatted().

◆ SetVerifierFlagsLocked()

__inline VOID FxRequestBase::SetVerifierFlagsLocked ( __in SHORT  Flags)
inline

Definition at line 446 of file fxrequestbase.hpp.

449 {
451 }

Referenced by SetVerifierFlags().

◆ ShouldClearContext()

__inline BOOLEAN FxRequestBase::ShouldClearContext ( VOID  )
inline

Definition at line 536 of file fxrequestbase.hpp.

539 {
541 : FALSE;
542 }
@ FxRequestBaseSyncCleanupContext

◆ StartTimer()

VOID FxRequestBase::StartTimer ( __in LONGLONG  Timeout)

Definition at line 736 of file fxrequestbase.cpp.

754{
756 timeout.QuadPart = Timeout;
757
759
761
762}
__inline VOID Start(__in LARGE_INTEGER DueTime, __in ULONG TolerableDelay=0)
Definition: mxtimerkm.h:251
static ULONG Timeout
Definition: ping.c:61
Definition: dhcpd.h:245

◆ ValidateTarget()

_Must_inspect_result_ NTSTATUS FxRequestBase::ValidateTarget ( __in FxIoTarget Target)

Definition at line 299 of file fxrequestbase.cpp.

302{
303 MdIrp pIrp, pOldIrp;
304 FxIrp fxIrp;
306
307 pOldIrp = NULL;
308
309 pIrp = GetSubmitIrp();
311
312 //
313 // Must restore to the previous irp in case we reallocate the irp
314 //
316
317 if (Target->HasValidStackSize() == FALSE) {
318
319 //
320 // Target is closed down
321 //
323
325 "WDFIOTARGET %p is closed, cannot validate, %!STATUS!",
326 Target->GetHandle(), status);
327 }
328 else if (pIrp != NULL && Target->HasEnoughStackLocations(&fxIrp)) {
330 }
332 //
333 // Try to allocate a new irp.
334 //
335 pIrp = FxIrp::AllocateIrp(Target->m_TargetStackSize, Target->GetDevice());
336
337 if (pIrp == NULL) {
341 "Could not allocate irp for WDFREQUEST %p for WDFIOTARGET %p,"
342 " %!STATUS!", GetTraceObjectHandle(), Target->GetHandle(), status);
343 }
344 else {
345 pOldIrp = SetSubmitIrp(pIrp, FALSE);
348 }
349 }
350 else {
351 //
352 // The internal IRP is not owned by this object, so we can't reallocate
353 // it.
354 //
355
356
357
358
359
360
361
363
366 "Cannot reallocate PIRP for WDFREQUEST %p using WDFIOTARGET %p,"
367 " %!STATUS!", GetTraceObjectHandle(), Target->GetHandle(), status);
368 }
369
370 if (pOldIrp != NULL) {
372 "Freeing irp %p from WDFREQUEST %p\n",
373 pOldIrp, GetTraceObjectHandle());
374 FxIrp oldIrp(pOldIrp);
375 oldIrp.FreeIrp();
376 }
377
378 return status;
379}
static _Must_inspect_result_ MdIrp AllocateIrp(_In_ CCHAR StackSize, _In_opt_ FxDevice *Device=NULL)
Definition: fxirpum.cpp:1089
MdIrp SetSubmitIrp(__in_opt MdIrp NewIrp, __in BOOLEAN FreeIrp=TRUE)
__inline MdIrp GetSubmitIrp(VOID)
VOID ContextReleaseAndRestore(VOID)
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
FxIrp fxIrp(Irp)
FxIrp * pIrp
#define STATUS_REQUEST_NOT_ACCEPTED
Definition: ntstatus.h:444
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178

Referenced by FxRequest::_Create().

◆ VerifierClearFormatted()

__inline VOID FxRequestBase::VerifierClearFormatted ( VOID  )
inline

Definition at line 506 of file fxrequestbase.hpp.

509 {
510 if (GetDriverGlobals()->FxVerifierOn &&
511 GetDriverGlobals()->FxVerifierIO) {
513 }
514 }
__inline VOID ClearVerifierFlags(__in SHORT Flags)
@ FXREQUEST_FLAG_FORMATTED

Referenced by CompleteSubmitted(), and ContextReleaseAndRestore().

◆ VerifierIsFormatted()

__inline BOOLEAN FxRequestBase::VerifierIsFormatted ( VOID  )
inline

Definition at line 518 of file fxrequestbase.hpp.

521 {
522 if (GetDriverGlobals()->FxVerifierOn &&
523 GetDriverGlobals()->FxVerifierIO) {
525 }
526 else {
527 //
528 // we are not tracking the state
529 //
530 return TRUE;
531 }
532 }
__inline SHORT GetVerifierFlags(VOID)

◆ VerifierSetFormatted()

__inline VOID FxRequestBase::VerifierSetFormatted ( VOID  )
inline

Definition at line 494 of file fxrequestbase.hpp.

497 {
498 if (GetDriverGlobals()->FxVerifierOn &&
499 GetDriverGlobals()->FxVerifierIO) {
501 }
502 }
__inline VOID SetVerifierFlags(__in SHORT Flags)

◆ ZeroOutDriverContext()

VOID FxRequestBase::ZeroOutDriverContext ( VOID  )
inlineprotected

Definition at line 744 of file fxrequestbase.hpp.

747 {
748#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
749 RtlZeroMemory(GetSubmitFxIrp()->GetDriverContext(),
750 GetSubmitFxIrp()->GetDriverContextSize());
751#else
752 //
753 // UMDF host doesn't expose any easier way to zero out the contexts so
754 // set context to NULL one by one.
755 //
760#endif
761 }
VOID SetContext(__in ULONG Index, __in PVOID Value)
Definition: fxirpum.cpp:351

Referenced by CompleteSubmitted().

Member Data Documentation

◆ 

union { ... } FxRequestBase::@4803

◆ 

union { ... } FxRequestBase::@4805

◆ 

union { ... } FxRequestBase::@4807

◆ 

union { ... } FxRequestBase::@4809

◆ 

union { ... } FxRequestBase::@4811

◆ 

union { ... } FxRequestBase::@4813

◆ _TimerDPC

VOID FxRequestBase::_TimerDPC
staticprotected

Definition at line 736 of file fxrequestbase.hpp.

Referenced by CreateTimer().

◆ Cancelled

SHORT FxRequestBase::Cancelled

Definition at line 889 of file fxrequestbase.hpp.

◆ CancelledFromTimer

UCHAR FxRequestBase::CancelledFromTimer

Definition at line 858 of file fxrequestbase.hpp.

◆ Completed

UCHAR FxRequestBase::Completed

Definition at line 855 of file fxrequestbase.hpp.

◆ DriverCancelable

SHORT FxRequestBase::DriverCancelable

Definition at line 887 of file fxrequestbase.hpp.

◆ DriverDispatch

SHORT FxRequestBase::DriverDispatch

Definition at line 886 of file fxrequestbase.hpp.

◆ DriverInEvtIoStopContext

SHORT FxRequestBase::DriverInEvtIoStopContext

Definition at line 892 of file fxrequestbase.hpp.

◆ DriverInprocessContext

SHORT FxRequestBase::DriverInprocessContext

Definition at line 888 of file fxrequestbase.hpp.

◆ DriverOwned

SHORT FxRequestBase::DriverOwned

Definition at line 883 of file fxrequestbase.hpp.

◆ FlagsPended

UCHAR FxRequestBase::FlagsPended

Definition at line 856 of file fxrequestbase.hpp.

◆ Formatted

SHORT FxRequestBase::Formatted

Definition at line 890 of file fxrequestbase.hpp.

◆ Forwarded

SHORT FxRequestBase::Forwarded

Definition at line 885 of file fxrequestbase.hpp.

◆ FxIoTarget

friend FxRequestBase::FxIoTarget
private

Definition at line 168 of file fxrequestbase.hpp.

◆ FxSyncRequest

friend FxRequestBase::FxSyncRequest
private

Definition at line 169 of file fxrequestbase.hpp.

◆ IgnoreState

UCHAR FxRequestBase::IgnoreState

Definition at line 859 of file fxrequestbase.hpp.

◆ m_AllocatedMdl

PMDL FxRequestBase::m_AllocatedMdl
protected

◆ m_Canceled

◆ m_CancelRoutine

FxRequestCancelCallback FxRequestBase::m_CancelRoutine
protected

Definition at line 828 of file fxrequestbase.hpp.

Referenced by IsCancelRoutineSet(), and FxIoQueue::RequestCancelable().

◆ m_CanComplete

BOOLEAN FxRequestBase::m_CanComplete
protected

◆ m_Completed

◆ m_CompletionRoutine

FxRequestCompletionCallback FxRequestBase::m_CompletionRoutine
protected

◆ m_CompletionState

◆ m_CsqContext

◆ m_DrainSingleEntry

◆ m_Irp

◆ m_IrpAllocation

UCHAR FxRequestBase::m_IrpAllocation
protected

◆ m_IrpCompletionReferenceCount

LONG FxRequestBase::m_IrpCompletionReferenceCount
protected

Definition at line 840 of file fxrequestbase.hpp.

Referenced by Cancel(), CanComplete(), ClearFieldsForReuse(), and FxRequestBase().

◆ m_IrpQueue

◆ m_IrpReferenceCount

LONG FxRequestBase::m_IrpReferenceCount
protected

◆ m_ListEntry

◆ m_NextStackLocationFormatted

BOOLEAN FxRequestBase::m_NextStackLocationFormatted

Definition at line 795 of file fxrequestbase.hpp.

Referenced by ClearFieldsForReuse(), and FxRequest::PreProcessSendAndForget().

◆ m_OutputBufferOffset

WDFOBJECT_OFFSET_ALIGNED FxRequestBase::m_OutputBufferOffset
protected

◆ m_PriorityBoost

CCHAR FxRequestBase::m_PriorityBoost
protected

Definition at line 937 of file fxrequestbase.hpp.

Referenced by FxRequestBase(), GetPriorityBoost(), and SetPriorityBoost().

◆ m_RequestBaseFlags

◆ 

struct { ... } FxRequestBase::m_RequestBaseFlagsByName

◆ m_RequestBaseStaticFlags

◆ 

struct { ... } FxRequestBase::m_RequestBaseStaticFlagsByName

◆ m_RequestContext

◆ m_SystemBufferOffset

WDFOBJECT_OFFSET_ALIGNED FxRequestBase::m_SystemBufferOffset
protected

◆ m_Target

FxIoTarget* FxRequestBase::m_Target
protected

◆ m_TargetCompletionContext

WDFCONTEXT FxRequestBase::m_TargetCompletionContext
protected

◆ m_TargetFlags

UCHAR FxRequestBase::m_TargetFlags

◆ 

struct { ... } FxRequestBase::m_TargetFlagsByName

◆ m_Timer

FxRequestTimer* FxRequestBase::m_Timer
protected

◆ 

struct { ... } FxRequestBase::m_VeriferFlagsByName

◆ m_VerifierFlags

SHORT FxRequestBase::m_VerifierFlags

◆ OutputBufferValid

UCHAR FxRequestBase::OutputBufferValid

Definition at line 930 of file fxrequestbase.hpp.

◆ OutputMdlMapped

UCHAR FxRequestBase::OutputMdlMapped

Definition at line 915 of file fxrequestbase.hpp.

◆ SentToTarget

SHORT FxRequestBase::SentToTarget

Definition at line 891 of file fxrequestbase.hpp.

◆ SyncCleanupContext

UCHAR FxRequestBase::SyncCleanupContext

Definition at line 916 of file fxrequestbase.hpp.

◆ SystemBufferValid

UCHAR FxRequestBase::SystemBufferValid

Definition at line 929 of file fxrequestbase.hpp.

◆ SystemMdlMapped

UCHAR FxRequestBase::SystemMdlMapped

Definition at line 914 of file fxrequestbase.hpp.

◆ TagRequest

SHORT FxRequestBase::TagRequest

Definition at line 884 of file fxrequestbase.hpp.

Referenced by FxRequest::GetNextRequest(), and FxRequest::PeekRequest().

◆ TimerSet

UCHAR FxRequestBase::TimerSet

Definition at line 857 of file fxrequestbase.hpp.


The documentation for this class was generated from the following files: