ReactOS  0.4.15-dev-2155-g06f57e1
FxObject Class Reference

#include <fxobject.hpp>

Inheritance diagram for FxObject:
Collaboration diagram for FxObject:

Public Member Functions

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 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)
 

Protected Member Functions

 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)
 

Static Protected Member Functions

static PVOID _GetBase (__in FxObject *Object)
 

Protected Attributes

union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Private Member Functions

 FxObject (VOID)
 
 FX_DECLARE_VF_FUNCTION_P1 (VOID, VerifyConstruct, _In_ BOOLEAN)
 
VOID __inline Construct (__in BOOLEAN Embedded)
 
VOID __inline SetObjectStateLocked (__in FxObjectState NewState)
 
VOID FinalRelease (VOID)
 
BOOLEAN MarkDeleteCalledLocked (VOID)
 
BOOLEAN IsPassiveCallbacksLocked (VOID)
 
BOOLEAN IsPassiveDisposeLocked (VOID)
 
BOOLEAN IsForceDisposeThreadLocked (VOID)
 
BOOLEAN ShouldDeferDisposeLocked (__out_opt PKIRQL PreviousIrql=NULL)
 
VOID ParentDeleteEvent (VOID)
 
BOOLEAN PerformEarlyDispose (VOID)
 
 _Releases_lock_ (this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN PerformEarlyDisposeWorkerAndUnlock(__in __drv_restoresIRQL KIRQL OldIrql
 
 _Releases_lock_ (this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN PerformDisposingDisposeChildrenLocked(__in __drv_restoresIRQL KIRQL OldIrql
 
 _Releases_lock_ (this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN DeleteWorkerAndUnlock(__in __drv_restoresIRQL KIRQL OldIrql
 
VOID QueueDeferredDisposeLocked (__in FxObjectState NewDeferedState)
 
VOID DeferredDisposeWorkItem (VOID)
 
 _Releases_lock_ (this->m_SpinLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) BOOLEAN DisposeChildrenWorker(__in FxObjectState NewDeferedState
 
 _When_ (Unlock, _Releases_lock_(this->m_SpinLock.m_Lock)) __drv_when(Unlock
 
 __drv_requiresIRQL (DISPATCH_LEVEL)) VOID DeletedAndDisposedWorkerLocked(__in __drv_when(Unlock
 
_Must_inspect_result_ NTSTATUS RemoveParentAssociation (VOID)
 
_Must_inspect_result_ NTSTATUS AddChildObjectInternal (__in FxObject *ChildObject)
 
_Must_inspect_result_ NTSTATUS RemoveChildObjectInternal (__in FxObject *ChildObject)
 
VOID ProcessDestroy (VOID)
 
VOID CallCleanupCallbacks (VOID)
 

Private Attributes

friend UfxObject
 
friend FxDisposeList
 
PVOID m_COMWrapper
 
WDFTYPE m_Type
 
USHORT m_ObjectSize
 
LONG m_Refcnt
 
PFX_DRIVER_GLOBALS m_Globals
 
union {
   USHORT   m_ObjectFlags
 
   struct {
      USHORT   PassiveCallbacks: 1
 
      USHORT   NoDeleteDDI: 1
 
      USHORT   DeleteCalled: 1
 
      USHORT   Committed: 1
 
      USHORT   PassiveDispose: 1
 
      USHORT   ForceDisposeThread: 1
 
      USHORT   Unused: 1
 
      USHORT   HasDebug: 1
 
      USHORT   EarlyDisposedExt: 1
 
      USHORT   TraceState: 1
 
   }   m_ObjectFlagsByName
 
}; 
 
USHORT m_ObjectState
 
LIST_ENTRY m_ChildListHead
 
MxLock m_SpinLock
 
FxObjectm_ParentObject
 
LIST_ENTRY m_ChildEntry
 
SINGLE_LIST_ENTRY m_DisposeSingleEntry
 
__in BOOLEAN CanDefer
 
__in __drv_restoresIRQL KIRQL OldIrql
 
__in __drv_restoresIRQL KIRQL __in BOOLEAN CanDefer
 
__drv_restoresIRQL KIRQL OldIrql
 
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
 

Friends

VOID GetTriageInfo (VOID)
 

Detailed Description

Definition at line 232 of file fxobject.hpp.

Constructor & Destructor Documentation

◆ FxObject() [1/3]

FxObject::FxObject ( VOID  )
inlineprivate

Definition at line 333 of file fxobject.hpp.

336  {
337  // Always make the caller supply a type and size
338  }

◆ FxObject() [2/3]

FxObject::FxObject ( __in WDFTYPE  Type,
__in USHORT  Size,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in FxObjectType  ObjectType 
)
protected

Definition at line 68 of file fxobject.cpp.

73  :
74  m_Type(Type),
76  m_Globals(FxDriverGlobals)
77 {
79  //
80  // only for non embedded objects
81  //
82  ASSERT((((ULONG_PTR) this) & FxHandleFlagMask) == 0x0);
83  }
84 
86 }
ObjectType
Definition: metafile.c:80
GLint x0
Definition: linetemp.h:95
#define TRUE
Definition: types.h:120
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID __inline Construct(__in BOOLEAN Embedded)
Definition: fxobject.hpp:349
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
#define ASSERT(a)
Definition: mode.c:45
Type
Definition: Type.h:6
USHORT m_ObjectSize
Definition: fxobject.hpp:254
WDFTYPE m_Type
Definition: fxobject.hpp:247
unsigned short USHORT
Definition: pedump.c:61
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90

◆ FxObject() [3/3]

FxObject::FxObject ( __in WDFTYPE  Type,
__in USHORT  Size,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals 
)

Definition at line 49 of file fxobject.cpp.

53  :
54  m_Type(Type),
56  m_Globals(FxDriverGlobals)
57 #if FX_CORE_MODE==FX_CORE_USER_MODE
58 #ifndef INLINE_WRAPPER_ALLOCATION
60 #endif
61 #endif
62 {
63  ASSERT((((ULONG_PTR) this) & FxHandleFlagMask) == 0x0);
64 
66 }
PVOID m_COMWrapper
Definition: fxobject.hpp:243
GLint x0
Definition: linetemp.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID __inline Construct(__in BOOLEAN Embedded)
Definition: fxobject.hpp:349
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
#define ASSERT(a)
Definition: mode.c:45
Type
Definition: Type.h:6
USHORT m_ObjectSize
Definition: fxobject.hpp:254
WDFTYPE m_Type
Definition: fxobject.hpp:247
unsigned short USHORT
Definition: pedump.c:61
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define NULL
Definition: types.h:112
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90

◆ ~FxObject()

FxObject::~FxObject ( VOID  )
virtual

Definition at line 88 of file fxobject.cpp.

89 {
90  FxTagTracker *pTagTracker;
91 
92 
93 
94 
95 
96 
97 
98  pTagTracker = GetTagTracker();
99 
100  if (pTagTracker != NULL) {
101  delete pTagTracker;
102  }
103 
105 
106  //
107  // We need to ensure there are no leaked child objects, or
108  // parent associations.
109  //
110  // This can occur if someone calls the C++ operator delete,
111  // or Release() to destroy the object.
112  //
113  // This is generally invalid in the framework, though certain
114  // objects may understand the underlying contract, but must
115  // make sure there are no left over un-Disposed associations.
116  //
117  // Embedded FxObject's also don't have delete called on them,
118  // and have to manually manage any child associations when
119  // their parent object disposes by calling PerformEarlyDispose.
120  //
121  // They don't have an associated lifetime parent since they
122  // are embedded.
123  //
124  if (m_ParentObject != NULL ||
126  PCSTR pHandleName;
127 
128  pHandleName = FxObjectTypeToHandleName(m_Type);
129  if (pHandleName == NULL) {
130  pHandleName = "WDFOBJECT";
131  }
132 
133  ASSERTMSG(
134  "Object was freed using WdfObjectDereference, not WdfObjectDelete\n",
135  m_ParentObject == NULL &&
138  );
139 
142  "Handle %s %p (raw object %p) was freed using "
143  "WdfObjectDereference(), not WdfObjectDelete()",
144  pHandleName, GetObjectHandleUnchecked(), this);
145 
149  (ULONG_PTR) this);
150  }
151 
152  //
153  // This is called when the reference count goes to zero
154  //
156 }
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
FxTagTracker * GetTagTracker(VOID)
Definition: fxobject.hpp:766
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
PCSTR FxObjectTypeToHandleName(__in WDFTYPE ObjectType)
Definition: globals.cpp:316
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define TRACE_LEVEL_FATAL
Definition: storswtr.h:26
#define TRACINGOBJECT
Definition: dbgtrace.h:59
SINGLE_LIST_ENTRY m_DisposeSingleEntry
Definition: fxobject.hpp:316
#define ASSERT(a)
Definition: mode.c:45
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
WDFTYPE m_Type
Definition: fxobject.hpp:247
ASSERTMSG("this object's type is not listed in FxObjectsInfo\n", FxVerifyObjectTypeInTable(m_Type))
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
const char * PCSTR
Definition: typedefs.h:52
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293

Member Function Documentation

◆ __drv_requiresIRQL()

FxObject::__drv_requiresIRQL ( DISPATCH_LEVEL  )
private

◆ _CleanupPointer()

static PFX_POOL_HEADER FxObject::_CleanupPointer ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in FxObject Object 
)
inlinestatic

Definition at line 1273 of file fxobject.hpp.

1277  {
1279  PVOID pObjectBase;
1280 
1281  pObjectBase = _GetBase(Object);
1282 
1283  pHeader = CONTAINING_RECORD(pObjectBase, FX_POOL_HEADER, AllocationStart);
1284 
1285  //
1286  // If PoolTracker is on then do....
1287  //
1288  if (FxDriverGlobals->IsPoolTrackingOn()) {
1289  //
1290  // Decommission this NonPaged Allocation tracker
1291  //
1293  }
1294 
1295  return pHeader;
1296  }
static PVOID _GetBase(__in FxObject *Object)
Definition: fxobject.hpp:418
VOID __inline FxPoolRemoveNonPagedAllocateTracker(__in PFX_POOL_TRACKER Tracker)
FxContextHeader * pHeader
Definition: handleapi.cpp:604
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
FX_POOL_TRACKER * PFX_POOL_TRACKER
Definition: fxpool.h:107

Referenced by FxLookasideList::_Reclaim(), FxDevice::FreeRequestMemory(), and FxRequestFromLookaside::SelfDestruct().

◆ _DereferenceActual()

FxObject::_DereferenceActual ( __in WDFOBJECT  Object,
__in_opt PVOID  Tag,
__in LONG  Line,
__in PSTR  File 
)
inlinestatic

Definition at line 697 of file fxobject.hpp.

703  {
704  FxObject* pObject;
706 
707  offset = 0;
709 
710  if (offset == 0) {
712  }
713  else {
715  }
716  }
FxObject * pObject
virtual ULONG Release(__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:853
USHORT WDFOBJECT_OFFSET
Definition: fxobject.hpp:80
GLintptr offset
Definition: glext.h:5920
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
virtual ULONG ReleaseOverride(__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:892
static FxObject * _GetObjectFromHandle(__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
Definition: fxobject.hpp:613
Definition: File.h:15

◆ _FromDisposeEntry()

static FxObject* FxObject::_FromDisposeEntry ( __in PSINGLE_LIST_ENTRY  Entry)
inlinestatic

Definition at line 580 of file fxobject.hpp.

583  {
585  }
SINGLE_LIST_ENTRY m_DisposeSingleEntry
Definition: fxobject.hpp:316
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
base of all file and directory entries
Definition: entries.h:82

Referenced by FxDisposeList::DrainListLocked().

◆ _GetBase()

static PVOID FxObject::_GetBase ( __in FxObject Object)
inlinestaticprotected

Definition at line 418 of file fxobject.hpp.

421  {
422  if (Object->IsDebug()) {
423  return _GetDebugBase(Object);
424  }
425  else {
426  return (PVOID) Object;
427  }
428  }
static PVOID _GetDebugBase(__in FxObject *Object)
Definition: fxobject.hpp:806
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by _CleanupPointer(), FxNPagedLookasideList::Allocate(), FxPagedLookasideListFromPool::Allocate(), FxNPagedLookasideListFromPool::Allocate(), and operator delete().

◆ _GetDebugBase()

static PVOID FxObject::_GetDebugBase ( __in FxObject Object)
inlinestatic

Definition at line 806 of file fxobject.hpp.

809  {
810  return CONTAINING_RECORD(Object, FxObjectDebugExtension, AllocationStart);
811  }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by _GetBase().

◆ _GetEffectiveLock()

_Must_inspect_result_ NTSTATUS FxObject::_GetEffectiveLock ( __in FxObject Object,
__in_opt IFxHasCallbacks Callbacks,
__in BOOLEAN  AutomaticLocking,
__in BOOLEAN  PassiveCallbacks,
__out FxCallbackLock **  CallbackLock,
__out_opt FxObject **  CallbackLockObject 
)
static

Definition at line 1044 of file fxobject.cpp.

1084 {
1086  WDF_EXECUTION_LEVEL parentLevel;
1087  WDF_SYNCHRONIZATION_SCOPE parentScope;
1088 
1089  pFxDriverGlobals = Object->GetDriverGlobals();
1090  *CallbackLock = NULL;
1091  *CallbackLockObject = NULL;
1092 
1093  //
1094  // No automatic locking, nothing to do
1095  //
1096  if (AutomaticLocking == FALSE) {
1097  return STATUS_SUCCESS;
1098  }
1099 
1100  //
1101  // Objects that have callback locks must support this interface.
1102  //
1103  if (Callbacks == NULL) {
1105  }
1106 
1107  //
1108  // Get the callback constraints in effect for the object
1109  //
1110  Callbacks->GetConstraints(&parentLevel, &parentScope);
1111 
1112  if (parentScope == WdfSynchronizationScopeInheritFromParent ||
1113  parentScope == WdfSynchronizationScopeNone) {
1114  //
1115  // Do nothing, no synchronization specified
1116  //
1117  DO_NOTHING();
1118  }
1119  else {
1120  //
1121  // If the caller wants passive callbacks and the object does not support
1122  // it, failure.
1123  //
1124  // If the caller wants non passive callbacks and the object supports
1125  // passive only callbacks, failure.
1126  //
1127  if ((PassiveCallbacks && Object->IsPassiveCallbacks() == FALSE) ||
1128  (PassiveCallbacks == FALSE && Object->IsPassiveCallbacks())) {
1131  }
1132 
1133  *CallbackLock = Callbacks->GetCallbackLockPtr(CallbackLockObject);
1134  }
1135 
1136  return STATUS_SUCCESS;
1137 }
USHORT PassiveCallbacks
Definition: fxobject.hpp:273
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define FALSE
Definition: types.h:117
#define STATUS_WDF_INCOMPATIBLE_EXECUTION_LEVEL
Definition: wdfstatus.h:198
enum _WDF_SYNCHRONIZATION_SCOPE WDF_SYNCHRONIZATION_SCOPE
PFX_DRIVER_GLOBALS pFxDriverGlobals
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define NULL
Definition: types.h:112
WDF_EXTERN_C_START enum _WDF_EXECUTION_LEVEL WDF_EXECUTION_LEVEL
#define STATUS_SUCCESS
Definition: shellext.h:65
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define DO_NOTHING()
Definition: mxgeneral.h:32

Referenced by FxTimer::Initialize(), FxDpc::Initialize(), FxWorkItem::Initialize(), and FxInterrupt::InitializeWorker().

◆ _GetObjectFromHandle()

static FxObject* FxObject::_GetObjectFromHandle ( __in WDFOBJECT  Handle,
__inout PWDFOBJECT_OFFSET  ObjectOffset 
)
inlinestatic

Definition at line 613 of file fxobject.hpp.

617  {
619 
620  handle = (ULONG_PTR) Handle;
621 
622  //
623  // store the flags and then clear them off so we have a valid value
624  //
627 
628  //
629  // It is assumed the caller has already set the offset to zero
630  //
631  // *ObjectOffset = 0;
632 
633  //
634  // We always apply the mask
635  //
637 
638  if (flags & FxHandleFlagIsOffset) {
639  //
640  // The handle is a pointer to an offset value. Return the offset
641  // to the caller and then compute the object since the pointer
642  // to the offset is part of the object we are returning.
643  //
644  *ObjectOffset = *(PWDFOBJECT_OFFSET) handle;
645 
646  return (FxObject*) (((PUCHAR) handle) - *ObjectOffset);
647  }
648  else {
649  //
650  // No offset, no verification. We pass the FxObject as the handle
651  //
652  return (FxObject*) handle;
653  }
654  }
unsigned char * PUCHAR
Definition: retypes.h:3
uint32_t ULONG_PTR
Definition: typedefs.h:65
USHORT * PWDFOBJECT_OFFSET
Definition: fxobject.hpp:80
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
DECLSPEC_SELECTANY const ULONG_PTR FxHandleValueMask
GLbitfield flags
Definition: glext.h:7161
_In_ HANDLE Handle
Definition: extypes.h:390
#define ULONG_PTR
Definition: config.h:101

Referenced by _DereferenceActual(), _ReferenceActual(), FxObjectHandleGetPtr(), FxObjectHandleGetPtrOffset(), PerfEvtDeviceD0EntryStart(), PerfEvtDeviceD0ExitStart(), PerfEvtDevicePrepareHardwareStart(), PerfEvtDeviceReleaseHardwareStart(), PerfEvtIoStopStart(), PerfEvtIoStopStop(), PerfIoComplete(), PerfIoStart(), PerformanceAnalysisPowerProcess(), PerformanceGetDriverDeviceAdd(), VfAddContextToHandle(), and VfWdfObjectGetTypedContext().

◆ _ObjectQuery()

_Must_inspect_result_ NTSTATUS FxObject::_ObjectQuery ( _In_ FxObject Object,
_In_ CONST GUID Guid,
_In_ ULONG  QueryBufferLength,
_Out_writes_bytes_(QueryBufferLength) PVOID  QueryBuffer 
)
static

Definition at line 39 of file fxobjectkm.cpp.

74 {
75  // PFX_DRIVER_GLOBALS pFxDriverGlobals = Object->GetDriverGlobals();
76 
77  //
78  // Design Note: This interface does not look strongly typed
79  // but it is. The GUID defines a specific strongly typed
80  // contract for QueryBuffer and QueryBufferLength.
81  //
82 
83 #if DBG
84 
85  //
86  // These operations are only available on checked builds for deep unit
87  // testing, code coverage analysis, and model verification.
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101  //
102 
103  // Add code based on the GUID
104 
105  // IsEqualGUID(guid1, guid2), DEFINE_GUID, INITGUID, inc\wnet\guiddef.h
109  UNREFERENCED_PARAMETER(QueryBuffer);
110 #else
114  UNREFERENCED_PARAMETER(QueryBuffer);
115 #endif
116 
117  return STATUS_NOT_FOUND;
118 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID _In_ ULONG QueryBufferLength
Definition: wdfobject.h:760
#define STATUS_NOT_FOUND
Definition: shellext.h:72
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:760
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by __out_bcount().

◆ _ReferenceActual()

FxObject::_ReferenceActual ( __in WDFOBJECT  Object,
__in_opt PVOID  Tag,
__in LONG  Line,
__in PSTR  File 
)
inlinestatic

Definition at line 673 of file fxobject.hpp.

679  {
680  FxObject* pObject;
682 
683  offset = 0;
685 
686  if (offset == 0) {
687  pObject->AddRef(Tag, Line, File);
688  }
689  else {
691  }
692  }
FxObject * pObject
USHORT WDFOBJECT_OFFSET
Definition: fxobject.hpp:80
GLintptr offset
Definition: glext.h:5920
virtual ULONG AddRefOverride(__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:878
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
static FxObject * _GetObjectFromHandle(__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
Definition: fxobject.hpp:613
ULONG __inline AddRef(__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:826
Definition: File.h:15

◆ _Releases_lock_() [1/4]

FxObject::_Releases_lock_ ( this->m_SpinLock.  m_Lock)
private

◆ _Releases_lock_() [2/4]

FxObject::_Releases_lock_ ( this->m_SpinLock.  m_Lock)
private

◆ _Releases_lock_() [3/4]

FxObject::_Releases_lock_ ( this->m_SpinLock.  m_Lock)
private

◆ _Releases_lock_() [4/4]

FxObject::_Releases_lock_ ( this->m_SpinLock.  m_Lock)
private

◆ _ToHandle()

static PVOID __inline FxObject::_ToHandle ( __in FxObject Object)
inlinestatic

Definition at line 659 of file fxobject.hpp.

662  {
663  //
664  // Always XOR the constant. Faster than checking
665  // FxDriverGlobals->FxVerifierHandle.
666  //
667  return (PVOID) (((ULONG_PTR) Object) ^ FxHandleValueMask);
668  }
DECLSPEC_SELECTANY const ULONG_PTR FxHandleValueMask
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define ULONG_PTR
Definition: config.h:101

Referenced by FxDevice::AllocateRequestMemory(), GetObjectHandleUnchecked(), and FxIoQueue::PostRequestCompletedCallback().

◆ _When_()

FxObject::_When_ ( Unlock  ,
_Releases_lock_(this->m_SpinLock.m_Lock)   
)
private

◆ AddChildObjectInternal()

_Must_inspect_result_ NTSTATUS FxObject::AddChildObjectInternal ( __in FxObject ChildObject)
private

Definition at line 703 of file fxobject.cpp.

729 {
730  KIRQL oldIrql;
731 
732  m_SpinLock.Acquire(&oldIrql);
733 
734  //
735  // Can't add child if the current object is being deleted
736  //
739  m_SpinLock.Release(oldIrql);
740  return STATUS_DELETE_PENDING;
741  }
742 
743  //
744  // ChildObject can't already have a parent, and can't
745  // be its own parent.
746  //
747  ASSERT(ChildObject->m_ParentObject == NULL);
748  ASSERT(IsListEmpty(&ChildObject->m_ChildEntry));
749  ASSERT(ChildObject != this);
750 
751  //
752  // Add to our m_ChildList
753  //
754  InsertTailList(&m_ChildListHead, &ChildObject->m_ChildEntry);
755 
756  if (ChildObject->GetDeviceBase() == NULL) {
757  //
758  // Propagate the device base downward to the child
759  //
760  ChildObject->SetDeviceBase(GetDeviceBase());
761  }
762 
763  m_SpinLock.Release(oldIrql);
764 
765  return STATUS_SUCCESS;
766 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
MxLock m_SpinLock
Definition: fxobject.hpp:296
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293
CfxDeviceBase * GetDeviceBase(VOID)
Definition: fxobject.hpp:789
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930

◆ AddContext()

_Must_inspect_result_ NTSTATUS FxObject::AddContext ( __in FxContextHeader Header,
__in PVOID Context,
__in PWDF_OBJECT_ATTRIBUTES  Attributes 
)

Definition at line 605 of file fxobject.cpp.

610 {
611  FxContextHeader *pCur, **ppLast;
613  KIRQL irql;
614 
616 
618 
619  //
620  // This should never happen since all outward facing objects have a
621  // context header; framework never calls this function on internal
622  // objects.
623  //
624  ASSERT(pCur != NULL);
625 
626  //
627  // Acquire the lock to lock the object's state. A side affect of grabbing
628  // the lock is that all updaters who want to add a context are serialized.
629  // All callers who want to find a context do not need to acquire the lock
630  // becuase they are not going to update the list, just read from it.
631  //
632  // Once a context has been added, it will not be removed until the object
633  // has been deleted.
634  //
635  m_SpinLock.Acquire(&irql);
636 
638  //
639  // Iterate over the list of contexts already on this object and see if
640  // this type already is attached.
641  //
642  for (ppLast = &pCur->NextHeader;
643  pCur != NULL;
644  ppLast = &pCur->NextHeader, pCur = pCur->NextHeader) {
645 
646  if (pCur->ContextTypeInfo == Header->ContextTypeInfo) {
647  //
648  // Dupe found, return error but give the caller the context
649  // pointer
650  //
651  if (Context != NULL) {
652  *Context = &pCur->Context[0];
653  }
654 
656  break;
657  }
658  }
659 
660  if (pCur == NULL) {
661  //
662  // By using the interlocked to update, we don't need to use a lock
663  // when walking the list to find the context. The only reason
664  // we are holding the object lock is to lock the current state
665  // (m_ObjectState) of the object.
666  //
669 
670  if (Context != NULL) {
671  *Context = &Header->Context[0];
672  }
673 
674  //
675  // FxContextHeaderInit does not set these callbacks. If this were
676  // the creation of the object itself, FxObject::Commit would have done
677  // this assignment.
678  //
679  Header->EvtDestroyCallback = Attributes->EvtDestroyCallback;
680 
681  if (Attributes->EvtCleanupCallback != NULL) {
682  Header->EvtCleanupCallback = Attributes->EvtCleanupCallback;
684  }
685 
686  }
687  }
688  else {
689  //
690  // Object is being torn down, adding a context is a bad idea because we
691  // cannot guarantee that the cleanup or destroy routines will be called
692  //
694  }
695 
696  m_SpinLock.Release(irql);
697 
698  return status;
699 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
#define STATUS_OBJECT_NAME_EXISTS
Definition: ntstatus.h:114
LONG NTSTATUS
Definition: precomp.h:26
KIRQL irql
Definition: wave.h:1
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: Header.h:8
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
SINGLE_LIST_ENTRY * pCur
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97

Referenced by VfAddContextToHandle().

◆ AddRef()

ULONG __inline FxObject::AddRef ( __in_opt PVOID  Tag = NULL,
__in LONG  Line = 0,
__in_opt PSTR  File = NULL 
)
inline

Definition at line 826 of file fxobject.hpp.

831  {
832  FxTagTracker* pTagTracker;
833  ULONG c;
834 
836 
837  //
838  // Catch the transition from 0 to 1. Since the REF_OBJ starts off at 1,
839  // we should never have to increment to get to this value.
840  //
841  ASSERT(c > 1);
842 
843  pTagTracker = GetTagTracker();
844  if (pTagTracker != NULL) {
845  pTagTracker->UpdateTagHistory(Tag, Line, File, TagAddRef, c);
846  }
847 
848  return c;
849  }
FxTagTracker * GetTagTracker(VOID)
Definition: fxobject.hpp:766
LONG m_Refcnt
Definition: fxobject.hpp:257
#define ASSERT(a)
Definition: mode.c:45
const GLubyte * c
Definition: glext.h:8905
VOID UpdateTagHistory(__in PVOID Tag, __in LONG Line, __in_opt PSTR File, __in FxTagRefType RefType, __in ULONG RefCount)
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
#define InterlockedIncrement
Definition: armddk.h:53
#define NULL
Definition: types.h:112
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
Definition: File.h:15

Referenced by _ReferenceActual(), FxMemoryObject::AddRef(), FxRequest::AddRefOverride(), AddRefOverride(), FxPkgIo::EnqueueRequest(), and FxDmaPacketTransaction::StageTransfer().

◆ AddRefOverride()

virtual ULONG FxObject::AddRefOverride ( __in WDFOBJECT_OFFSET  Offset,
__in_opt PVOID  Tag = NULL,
__in LONG  Line = 0,
__in_opt PSTR  File = NULL 
)
inlinevirtual

Definition at line 878 of file fxobject.hpp.

884  {
886 
887  return AddRef(Tag, Line, File);
888  }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG __inline AddRef(__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:826
Definition: File.h:15

Referenced by _ReferenceActual().

◆ AllocateTagTracker()

VOID FxObject::AllocateTagTracker ( __in WDFTYPE  Type)
protected

Definition at line 273 of file fxobject.cpp.

276 {
277  ASSERT(IsDebug());
278 
279  if (m_Globals->DebugExtension != NULL &&
283  Type)) {
284  //
285  // Failure to CreateAndInitialize a tag tracker is no big deal, we just
286  // don't track references.
287  //
288 
291  m_Globals,
293  FALSE,
294  this
295  );
296 
297  //
298  // For now we overload the requirement of a tag tracker as also tracing
299  // state changes.
300  //
302  }
303 }
FxObjectDebugInfo * ObjectDebugInfo
Definition: fxglobals.h:118
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
FxDriverGlobalsDebugExtension * DebugExtension
Definition: fxglobals.h:376
static _Must_inspect_result_ NTSTATUS __inline CreateAndInitialize(__out FxTagTracker **TagTracker, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxTagTrackerType Type, __in BOOLEAN CaptureStack, __in FxObject *Owner, __in_opt PVOID CreateTag=NULL)
#define FALSE
Definition: types.h:117
_Must_inspect_result_ BOOLEAN FxVerifierGetTrackReferences(__in FxObjectDebugInfo *DebugInfo, __in WDFTYPE ObjectType)
Definition: globals.cpp:338
#define ASSERT(a)
Definition: mode.c:45
Type
Definition: Type.h:6
FxObjectDebugExtension * GetDebugExtension(VOID)
Definition: fxobject.hpp:401
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define NULL
Definition: types.h:112
FxTagTracker * TagTracker
Definition: fxobject.hpp:208
BOOLEAN IsDebug(VOID)
Definition: fxobject.hpp:409

Referenced by FxMemoryObject::FxMemoryObject(), and if().

◆ AssignParentObject()

_Must_inspect_result_ NTSTATUS FxObject::AssignParentObject ( __in FxObject ParentObject)

Definition at line 529 of file fxobject.cpp.

555 {
556  KIRQL oldIrql;
558 
559  m_SpinLock.Acquire(&oldIrql);
560 
561  //
562  // Can't add a parent if the current object is being deleted
563  //
566  m_SpinLock.Release(oldIrql);
567  return STATUS_DELETE_PENDING;
568  }
569 
570  //
571  // Current Object can't already have a parent, and can't
572  // be its own parent.
573  //
574  if (m_ParentObject != NULL) {
575  m_SpinLock.Release(oldIrql);
577  }
578 
579  if (m_ParentObject == this) {
580  m_SpinLock.Release(oldIrql);
582  }
583 
584  //
585  // We don't allow a parent object to be assigned after
586  // FxObject::Commit().
587  //
588  ASSERTMSG("Parent object can not be assigned after Commit()\n", !IsCommitted());
589 
591 
592  status = ParentObject->AddChildObjectInternal(this);
593 
594  if (NT_SUCCESS(status)) {
595  m_ParentObject = ParentObject;
596  }
597 
598  m_SpinLock.Release(oldIrql);
599 
600  return status;
601 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
LONG NTSTATUS
Definition: precomp.h:26
MxLock m_SpinLock
Definition: fxobject.hpp:296
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define STATUS_WDF_PARENT_IS_SELF
Definition: wdfstatus.h:216
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOLEAN IsCommitted(VOID)
Definition: fxobject.hpp:1087
USHORT m_ObjectState
Definition: fxobject.hpp:290
ASSERTMSG("this object's type is not listed in FxObjectsInfo\n", FxVerifyObjectTypeInTable(m_Type))
#define NULL
Definition: types.h:112
#define STATUS_WDF_PARENT_ALREADY_ASSIGNED
Definition: wdfstatus.h:207
static SERVICE_STATUS status
Definition: service.c:31
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930
Definition: ps.c:97

Referenced by FxIoResReqList::_CreateFromWdmList(), FxWmiIrpHandler::AddPowerPolicyProviderAndInstance(), FxCmResList::BuildFromWdmList(), FxIoResList::BuildFromWdmList(), and Commit().

◆ CallCleanup()

__inline VOID FxObject::CallCleanup ( VOID  )
inline

Definition at line 815 of file fxobject.hpp.

818  {
821  }
822  }
VOID CallCleanupCallbacks(VOID)
Definition: fxobject.cpp:328
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by FxIoTarget::Dispose(), FxRequestBase::Dispose(), FxDevice::Dispose(), and FxMpDevice::Dispose().

◆ CallCleanupCallbacks()

VOID FxObject::CallCleanupCallbacks ( VOID  )
private

Definition at line 328 of file fxobject.cpp.

331 {
333  WDFOBJECT h;
334 
335  //
336  // Deleted before Commit or it is an internal object
337  //
338  if (IsCommitted() == FALSE) {
339  return;
340  }
341 
342  //
343  // We only should have an object handle when we have an external object
344  //
345  h = GetObjectHandle();
346 
347  for (pHeader = GetContextHeader();
348  pHeader != NULL;
350  if (pHeader->EvtCleanupCallback != NULL) {
353  }
354  }
355 
357 }
FxContextHeader * NextHeader
Definition: fxhandle.h:71
PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback
Definition: fxhandle.h:76
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FALSE
Definition: types.h:117
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
FxContextHeader * pHeader
Definition: handleapi.cpp:604
BOOLEAN IsCommitted(VOID)
Definition: fxobject.hpp:1087
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define NULL
Definition: types.h:112

Referenced by CallCleanup().

◆ ClearEvtCallbacks()

VOID FxObject::ClearEvtCallbacks ( VOID  )

Definition at line 360 of file fxobject.cpp.

376 {
378 
379  for (pHeader = GetContextHeader();
380  pHeader != NULL;
382 
385  }
386 
388 }
FxContextHeader * NextHeader
Definition: fxhandle.h:71
PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback
Definition: fxhandle.h:76
FxContextHeader * pHeader
Definition: handleapi.cpp:604
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback
Definition: fxhandle.h:82
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define NULL
Definition: types.h:112

Referenced by FxRequest::CompleteInternal(), DeleteFromFailedCreate(), and FxRequest::FreeRequest().

◆ Commit()

_Must_inspect_result_ NTSTATUS FxObject::Commit ( __in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__out_opt WDFOBJECT ObjectHandle,
__in_opt FxObject Parent = NULL,
__in BOOLEAN  AssignDriverAsDefaultParent = TRUE 
)

Definition at line 904 of file fxobject.cpp.

926 {
929  FxObject* parent;
930 
931  parent = NULL;
932 
933  if (m_ObjectSize == 0) {
934  ASSERTMSG("Only external objects can call Commit()\n",
935  m_ObjectSize != 0);
936  return STATUS_INVALID_HANDLE;
937  }
938 
939  //
940  // For an object to be committed into a handle, it needs to have an object
941  // size. Internal objects set their size to zero as the indication they
942  // are internal and will not be converted into handles.
943  //
944  ASSERT(m_ObjectSize != 0);
945 
946  //
947  // Caller has already validated basic WDF_OBJECT_ATTRIBUTES
948  // with FxValidateObjectAttributes
949  //
950 
951  //
952  // Set object execution level constraint if specified
953  //
954  if (Attributes != NULL &&
955  Attributes->ExecutionLevel == WdfExecutionLevelPassive) {
957  }
958 
959  //
960  // Assign parent if supplied
961  //
962  if (Parent != NULL) {
963  parent = Parent;
964  }
965  else if (Attributes != NULL && Attributes->ParentObject != NULL) {
967  m_Globals,
968  Attributes->ParentObject,
970  (PVOID*)&parent
971  );
972  }
973  else {
974 
975  //
976  // If the object already does not have a parent, and
977  // one has not been specified we default it to FxDriver.
978  //
979  // We check to ensure we are not FxDriver being created.
980  //
981  if (AssignDriverAsDefaultParent &&
982  m_ParentObject == NULL) {
983 
984  //parent = FxToObjectItf::FxGetDriverAsDefaultParent(m_Globals, this);
985 
986 
987  if (m_Globals->Driver != this) {
989  }
990 
991  }
992  }
993 
994  ASSERT(parent != this);
995 
996  if (parent != NULL) {
997  //
998  // Make it the parent of this object
999  //
1001 
1002  if (!NT_SUCCESS(status)) {
1003  return status;
1004  }
1005  }
1006 
1007  //
1008  // Now assign the optional EvtObjectCleanup, EvtObjectDestroy callbacks
1009  //
1010  if (Attributes != NULL) {
1012 
1014 
1015  if (Attributes->EvtDestroyCallback != NULL) {
1016  pHeader->EvtDestroyCallback = Attributes->EvtDestroyCallback;
1017  }
1018 
1019  if (Attributes->EvtCleanupCallback != NULL) {
1020  pHeader->EvtCleanupCallback = Attributes->EvtCleanupCallback;
1022  }
1023  }
1024 
1025  //
1026  // We mark the handle as committed so that we can create the handle.
1027  //
1028  MarkCommitted();
1029 
1030  //
1031  // Create the object handle, assign EvtObjectCleanup, EvtObjectDestroy
1032  //
1033  FxObjectHandleCreate(this, &object);
1034 
1035  if (ObjectHandle != NULL) {
1036  *ObjectHandle = object;
1037  }
1038 
1039  return STATUS_SUCCESS;
1040 }
coclass MSXML2::XSLTemplate40 object
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LONG NTSTATUS
Definition: precomp.h:26
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback
Definition: fxhandle.h:76
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
FxDriver * Driver
Definition: fxglobals.h:374
FxContextHeader * pHeader
Definition: handleapi.cpp:604
VOID MarkPassiveCallbacks(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:972
VOID MarkCommitted(VOID)
Definition: fxobject.hpp:1074
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback
Definition: fxhandle.h:82
#define ASSERT(a)
Definition: mode.c:45
r parent
Definition: btrfs.c:2944
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID __inline FxObjectHandleCreate(__in FxObject *Object, __out PWDFOBJECT Handle)
Definition: fxhandle.h:176
_Must_inspect_result_ NTSTATUS AssignParentObject(__in FxObject *ParentObject)
Definition: fxobject.cpp:529
USHORT m_ObjectSize
Definition: fxobject.hpp:254
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
ASSERTMSG("this object's type is not listed in FxObjectsInfo\n", FxVerifyObjectTypeInTable(m_Type))
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97

Referenced by FxDevice::_AllocAndQueryProperty(), FxDevice::_AllocAndQueryPropertyEx(), FxUserObject::_Create(), FxWmiProvider::_Create(), FxIoTargetRemote::_Create(), FxWmiInstanceExternal::_Create(), FxDmaScatterGatherTransaction::_Create(), FxRequest::_Create(), FxDmaPacketTransaction::_Create(), FxDevice::_Create(), FxDmaSystemTransaction::_Create(), FxInterrupt::_CreateAndInit(), FxRequest::_CreateForPackage(), FxDevice::_OpenKey(), FxDeviceBase::AllocateTarget(), FxPkgFdo::CreateDefaultDeviceList(), FxUsbDevice::CreateIsochUrb(), FxPkgIo::CreateQueue(), FxUsbDevice::CreateUrb(), if(), FxPkgFdo::Initialize(), FxTimer::Initialize(), FxDpc::Initialize(), FxWorkItem::Initialize(), FxPkgPnp::Initialize(), FxUsbInterface::MakeAndConfigurePipes(), FxPkgFdo::PnpFilterResourceRequirements(), FxPkgPdo::PnpQueryResourceRequirements(), FxPkgPdo::PnpQueryResources(), FxRequest::ProbeAndLockForRead(), FxRequest::ProbeAndLockForWrite(), FxUsbDevice::SelectConfig(), and FxUsbInterface::SelectSetting().

◆ Construct()

VOID __inline FxObject::Construct ( __in BOOLEAN  Embedded)
inlineprivate

Definition at line 349 of file fxobject.hpp.

352  {
353  m_Refcnt = 1;
355  m_ObjectFlags = 0;
357 
361 
362  m_DeviceBase = NULL;
363 
364  VerifyConstruct(m_Globals, Embedded);
365  }
VOID _In_ BOOLEAN Embedded
Definition: fxobject.cpp:164
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
LONG m_Refcnt
Definition: fxobject.hpp:257
SINGLE_LIST_ENTRY m_DisposeSingleEntry
Definition: fxobject.hpp:316
USHORT m_ObjectState
Definition: fxobject.hpp:290
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define NULL
Definition: types.h:112
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293

Referenced by FxObject().

◆ DeferredDisposeWorkItem()

VOID FxObject::DeferredDisposeWorkItem ( VOID  )
private

Definition at line 696 of file fxobjectstatemachine.cpp.

712 {
713  KIRQL oldIrql;
715 
716  destroy = FALSE;
717 
718  m_SpinLock.Acquire(&oldIrql);
719 
720  ASSERT(oldIrql == PASSIVE_LEVEL);
721 
722  //
723  // Perform the right action based on the objects current state
724  //
725  // DisposeChildrenWorker return result can be ignored because we are
726  // guaranteed to be calling it at PASSIVE.
727  //
728  switch (m_ObjectState) {
730  //
731  // This will drop the spinlock and move the object to the right state
732  // before returning.
733  //
734  result = PerformDisposingDisposeChildrenLocked(oldIrql, FALSE);
735 
736  //
737  // The substree should never defer to the dispose list if we pass FALSE.
738  //
739  ASSERT(result);
740  UNREFERENCED_PARAMETER(result); //for fre build
741 
742  return;
743 
746  result = DisposeChildrenWorker(FxObjectStateDeferedDeleting, oldIrql, FALSE);
747  ASSERT(result);
748  UNREFERENCED_PARAMETER(result); //for fre build
749 
750  //
751  // This will release the spinlock
752  //
753  DeletedAndDisposedWorkerLocked(oldIrql, FALSE);
754  return;
755 
757  // Perform final destroy actions now that we are at passive level
758  destroy = TRUE;
759  break;
760 
761  // These are bad states for this event
762  case FxObjectStateDeletedAndDisposed: // Do nothing
769 
770  default:
771  // Bad state
772  ASSERT(FALSE);
773  break;
774  }
775 
776  m_SpinLock.Release(oldIrql);
777 
778  if (destroy) {
779  ProcessDestroy();
780  }
781 }
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
GLuint64EXT * result
Definition: glext.h:11304
VOID ProcessDestroy(VOID)
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
void destroy(_Tp *__pointer)
Definition: _construct.h:278
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

Referenced by FxDisposeList::DrainListLocked().

◆ DeleteEarlyDisposedObject()

VOID FxObject::DeleteEarlyDisposedObject ( VOID  )
protected

Definition at line 172 of file fxobjectstatemachine.cpp.

187 {
188  BOOLEAN result;
189 
192 
194  ASSERT(result);
195  UNREFERENCED_PARAMETER(result); //for fre build
196 
197  if (m_ParentObject != NULL) {
199  KIRQL irql;
200 
201  m_SpinLock.Acquire(&irql);
202 
203  if (m_ParentObject != NULL) {
205 
206  if (status == STATUS_DELETE_PENDING) {
208  m_SpinLock.Release(irql);
209  return;
210  }
211  else {
212  //
213  // We no longer have a parent object
214  //
216  }
217  }
218 
219  m_SpinLock.Release(irql);
220  }
221 
222  //
223  // This will release the spinlock
224  //
225  DeletedAndDisposedWorkerLocked(PASSIVE_LEVEL, FALSE);
226 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
GLuint64EXT * result
Definition: glext.h:11304
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LONG NTSTATUS
Definition: precomp.h:26
KIRQL irql
Definition: wave.h:1
MxLock m_SpinLock
Definition: fxobject.hpp:296
BOOLEAN MarkDeleteCalledLocked(VOID)
Definition: fxobject.hpp:1345
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define NULL
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ NTSTATUS RemoveChildObjectInternal(__in FxObject *ChildObject)
Definition: fxobject.cpp:770
Definition: ps.c:97

Referenced by FxRequest::PostProcessCompletion().

◆ DeleteFromFailedCreate()

VOID FxObject::DeleteFromFailedCreate ( VOID  )

Definition at line 391 of file fxobject.cpp.

408 {
410 
411  //
412  // After this call returns "this" is destroyed is not a valid pointer!
413  //
414  DeleteObject();
415 
416  //
417  // "this" is now freed memory, do not touch it!
418  //
419 }
virtual VOID DeleteObject(VOID)
VOID ClearEvtCallbacks(VOID)
Definition: fxobject.cpp:360

Referenced by FxUserObject::_Create(), FxWmiProvider::_Create(), FxPkgFdo::_Create(), FxDpc::_Create(), FxWorkItem::_Create(), FxTimer::_Create(), FxIoTargetRemote::_Create(), FxWmiInstanceExternal::_Create(), FxDmaScatterGatherTransaction::_Create(), FxIoQueue::_Create(), FxRequest::_Create(), FxDmaPacketTransaction::_Create(), FxDmaSystemTransaction::_Create(), FxSystemThread::_CreateAndInit(), FxChildList::_CreateAndInit(), FxInterrupt::_CreateAndInit(), FxCmResList::_CreateAndInit(), FxIoResReqList::_CreateAndInit(), FxRequest::_CreateForPackage(), FxDevice::_OpenKey(), FxPkgPdo::AddEjectionDevice(), FxPkgPnp::AddRemovalDevice(), FxPkgPnp::AddUsageDevice(), FxDeviceBase::AllocateTarget(), FxUsbInterface::CleanUpAndDelete(), FxPkgFdo::CreateDefaultDeviceList(), FxUsbDevice::CreateIsochUrb(), FxPkgIo::CreateQueue(), FxUsbDevice::CreateUrb(), FxFileObject::DeleteFileObjectFromFailedCreate(), FxUsbPipeContinuousReader::FormatRepeater(), if(), FxPkgFdo::Initialize(), FxPkgPnp::Initialize(), FxUsbInterface::MakeAndConfigurePipes(), FxPkgGeneral::OnCreate(), FxRequest::ProbeAndLockForRead(), FxRequest::ProbeAndLockForWrite(), FxUsbDevice::SelectConfig(), and FxUsbInterface::SelectSetting().

◆ DeleteObject()

VOID FxObject::DeleteObject ( VOID  )
virtual

Reimplemented in FxDevice, FxDriver, and FxInterrupt.

Definition at line 45 of file fxobjectstatemachine.cpp.

60 {
62  KIRQL oldIrql;
64 
65  m_SpinLock.Acquire(&oldIrql);
66 
68 
69  // This method should only be called once per object
70  ASSERT(result);
71  UNREFERENCED_PARAMETER(result); //for fre build
72 
73  //
74  // Perform the right action based on the objects current state
75  //
76  switch(m_ObjectState) {
78  //
79  // If we have a parent object, notify it of our deletion
80  //
81  if (m_ParentObject != NULL) {
82  //
83  // We call this holding our spinlock, the hierachy is child->parent
84  // when the lock is held across calls
85  //
87 
89 
90  //
91  // We won the race to ourselves (still FxObjectStateCreated),
92  // but lost the race on the parent who is going to try and
93  // dispose us through the ParentDeleteEvent().
94  //
95  // This is OK since the state machine protects us from
96  // doing improper actions, but we must not rundown and
97  // release our reference count till the parent object
98  // eventually calls our ParentDeleteEvent().
99  //
100  // So we note the state, and return waiting for the
101  // parent to dispose us.
102  //
103 
104  //
105  // Wait for our parent to come in and dispose us through
106  // the ParentDeleteEvent().
107  //
109  m_SpinLock.Release(oldIrql);
110  break;
111  }
112  else {
113  //
114  // We no longer have a parent object
115  //
117  }
118  }
119 
120  //
121  // Start Dispose, do delete state machine
122  // returns with m_SpinLock released
123  //
124  DeleteWorkerAndUnlock(oldIrql, TRUE);
125  break;
126 
128 
129  if (m_ParentObject != NULL) {
131 
132  if (status == STATUS_DELETE_PENDING) {
134  m_SpinLock.Release(oldIrql);
135  break;
136  }
137  else {
138  //
139  // We no longer have a parent object
140  //
142  }
143  }
144 
145  //
146  // This will release the spinlock
147  //
148  DeletedAndDisposedWorkerLocked(oldIrql);
149  break;
150 
153  case FxObjectStateDeletedDisposing: // Do nothing, workitem will move into disposed and deleted
154  case FxObjectStateDeletedAndDisposed: // Do nothing, already deleted
156  m_SpinLock.Release(oldIrql);
157  break;
158 
159  // These are bad states for this event
163  default:
165  // Bad state
166  ASSERT(FALSE);
167  m_SpinLock.Release(oldIrql);
168  }
169 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LONG NTSTATUS
Definition: precomp.h:26
MxLock m_SpinLock
Definition: fxobject.hpp:296
BOOLEAN MarkDeleteCalledLocked(VOID)
Definition: fxobject.hpp:1345
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define NULL
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930
_Must_inspect_result_ NTSTATUS RemoveChildObjectInternal(__in FxObject *ChildObject)
Definition: fxobject.cpp:770
Definition: ps.c:97

Referenced by FxDevice::_AllocAndQueryProperty(), FxDevice::_AllocAndQueryPropertyEx(), FxIoResReqList::_CreateFromWdmList(), FxWmiIrpHandler::AddPowerPolicyProviderAndInstance(), FxUsbInterface::CleanUpAndDelete(), FxDevice::ControlDeviceDelete(), FxMemoryObject::Delete(), DeleteFromFailedCreate(), FxInterrupt::DeleteObject(), FxDriver::DeleteObject(), FxDevice::DeleteObject(), FxDisposeList::Dispose(), FxIoQueue::Dispose(), FxTimer::FlushAndRundown(), FxInterrupt::FlushAndRundownInternal(), FxRequest::FreeRequest(), if(), FxPkgFdo::PnpFilterResourceRequirements(), FxPkgPdo::PnpQueryResourceRequirements(), FxPkgPdo::PnpQueryResources(), FxRequest::PostProcessCompletion(), FxPkgPnp::ReleasePowerThread(), FxResourceCollection::RemoveAndDelete(), FxDeviceBase::~FxDeviceBase(), FxDriver::~FxDriver(), FxUsbPipeContinuousReader::~FxUsbPipeContinuousReader(), and WDFDEVICE_INIT::~WDFDEVICE_INIT().

◆ DestroyChildren()

VOID __inline FxObject::DestroyChildren ( VOID  )
inlineprotected

Definition at line 464 of file fxobject.hpp.

467  {
469  FxObject *pChild;
470 
471  while (!IsListEmpty(&m_ChildListHead)) {
473 
475 
476  //
477  // Mark entry as unlinked
478  //
480 
481  //
482  // Inform child object of destruction. Object may be gone after return.
483  //
484  pChild->ParentDeleteEvent();
485  }
486  }
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
VOID ParentDeleteEvent(VOID)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PSINGLE_LIST_ENTRY ple
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: typedefs.h:119
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293

Referenced by __drv_requiresIRQL(), FxRequest::CompleteInternal(), FxDevice::DeleteDeviceFromFailedCreateNoDelete(), FxDevice::Dispose(), FxMpDevice::Dispose(), FxPkgPnp::PnpEventRemovedCommonCode(), and FxRequest::PreProcessSendAndForget().

◆ Dispose()

◆ EarlyDispose()

BOOLEAN FxObject::EarlyDispose ( VOID  )

Definition at line 375 of file fxobjectstatemachine.cpp.

395 {
397  KIRQL oldIrql;
398  BOOLEAN result;
399 
400  //
401  // By default, we assume a synchronous diposal
402  //
403  result = TRUE;
404 
405  m_SpinLock.Acquire(&oldIrql);
406 
407  switch(m_ObjectState) {
409  //
410  // If we have a parent object, notify it of our deletion
411  //
412  if (m_ParentObject != NULL) {
413  //
414  // We call this holding our spinlock, the hierachy is child->parent
415  // when the lock is held across calls
416  //
418 
419  if (status == STATUS_DELETE_PENDING) {
420 
421  //
422  // We won the race to ourselves (still FxObjectStateCreated),
423  // but lost the race on the parent who is going to try and
424  // dispose us through the PerformEarlyDipose().
425  //
426  // This is OK since the state machine protects us from
427  // doing improper actions, but we must not rundown and
428  // release our reference count till the parent object
429  // eventually calls our ParentDeleteEvent().
430  //
431  // So we note the state, and return waiting for the
432  // parent to dispose us.
433  //
434 
435  //
436  // Wait for our parent to come in and dispose us through
437  // the PerformEarlyDipose().
438  //
440  m_SpinLock.Release(oldIrql);
441 
442  return FALSE;
443  }
444  else {
445  //
446  // We no longer have a parent object
447  //
449  }
450  }
451 
452  //
453  // Mark that this object was early disposed externally wrt the
454  // state machine.
455  //
457 
458  //
459  // Start the dispose path. This call will release the spinlock.
460  //
461  result = PerformEarlyDisposeWorkerAndUnlock(oldIrql, TRUE);
462  break;
463 
464  default:
465  //
466  // Not in the right state for an early dispose
467  //
468  result = FALSE;
469  m_SpinLock.Release(oldIrql);
470  }
471 
472  return result;
473 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LONG NTSTATUS
Definition: precomp.h:26
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
USHORT m_ObjectState
Definition: fxobject.hpp:290
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define NULL
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ NTSTATUS RemoveChildObjectInternal(__in FxObject *ChildObject)
Definition: fxobject.cpp:770
Definition: ps.c:97

Referenced by FxRequest::CompleteInternal(), FxDevice::DeleteDeviceFromFailedCreateNoDelete(), FxPkgPnp::PnpEventRemovedCommonCode(), and FxRequest::PreProcessSendAndForget().

◆ FinalRelease()

VOID FxObject::FinalRelease ( VOID  )
private

Definition at line 207 of file fxobject.cpp.

210 {
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223  //
224  // No other access, OK to test flag without grabbing spinlock
225  // since it can only be set at create.
226  //
227  if (ShouldDeferDisposeLocked()) {
228  //
229  // If this is a passive level only object, ensure we only destroy
230  // it from passive level. No need to hold the object lock when
231  // changing to this state since no other thread can change our
232  // state.
233  //
235 
236  //
237  // Note, we cannot be holding a lock while making this call b/c by
238  // the time it returns, it could have freed the object and the
239  // KeReleaseSpinLock call would have touched freed pool.
240  //
241 
242  //FxToObjectItf::FxAddToDriverDisposeList(m_Globals, this);
243 
244 
245  m_Globals->Driver->GetDisposeList()->Add(this);
246 
247  }
248  else {
249  ProcessDestroy();
250  }
251 }
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
VOID ProcessDestroy(VOID)
FxDriver * Driver
Definition: fxglobals.h:374
VOID Add(FxObject *object)
__inline FxDisposeList * GetDisposeList()
Definition: fxdriver.hpp:354
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
BOOLEAN ShouldDeferDisposeLocked(__out_opt PKIRQL PreviousIrql=NULL)
Definition: fxobject.hpp:1383

Referenced by Release().

◆ FX_DECLARE_VF_FUNCTION_P1()

FxObject::FX_DECLARE_VF_FUNCTION_P1 ( VOID  ,
VerifyConstruct  ,
_In_  BOOLEAN 
)
private

◆ GetCOMWrapper()

PVOID FxObject::GetCOMWrapper ( )
inline

Definition at line 518 of file fxobject.hpp.

518 { return m_COMWrapper; }
PVOID m_COMWrapper
Definition: fxobject.hpp:243

◆ GetContextHeader()

__inline FxContextHeader* FxObject::GetContextHeader ( VOID  )
inline

Definition at line 720 of file fxobject.hpp.

723  {
724  if (m_ObjectSize == 0) {
725  return NULL;
726  }
727  else {
728  return GET_CONTEXT_HEADER();
729  }
730  }
#define GET_CONTEXT_HEADER()
Definition: fxobject.hpp:591
USHORT m_ObjectSize
Definition: fxobject.hpp:254
#define NULL
Definition: types.h:112

Referenced by __drv_maxIRQL(), AddContext(), CallCleanupCallbacks(), ClearEvtCallbacks(), Commit(), FxDevice::CreateDevice(), ProcessDestroy(), and VfWdfObjectGetTypedContext().

◆ GetDebugExtension()

FxObjectDebugExtension* FxObject::GetDebugExtension ( VOID  )
inlineprotected

Definition at line 401 of file fxobject.hpp.

404  {
405  return CONTAINING_RECORD(this, FxObjectDebugExtension, AllocationStart);
406  }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by FxNonPagedObject::_Acquires_lock_(), FxNonPagedObject::_Releases_lock_(), FxNonPagedObject::_Requires_lock_held_(), AllocateTagTracker(), FxNonPagedObject::FxNonPagedObject(), if(), ProcessDestroy(), SetObjectStateLocked(), and FxNonPagedObject::~FxNonPagedObject().

◆ GetDevice()

CfxDevice* FxObject::GetDevice ( VOID  )
inline

◆ GetDeviceBase()

CfxDeviceBase* FxObject::GetDeviceBase ( VOID  )
inline

Definition at line 789 of file fxobject.hpp.

792  {
793  return m_DeviceBase;
794  }
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328

Referenced by FxDeviceBase::_SearchForDevice(), AddChildObjectInternal(), and FxIoQueue::QueueDriverCreatedRequest().

◆ GetDriverGlobals()

__inline PFX_DRIVER_GLOBALS FxObject::GetDriverGlobals ( VOID  )
inline

Definition at line 734 of file fxobject.hpp.

737  {
738  return m_Globals;
739  }
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259

Referenced by __drv_maxIRQL(), __drv_requiresIRQL(), __drv_when(), __in_bcount_opt(), FxUsbDevice::_Acquires_lock_(), FxDmaPacketTransaction::_AdapterControl(), FxDmaScatterGatherTransaction::_AdapterListControl(), FxFileObject::_CreateFileObject(), FxFileObject::_DestroyFileObject(), _Function_class_(), FxFileObject::_GetFileObjectFromWdm(), FxPkgPdo::_PnpEject(), FxPkgPdo::_PnpQueryDeviceText(), FxPkgPdo::_PnpQueryId(), FxPkgFdo::_PnpQueryInterface(), FxPkgFdo::_PnpStartDeviceCompletionRoutine(), FxDevicePwrRequirementMachine::_ProcessEventInner(), FxWakeInterruptMachine::_ProcessEventInner(), FxPkgPdo::_QueryCapsWorkItem(), FxUsbDevice::_Releases_lock_(), FxIoTarget::_RequestCancelled(), _Requires_lock_held_(), _Requires_lock_not_held_(), FxDeviceBase::_SearchForDevice(), FxInterrupt::AcquireLock(), FxPkgGeneral::AcquireRemoveLockForClose(), FxCollection::Add(), FxChildList::Add(), FxResourceCollection::AddAt(), FxPkgPnp::AddChildList(), FxPkgPnp::AddDmaEnabler(), FxPkgPdo::AddEjectionDevice(), FxWmiProvider::AddInstance(), FxWmiProvider::AddInstanceLocked(), FxDevice::AddIoTarget(), FxRequest::AddIrpReference(), FxWmiIrpHandler::AddPowerPolicyProviderAndInstance(), FxPkgPnp::AddQueryInterface(), FxPkgPnp::AddRemovalDevice(), FxPkgPnp::AddUsageDevice(), FxNPagedLookasideList::Allocate(), FxPagedLookasideListFromPool::Allocate(), FxNPagedLookasideListFromPool::Allocate(), FxDmaPacketTransaction::AllocateAdapterChannel(), FxCommonBuffer::AllocateCommonBuffer(), FxDmaEnabler::AllocateCommonBuffer(), FxPkgPnp::AllocateDmaEnablerList(), FxPkgPnp::AllocateEnumInfo(), FxDevice::AllocateRequestMemory(), FxIoQueue::AllocateReservedRequest(), FxDeviceBase::AllocateTarget(), FxString::Assign(), FxDevice::AssignProperty(), FxInterrupt::AssignResources(), FxChildList::BeginIteration(), FxChildList::BeginScan(), FxCmResList::BuildFromWdmList(), FxIoResList::BuildFromWdmList(), FxCmResList::BuildPortResourceTable(), FxCmResList::BuildRegisterResourceTable(), FxDmaScatterGatherTransaction::BuildScatterGatherList(), FxRequestBase::Cancel(), FxIoQueue::CancelForDriver(), FxDmaSystemTransaction::CancelMappedTransfer(), FxUsbPipeContinuousReader::CancelRepeaters(), FxDmaTransactionBase::CancelResourceAllocation(), FxIoTarget::CancelSentIo(), FxRequestBase::CancelTimer(), FxIoQueue::CanThreadDispatchEventsLocked(), FxCmResList::CheckForConnectionResources(), FxPkgPnp::ChildListNotifyRemove(), FxPkgPnp::CleanupStateMachines(), FxIoTarget::ClearCompletedRequestVerifierFlags(), FxPkgPdo::ClearEjectionDevicesList(), FxRequestBase::ClearFieldsForReuse(), FxPkgPnp::ClearRemovalDevicesList(), FxIoTargetRemote::ClearTargetPointers(), FxRequestBase::ClearVerifierFlags(), FxDeviceDescriptionEntry::Clone(), FxChildList::CloneEntryLocked(), FxIoTargetRemote::Close(), FxPkgPnp::CommitUsageNotification(), FxRequest::Complete(), FxIoTarget::CompleteCanceledRequest(), FxRequest::CompleteInternal(), FxRequestBase::CompleteSubmitted(), FxRequest::CompleteWithPriority(), FxWmiIrpHandler::CompleteWmiRequest(), FxUsbPipeContinuousReader::Config(), FxDmaEnabler::ConfigureBusMasterAdapters(), FxPkgGeneral::ConfigureConstraints(), FxDeviceBase::ConfigureConstraints(), FxIoQueue::ConfigureConstraints(), FxPkgIo::ConfigureDynamicDispatching(), FxPkgGeneral::ConfigureFileObjectClass(), FxPkgGeneral::ConfigureForwarding(), FxPkgIo::ConfigureForwarding(), FxDmaEnabler::ConfigureSystemAdapter(), FxInterrupt::Connect(), FxRequest::CopyCompletionParams(), FxPkgFdo::CreateDefaultDeviceList(), FxChildList::CreateDevice(), FxDevice::CreateDevice(), FxUsbDevice::CreateInterfaces(), FxUsbDevice::CreateIsochUrb(), FxPkgPnp::CreatePowerThread(), FxPkgIo::CreateQueue(), FxUsbInterface::CreateSettings(), FxSystemThread::CreateThread(), FxRequestBase::CreateTimer(), FxUsbDevice::CreateUrb(), FxInterrupt::CreateWakeInterruptMachine(), FxCmResList::CreateWdmList(), FxIoResReqList::CreateWdmList(), FxUsbDevice::CyclePort(), FxUsbDevice::Deconfig(), FxDevice::DeleteDeviceFromFailedCreateNoDelete(), FxDevice::DeleteObject(), FxWmiIrpHandler::Deregister(), FxDevice::Destroy(), FxInterrupt::Disconnect(), FxPkgPnp::DisconnectInterruptNP(), FxWmiIrpHandler::Dispatch(), FxPkgIo::Dispatch(), FxPkgGeneral::Dispatch(), FxPkgPnp::Dispatch(), FxPkgFdo::DispatchDeviceSetPower(), FxPkgPdo::DispatchDeviceSetPower(), FxIoQueue::DispatchRequestToDriver(), FxPkgIo::DispatchStep1(), FxPkgIo::DispatchStep2(), FxPkgPnp::DispatchWaitWake(), FxPkgIo::DispathToInCallerContextCallback(), FxDmaTransactionBase::Dispose(), FxPkgPnp::Dispose(), FxRequestBase::Dispose(), FxIoQueue::Dispose(), FxDmaTransactionBase::DmaCompleted(), FxDpc::DpcHandler(), FxInterrupt::DpcHandler(), FxIoTarget::DrainPendedRequestsLocked(), FxChildList::EndIteration(), FxChildList::EndScan(), FxWorkItem::Enqueue(), FxPkgIo::EnqueueRequest(), FxSystemWorkItem::EnqueueWorker(), FxEventQueue::EventQueueWorker(), FxDmaTransactionBase::Execute(), FxRequestBase::FatalError(), FxIoQueue::FatalError(), FxDevice::FdoInitialize(), FxPkgPnp::FilterResourceRequirements(), FxWmiInstance::FireEvent(), FxDmaPacketTransaction::FlushAdapterBuffers(), FxPkgIo::FlushAllQueuesByFileObject(), FxTimer::FlushAndRundown(), FxWorkItem::FlushAndWait(), FxInterrupt::ForceDisconnect(), FxInterrupt::ForceReconnect(), FxUsbPipe::FormatAbortRequest(), FxUsbDevice::FormatControlRequest(), FxIoTarget::FormatInternalIoctlOthersRequest(), FxIoTarget::FormatIoctlRequest(), FxIoTarget::FormatIoRequest(), FxUsbPipe::FormatResetRequest(), FxUsbDevice::FormatStringRequest(), FxUsbPipe::FormatTransferRequest(), FxIoQueue::ForwardRequest(), FxIoQueue::ForwardRequestToParent(), FxIoQueue::ForwardRequestWorker(), FxDmaPacketTransaction::FreeMapRegistersAndAdapter(), FxDmaSystemTransaction::FreeMapRegistersAndAdapter(), FxRequestBase::FreeMdls(), FxDevice::FreeRequestMemory(), FxNonPagedObject::FxNonPagedObject(), FxUsbPipeContinuousReader::FxUsbPipeRequestWorkItemHandler(), FxDevice::FxValidateInterfacePropertyData(), FxUsbInterface::GetConfiguredSettingIndex(), FxRequest::GetCurrentIrpStackLocation(), FxRequest::GetDeviceControlOutputMdl(), FxRequest::GetDeviceControlOutputMemoryObject(), FxMemoryObject::GetDriverGlobals(), FxRequestSystemBuffer::GetDriverGlobals(), FxRequestOutputBuffer::GetDriverGlobals(), FxRequest::GetFileObject(), FxRequest::GetInformation(), FxUsbDevice::GetInterfaceNumberFromInterface(), FxRequest::GetIrp(), FxRequest::GetMdl(), FxRequest::GetMemoryObject(), FxChildList::GetNextDevice(), FxRequest::GetParameters(), FxUsbDevice::GetPortStatus(), FxDriver::GetRegistryPath(), FxIoQueue::GetRequest(), FxRequest::GetRequestorMode(), FxRequest::GetStatus(), FxUsbDevice::GetString(), FxIoTargetRemote::GetTargetDeviceRelations(), FxVerifierLock::GetThreadTableEntry(), FxDmaTransactionBase::GetTransferInfo(), FxRequestBase::GetVerifierFlagsLocked(), FxUsbPipe::GotoPurgeState(), FxIoTarget::GotoPurgeState(), FxUsbPipe::GotoRemoveState(), FxIoTarget::GotoRemoveState(), FxIoTarget::GotoStartState(), FxUsbPipe::GotoStopState(), FxIoTarget::GotoStopState(), FxIoTarget::HandleFailedResubmit(), FxPkgPnp::HandleQueryBusInformation(), FxPkgPnp::HandleQueryBusRelations(), FxPkgFdo::HandleQueryCapabilities(), FxPkgFdo::HandleQueryCapabilitiesCompletion(), FxPkgPnp::HandleQueryDeviceRelations(), FxPkgPnp::HandleQueryInterface(), FxPkgFdo::HandleQueryPnpDeviceStateCompletion(), if(), FxRequest::Impersonate(), FxPowerIdleMachine::InDxIoIncrement(), FxIoTarget::Init(), FxUsbPipe::InitContinuousReader(), FxUsbDevice::InitDevice(), FxPagedLookasideListFromPool::Initialize(), FxPagedObject::Initialize(), FxDmaEnabler::Initialize(), FxPkgFdo::Initialize(), FxDisposeList::Initialize(), FxDmaTransactionBase::Initialize(), FxTimer::Initialize(), FxDpc::Initialize(), FxWorkItem::Initialize(), FxPkgPdo::Initialize(), FxPkgGeneral::Initialize(), FxSystemWorkItem::Initialize(), FxDriver::Initialize(), FxIoQueue::Initialize(), FxDevice::Initialize(), FxPkgPnp::Initialize(), FxPkgIo::InitializeDefaultQueue(), FxLookasideList::InitializeLookaside(), FxDmaEnabler::InitializeResources(), FxDmaScatterGatherTransaction::InitializeResources(), FxInterrupt::InitializeWorker(), FxLookasideList::InitObjectAlloc(), FxPagedLookasideListFromPool::InitPagedAlloc(), FxPowerPolicyMachine::InitUsbSS(), FxRequest::InsertHeadIrpQueue(), FxRequest::InsertTailIrpQueue(), FxPowerIdleMachine::IoDecrement(), FxDeviceDescriptionEntry::IsDeviceRemoved(), FxDevice::IsInterfaceRegistered(), FxUsbInterface::MakeAndConfigurePipes(), FxCmResList::MapIoSpaceWorker(), FxDmaPacketTransaction::MapTransfer(), FxChildList::NotifyDeviceRemove(), FxChildList::NotifyDeviceSurpriseRemove(), FxPkgPnp::NotifyResourceObjectsD0(), FxPkgPnp::NotifyResourceObjectsDx(), FxPkgPnp::NotifyResourceobjectsToReleaseResources(), FxPkgPnp::NotPowerPolicyOwnerEnterNewState(), FxPkgGeneral::OnCreate(), FxIoTargetRemoteNotificationCallback::OnQueryRemove(), FxIoTargetRemoteNotificationCallback::OnRemoveCanceled(), FxIoTargetRemoteNotificationCallback::OnRemoveComplete(), FxIoTargetRemote::Open(), FxIoTargetRemote::OpenTargetHandle(), FxDevice::PdoInitialize(), FxIoQueue::PeekRequest(), PerfEvtDeviceD0EntryStart(), PerfEvtDeviceD0ExitStart(), PerfEvtDevicePrepareHardwareStart(), PerfEvtDeviceReleaseHardwareStart(), PerfEvtIoStopStart(), PerfEvtIoStopStop(), PerfIoComplete(), PerfIoStart(), PerformanceAnalysisPowerProcess(), PerformanceGetDriverDeviceAdd(), FxPkgPnp::PnpDeviceUsageNotification(), FxPkgPnp::PnpDisableInterfaces(), FxPkgPnp::PnpEnableInterfacesAndRegisterWmi(), FxPkgPnp::PnpEnterNewState(), FxPkgPdo::PnpEventEjectHardwareOverload(), FxPkgPdo::PnpEventPdoRemovedOverload(), FxPkgPnp::PnpEventSurpriseRemovePendingOverload(), FxPkgFdo::PnpFilterResourceRequirements(), FxPkgPnp::PnpIncrementRestartCountLogic(), FxPkgPnp::PnpMatchResources(), FxPkgPnp::PnpProcessEvent(), FxPkgPnp::PnpProcessEventInner(), FxPkgPdo::PnpQueryCapabilities(), FxPkgFdo::PnpQueryDeviceRelations(), FxPkgPdo::PnpQueryDeviceRelations(), FxPkgPdo::PnpQueryResourceRequirements(), FxPkgPdo::PnpQueryResources(), FxPkgPnp::PnpReleaseHardware(), FxPkgFdo::PnpSendStartDeviceDownTheStackOverload(), FxPkgFdo::PostCreateDeviceInitialize(), FxPkgGeneral::PostCreateDeviceInitialize(), FxPkgPnp::PostCreateDeviceInitialize(), FxDevice::PostInitialize(), FxIoQueue::PostRequestCompletedCallback(), FxPkgPnp::PowerConnectInterruptFailed(), FxPkgPnp::PowerDmaEnableAndScan(), FxDmaEnabler::PowerDown(), FxPkgPnp::PowerEnterNewState(), FxPkgPnp::PowerGotoDx(), FxPkgPnp::PowerGotoDxIoStopped(), FxPkgPnp::PowerGotoDxIoStoppedNP(), FxPkgPnp::PowerMakeWakeRequestNonCancelable(), FxPkgPnp::PowerPolicyBlockChildrenPowerUp(), FxPkgPnp::PowerPolicyCancelWaitWake(), FxPkgPnp::PowerPolicyCanChildPowerUp(), FxPkgPnp::PowerPolicyCanIdlePowerDown(), FxPkgPnp::PowerPolicyChildPoweredDown(), FxPkgPnp::PowerPolicyChildrenCanPowerUp(), FxPkgPnp::PowerPolicyCompleteSystemPowerIrp(), FxPkgPnp::PowerPolicyDisarmWakeFromSx(), FxPkgPnp::PowerPolicyEnterNewState(), FxPkgPnp::PowerPolicyGetDeviceDeepestDeviceWakeState(), FxPkgPnp::PowerPolicyHandleSystemQueryPower(), FxPkgPnp::PowerPolicyPostParentToD0ToChildren(), FxPkgPnp::PowerPolicyProcessEvent(), FxPkgPnp::PowerPolicyProcessEventInner(), FxPkgPnp::PowerPolicySendDevicePowerRequest(), FxPkgPnp::PowerPolicySendWaitWakeRequest(), FxPkgPnp::PowerPolicySetS0IdleSettings(), FxPkgPnp::PowerPolicySetSxWakeSettings(), FxPkgPnp::PowerPolicySetSxWakeState(), FxPkgPnp::PowerPolicyUpdateSystemWakeSource(), FxPkgPnp::PowerProcessEvent(), FxPkgPnp::PowerProcessEventInner(), FxPowerIdleMachine::PowerReferenceWorker(), FxDmaEnabler::PowerUp(), FxPoxInterface::PoxRegisterDevice(), FxDmaSystemTransaction::PreMapTransfer(), FxRequest::PreProcessSendAndForget(), FxIoQueue::PreRequestCompletedCallback(), FxIoTarget::PrintDisposeMessage(), FxRequest::ProbeAndLockForRead(), FxRequest::ProbeAndLockForWrite(), FxChildList::ProcessBusRelations(), FxPkgPnp::ProcessDelayedDeletion(), FxDeviceDescriptionEntry::ProcessDeviceRemoved(), FxDevicePwrRequirementMachine::ProcessEvent(), FxWakeInterruptMachine::ProcessEvent(), FxSelfManagedIoMachine::ProcessEvent(), FxDevicePwrRequirementMachine::ProcessEventInner(), FxWakeInterruptMachine::ProcessEventInner(), FxPowerIdleMachine::ProcessEventLocked(), FxChildList::ProcessModificationsLocked(), FxIoTarget::Purge(), FxIoQueue::PutBackReservedRequest(), FxPkgPnp::QueryForCapabilities(), FxPkgPnp::QueryForD3ColdInterface(), FxUsbDevice::QueryUsbCapability(), FxIoQueue::QueueDrainSynchronously(), FxIoQueue::QueueDriverCreatedRequest(), FxIoQueue::QueueIdle(), FxIoQueue::QueueIdleSynchronously(), FxIoQueue::QueuePurge(), FxIoQueue::QueuePurgeSynchronously(), FxIoQueue::QueueRequest(), FxIoQueue::QueueRequestFromForward(), FxEventQueue::QueueToThreadWorker(), FxWorkItemEventQueue::QueueWorkItem(), FxUsbPipeContinuousReader::QueueWorkItemLocked(), FxPkgPnp::ReadStateFromRegistry(), FxIoQueue::ReadyNotify(), FxNPagedLookasideList::Reclaim(), FxPagedLookasideListFromPool::Reclaim(), FxNPagedLookasideListFromPool::Reclaim(), FxPagedLookasideListFromPool::ReclaimPool(), FxChildList::ReenumerateEntryLocked(), FxWmiIrpHandler::Register(), FxDmaPacketTransaction::ReleaseAdapter(), FxDmaTransactionBase::ReleaseForReuse(), FxRequest::ReleaseIrpReference(), FxInterrupt::ReleaseLock(), FxVerifierLock::ReleaseOrReplaceThreadTableEntry(), FxResourceCollection::RemoveAndDelete(), FxPkgPnp::RemoveChildList(), FxIoTarget::RemoveCompletedRequestLocked(), FxPkgPnp::RemoveDmaEnabler(), FxPkgPdo::RemoveEjectionDevice(), FxRequest::RemoveFromIrpQueue(), FxDevice::RemoveIoTarget(), FxIrpQueue::RemoveIrpFromQueueByContext(), FxPkgPnp::RemoveRemovalDevice(), FxPkgPnp::RemoveUsageDevice(), FxInterrupt::ReportActive(), FxInterrupt::ReportInactive(), FxIoQueue::RequestCancelable(), FxIoQueue::RequestCompletedCallback(), FxIoTarget::RequestCompletionRoutine(), FxIoQueue::Requeue(), FxDmaPacketTransaction::ReserveAdapter(), FxPowerIdleMachine::Reset(), FxUsbDevice::Reset(), FxUsbPipe::Reset(), FxPkgIo::ResetStateForRestart(), FxUsbPipeContinuousReader::ResubmitRepeater(), FxPkgIo::ResumeProcessingForPower(), FxDevice::RetrieveDeviceInfoRegistrySettings(), FxDevice::RetrieveDeviceRegistrySettings(), FxRequest::Reuse(), FxPkgPnp::SaveState(), FxUsbDevice::SelectConfig(), FxUsbDevice::SelectConfigDescriptor(), FxUsbDevice::SelectConfigInterfaces(), FxUsbDevice::SelectConfigMulti(), FxUsbDevice::SelectConfigSingle(), FxUsbInterface::SelectSetting(), FxUsbInterface::SelectSettingByDescriptor(), FxUsbInterface::SelectSettingByIndex(), FxRequestFromLookaside::SelfDestruct(), FxIoTargetSelf::Send(), FxUsbDevice::SendSyncRequest(), FxUsbDevice::SendSyncUmUrb(), FxRequest::SetCompletionState(), FxEventQueue::SetDelayedDeletion(), FxPkgPnp::SetDeviceFailed(), FxPkgIo::SetFilter(), FxDevice::SetFilterIoType(), FxDmaTransactionBase::SetImmediateExecution(), FxRequest::SetInformation(), FxPkgPnp::SetPendingPnpIrp(), FxInterrupt::SetPolicy(), FxPkgPnp::SetSpecialFileSupport(), FxIoQueue::SetState(), FxPkgPnp::SetUsageNotificationFlags(), FxRequestBase::SetVerifierFlags(), FxUsbInterface::SetWinUsbHandle(), FxDmaScatterGatherTransaction::StageTransfer(), FxDmaPacketTransaction::StageTransfer(), FxTimer::Start(), FxIoTarget::Start(), FxIoQueue::StartPowerTransitionOff(), FxDmaPacketTransaction::StartTransfer(), FxTimer::Stop(), FxIoTarget::Stop(), FxRequest::StopAcknowledge(), FxPkgIo::StopProcessingForPower(), FxIoQueue::StopProcessingForPower(), FxDmaSystemTransaction::StopTransfer(), FxIoTarget::SubmitLocked(), FxIoTarget::SubmitPendedRequest(), FxIoTarget::SubmitSync(), FxIoTarget::SubmitSyncRequestIgnoreTargetState(), FxPowerIdleMachine::TimedOutIoIncrement(), FxIoTarget::TimerCallback(), FxTimer::TimerHandler(), FxDmaPacketTransaction::TransferCompleted(), FxInterrupt::TryToAcquireLock(), FxWmiIrpHandler::UpdateGuids(), FxUsbInterface::UpdatePipeAttributes(), FxIoTarget::UpdateTargetIoType(), FxPkgPnp::UpdateWmiInstance(), FxCmResList::ValidateAndClearMapping(), FxPkgPnp::ValidateCmResource(), FxPkgPnp::ValidateInterruptResourceCm(), FxCmResList::ValidatePortAddressRange(), FxCmResList::ValidateRegisterPhysicalAddressRange(), FxCmResList::ValidateRegisterSystemAddressRange(), FxCmResList::ValidateRegisterSystemBaseAddress(), FxCmResList::ValidateResourceUnmap(), FxRequestBase::ValidateTarget(), FxRequestBase::VerifierClearFormatted(), FxPkgIo::VerifierFreeRequestToTestForwardProgess(), FxRequestBase::VerifierIsFormatted(), FxRequestBase::VerifierSetFormatted(), VfAddContextToHandle(), VfWdfObjectGetTypedContext(), FxIoTarget::WaitForDisposeEvent(), FxUsbPipe::WaitForSentIoToComplete(), FxInterrupt::WakeInterruptIsr(), FxWorkItem::WorkItemHandler(), FxSystemWorkItem::WorkItemHandler(), FxInterrupt::WorkItemHandler(), FxDevice::~FxDevice(), FxDpc::~FxDpc(), FxDriver::~FxDriver(), FxInterrupt::~FxInterrupt(), ~FxObject(), FxPkgIo::~FxPkgIo(), FxRequestBase::~FxRequestBase(), FxSystemWorkItem::~FxSystemWorkItem(), FxTimer::~FxTimer(), and FxWorkItem::~FxWorkItem().

◆ GetObjectHandle()

PVOID __inline FxObject::GetObjectHandle ( VOID  )
inline

Definition at line 603 of file fxobject.hpp.

606  {
607  ASSERT(GetRefCnt() > 0);
608  return GetObjectHandleUnchecked();
609  }
#define ASSERT(a)
Definition: mode.c:45
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
LONG GetRefCnt(VOID)
Definition: fxobject.hpp:758

Referenced by __drv_requiresIRQL(), FxDeviceBase::_SearchForDevice(), FxResourceCollection::AddAt(), FxCommonBuffer::AllocateCommonBuffer(), CallCleanupCallbacks(), FxDmaTransactionBase::CancelResourceAllocation(), FxIoQueue::CanThreadDispatchEventsLocked(), FxIoTargetRemote::ClearTargetPointers(), FxIoTargetRemote::Close(), FxIoTarget::CompleteCanceledRequest(), FxRequest::CompleteInternal(), FxUsbPipeContinuousReader::Config(), FxIoQueue::ConfigureConstraints(), FxPkgGeneral::ConfigureForwarding(), FxIoQueue::DispatchRequestToDriver(), FxDmaTransactionBase::Dispose(), FxDpc::DpcHandler(), FxIoTarget::DrainPendedRequestsLocked(), FxPkgIo::EnqueueRequest(), FxDmaTransactionBase::Execute(), FxUsbPipeContinuousReader::FormatRepeater(), FxWorkItem::GetAssociatedObject(), FxRequest::GetDeviceControlOutputMemoryObject(), FxUserObject::GetHandle(), FxWmiInstance::GetHandle(), FxFileObject::GetHandle(), FxMemoryObject::GetHandle(), FxChildList::GetHandle(), FxDmaEnabler::GetHandle(), FxWmiProvider::GetHandle(), FxUsbInterface::GetHandle(), FxTimer::GetHandle(), FxWorkItem::GetHandle(), FxDriver::GetHandle(), FxDeviceBase::GetHandle(), FxIoTargetRemote::GetHandle(), FxIoTarget::GetHandle(), FxDmaTransactionBase::GetHandle(), FxCmResList::GetHandle(), FxUsbPipe::GetHandle(), FxInterrupt::GetHandle(), FxRequestBase::GetHandle(), FxIoResReqList::GetHandle(), FxIoResList::GetHandle(), FxIoQueue::GetHandle(), FxRequest::GetMemoryObject(), FxDpc::GetObject(), FxTimer::GetObject(), FxIoQueue::GetRequest(), FxIoTargetRemote::GetTargetDeviceRelations(), FxRequestBase::GetTraceObjectHandle(), FxDmaTransactionBase::GetTransferInfo(), FxIoTarget::GotoPurgeState(), FxIoTarget::GotoRemoveState(), FxIoTarget::GotoStartState(), FxIoTarget::GotoStopState(), FxIoTarget::HandleFailedResubmit(), if(), FxIoTarget::Init(), FxDmaTransactionBase::Initialize(), FxIoQueue::Initialize(), FxVerifierLock::Lock(), FxPkgGeneral::OnCreate(), FxIoTargetRemoteNotificationCallback::OnQueryRemove(), FxIoTargetRemoteNotificationCallback::OnRemoveCanceled(), FxIoTargetRemoteNotificationCallback::OnRemoveComplete(), FxIoTargetRemote::Open(), FxIoTargetRemote::OpenTargetHandle(), FxIoQueue::PostRequestCompletedCallback(), FxIoQueue::PreRequestCompletedCallback(), FxIoTarget::PrintDisposeMessage(), FxRequest::ProbeAndLockForRead(), FxRequest::ProbeAndLockForWrite(), FxChildList::ProcessModificationsLocked(), FxIoQueue::QueueDrainSynchronously(), FxIoQueue::QueueIdle(), FxIoQueue::QueueIdleSynchronously(), FxIoQueue::QueuePurge(), FxIoQueue::QueuePurgeSynchronously(), FxIoQueue::QueueRequest(), FxIoQueue::QueueRequestFromForward(), FxIoQueue::ReadyNotify(), FxDmaPacketTransaction::ReleaseAdapter(), FxDmaTransactionBase::ReleaseForReuse(), FxResourceCollection::RemoveAndDelete(), FxIoTarget::RemoveCompletedRequestLocked(), FxIoQueue::RequestCompletedCallback(), FxIoTarget::RequestCompletionRoutine(), FxDmaPacketTransaction::ReserveAdapter(), FxUsbDevice::SelectConfigMulti(), FxIoTargetSelf::Send(), FxIoQueue::SetState(), FxIoQueue::StartPowerTransitionOff(), FxIoQueue::StopProcessingForPower(), FxDmaSystemTransaction::StopTransfer(), FxIoTarget::SubmitLocked(), FxIoTarget::SubmitSync(), FxIoTarget::TimerCallback(), and FxIoTarget::WaitForDisposeEvent().

◆ GetObjectHandleUnchecked()

PVOID __inline FxObject::GetObjectHandleUnchecked ( VOID  )
inlineprotected

Definition at line 446 of file fxobject.hpp.

449  {
450  //
451  // We don't support offset handles in the base FxObject implementation.
452  // Offsets are specialized to internal objects of an FxObject
453  //
454  if (m_ObjectSize > 0) {
455  return _ToHandle(this);
456  }
457  else {
458  return NULL;
459  }
460  }
USHORT m_ObjectSize
Definition: fxobject.hpp:254
#define NULL
Definition: types.h:112
static PVOID __inline _ToHandle(__in FxObject *Object)
Definition: fxobject.hpp:659

Referenced by FxDevice::DeleteDeviceFromFailedCreateNoDelete(), FxDevice::Destroy(), GetObjectHandle(), ProcessDestroy(), SetObjectStateLocked(), TraceDroppedEvent(), FxDevice::~FxDevice(), FxDpc::~FxDpc(), FxDriver::~FxDriver(), ~FxObject(), FxTimer::~FxTimer(), and FxWorkItem::~FxWorkItem().

◆ GetObjectSize()

USHORT FxObject::GetObjectSize ( VOID  )
inline

Definition at line 750 of file fxobject.hpp.

753  {
754  return m_ObjectSize;
755  }
USHORT m_ObjectSize
Definition: fxobject.hpp:254

Referenced by FxSpinLock::GetHistory().

◆ GetParentObjectReferenced()

_Must_inspect_result_ FxObject * FxObject::GetParentObjectReferenced ( __in PVOID  Tag)

Definition at line 856 of file fxobject.cpp.

879 {
880  KIRQL oldIrql;
881  FxObject* parentObject;
882 
883  m_SpinLock.Acquire(&oldIrql);
884 
886  parentObject = m_ParentObject;
887  }
888  else {
889  // Parent is disposing us, or we are being disposed
890  parentObject = NULL;
891  }
892 
893  if (parentObject != NULL) {
894  parentObject->ADDREF(Tag);
895  }
896 
897  m_SpinLock.Release(oldIrql);
898 
899  return parentObject;
900 }
FxObject * m_ParentObject
Definition: fxobject.hpp:303
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
USHORT m_ObjectState
Definition: fxobject.hpp:290
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
#define NULL
Definition: types.h:112

Referenced by FxDeviceBase::_SearchForDevice().

◆ GetRefCnt()

LONG FxObject::GetRefCnt ( VOID  )
inline

◆ GetTagTracker()

FxTagTracker* FxObject::GetTagTracker ( VOID  )
inline

Definition at line 766 of file fxobject.hpp.

769  {
770  if (IsDebug()) {
771  return CONTAINING_RECORD(this,
773  AllocationStart)->TagTracker;
774  }
775  else {
776  return NULL;
777  }
778  }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NULL
Definition: types.h:112
BOOLEAN IsDebug(VOID)
Definition: fxobject.hpp:409

Referenced by AddRef(), ProcessDestroy(), Release(), and ~FxObject().

◆ GetType()

◆ IsCommitted()

BOOLEAN FxObject::IsCommitted ( VOID  )
inline

Definition at line 1087 of file fxobject.hpp.

1090  {
1091  //
1092  // No need to acquire the lock because it is assumed the caller is
1093  // calling on an object whose ref count has gone to zero so there are
1094  // no other callers to contend with who might set this flag or modify
1095  // m_ObjectFlags.
1096  //
1098  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by AssignParentObject(), CallCleanupCallbacks(), FxTagTracker::CheckForAbandondedTags(), FxIoQueue::Dispose(), and ProcessDestroy().

◆ IsDebug()

◆ IsDisposed()

BOOLEAN FxObject::IsDisposed ( VOID  )
inline

Definition at line 1241 of file fxobject.hpp.

1244  {
1245  KIRQL oldIrql;
1246  BOOLEAN disposed;
1247 
1248  if (m_Globals->FxVerifierOn &&
1250  m_SpinLock.Acquire(&oldIrql);
1251 
1253  disposed = FALSE;
1254  }
1255  else {
1256  //
1257  // Parent is disposing us, or we are being disposed
1258  //
1259  disposed = TRUE;
1260  }
1261 
1262  m_SpinLock.Release(oldIrql);
1263 
1264  return disposed;
1265  }
1266  else {
1267  return TRUE;
1268  }
1269  }
BOOLEAN FxVerifierOn
Definition: fxglobals.h:420
#define TRUE
Definition: types.h:120
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
BOOLEAN FxVerifierHandle
Definition: fxglobals.h:441
unsigned char BOOLEAN
USHORT m_ObjectState
Definition: fxobject.hpp:290
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259

Referenced by FxDevice::~FxDevice(), and FxDriver::~FxDriver().

◆ IsForceDisposeThread()

BOOLEAN FxObject::IsForceDisposeThread ( __in BOOLEAN  AcquireLock = TRUE)
inline

Definition at line 1053 of file fxobject.hpp.

1056  {
1057  BOOLEAN result;
1058  KIRQL oldIrql = PASSIVE_LEVEL;
1059 
1060  if (AcquireLock) {
1061  m_SpinLock.Acquire(&oldIrql);
1062  }
1063 
1065 
1066  if (AcquireLock) {
1067  m_SpinLock.Release(oldIrql);
1068  }
1069 
1070  return result;
1071  }
GLuint64EXT * result
Definition: glext.h:11304
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
unsigned char BOOLEAN
BOOLEAN IsForceDisposeThreadLocked(VOID)
Definition: fxobject.hpp:1375
pPkgPnp m_DeviceInterfaceLock AcquireLock(pFxDriverGlobals)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

◆ IsForceDisposeThreadLocked()

BOOLEAN FxObject::IsForceDisposeThreadLocked ( VOID  )
inlineprivate

Definition at line 1375 of file fxobject.hpp.

1378  {
1380  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by IsForceDisposeThread(), and ShouldDeferDisposeLocked().

◆ IsNoDeleteDDI()

BOOLEAN FxObject::IsNoDeleteDDI ( VOID  )
inline

Definition at line 1135 of file fxobject.hpp.

1138  {
1139  // No need for lock since its only set in constructor/init
1141  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by FxDevice::DeleteObject().

◆ IsPassiveCallbacks()

BOOLEAN FxObject::IsPassiveCallbacks ( __in BOOLEAN  AcquireLock = TRUE)
inline

Definition at line 1011 of file fxobject.hpp.

1014  {
1015  BOOLEAN result;
1016  KIRQL oldIrql = PASSIVE_LEVEL;
1017 
1018  if (AcquireLock) {
1019  m_SpinLock.Acquire(&oldIrql);
1020  }
1021 
1023 
1024  if (AcquireLock) {
1025  m_SpinLock.Release(oldIrql);
1026  }
1027 
1028  return result;
1029  }
GLuint64EXT * result
Definition: glext.h:11304
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
unsigned char BOOLEAN
pPkgPnp m_DeviceInterfaceLock AcquireLock(pFxDriverGlobals)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
BOOLEAN IsPassiveCallbacksLocked(VOID)
Definition: fxobject.hpp:1359

◆ IsPassiveCallbacksLocked()

BOOLEAN FxObject::IsPassiveCallbacksLocked ( VOID  )
inlineprivate

Definition at line 1359 of file fxobject.hpp.

1362  {
1364  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by IsPassiveCallbacks().

◆ IsPassiveDispose()

BOOLEAN FxObject::IsPassiveDispose ( __in BOOLEAN  AcquireLock = TRUE)
inline

Definition at line 1032 of file fxobject.hpp.

1035  {
1036  BOOLEAN result;
1037  KIRQL oldIrql = PASSIVE_LEVEL;
1038 
1039  if (AcquireLock) {
1040  m_SpinLock.Acquire(&oldIrql);
1041  }
1042 
1044 
1045  if (AcquireLock) {
1046  m_SpinLock.Release(oldIrql);
1047  }
1048 
1049  return result;
1050  }
GLuint64EXT * result
Definition: glext.h:11304
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN IsPassiveDisposeLocked(VOID)
Definition: fxobject.hpp:1367
unsigned char BOOLEAN
pPkgPnp m_DeviceInterfaceLock AcquireLock(pFxDriverGlobals)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

◆ IsPassiveDisposeLocked()

BOOLEAN FxObject::IsPassiveDisposeLocked ( VOID  )
inlineprivate

Definition at line 1367 of file fxobject.hpp.

1370  {
1372  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by IsPassiveDispose(), and ShouldDeferDisposeLocked().

◆ IsTraceState()

BOOLEAN __inline FxObject::IsTraceState ( VOID  )
inline

Definition at line 921 of file fxobject.hpp.

924  {
926  }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by TraceDroppedEvent().

◆ MarkCommitted()

VOID FxObject::MarkCommitted ( VOID  )
inline

Definition at line 1074 of file fxobject.hpp.

1077  {
1078  //
1079  // Since no client code is accessing the handle yet, we don't need to
1080  // acquire the object state lock to set the flag since this will be
1081  // the only thread touching m_ObjectFlags.
1082  //
1084  }
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by Commit().

◆ MarkDeleteCalledLocked()

BOOLEAN FxObject::MarkDeleteCalledLocked ( VOID  )
inlineprivate

Definition at line 1345 of file fxobject.hpp.

1348  {
1349  BOOLEAN retval;
1350 
1352 
1354 
1355  return retval;
1356  }
unsigned char BOOLEAN
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by DeleteEarlyDisposedObject(), and DeleteObject().

◆ MarkDisposeOverride()

◆ MarkForceDisposeThread()

VOID FxObject::MarkForceDisposeThread ( __in FxObjectLockState  State = ObjectLock)
inline

Definition at line 989 of file fxobject.hpp.

992  {
993  //
994  // Object must always be disposed in a separate thread
995  // to allow waiting for some outstanding async
996  // operation to complete.
997  //
998  if (State == ObjectLock) {
999  KIRQL oldIrql;
1000 
1001  m_SpinLock.Acquire(&oldIrql);
1003  m_SpinLock.Release(oldIrql);
1004  }
1005  else {
1007  }
1008  }
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

◆ MarkNoDeleteDDI()

◆ MarkPassiveCallbacks()

◆ MarkPassiveDispose()

VOID FxObject::MarkPassiveDispose ( __in FxObjectLockState  State = ObjectLock)
inline

Definition at line 944 of file fxobject.hpp.

947  {
948  //
949  // Object which can have > passive level locks, but needs to be Dispose()'d
950  // at passive level. This means that the object's client cleanup
951  // routines will also be guaranteed to run at passive.
952  //
953  if (State == ObjectLock) {
954  KIRQL oldIrql;
955 
956  m_SpinLock.Acquire(&oldIrql);
958  m_SpinLock.Release(oldIrql);
959  }
960  else {
962  }
963  }
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
USHORT m_ObjectFlags
Definition: fxobject.hpp:263

Referenced by FxIoTarget::Construct(), FxDeviceBase::FxDeviceBase(), FxDpc::FxDpc(), FxInterrupt::FxInterrupt(), FxIoQueue::FxIoQueue(), FxString::FxString(), and FxTimer::FxTimer().

◆ MarkTraceState()

VOID FxObject::MarkTraceState ( VOID  )
inline

Definition at line 912 of file fxobject.hpp.

◆ operator delete()

Definition at line 306 of file fxobject.cpp.

309 {
310  ASSERT(Memory != NULL);
311 
312 
313 
314 
315 
316 
317 
318 
319 
320 
321 
322 
323 
325 }
static PVOID _GetBase(__in FxObject *Object)
Definition: fxobject.hpp:418
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
#define ASSERT(a)
Definition: mode.c:45
#define NULL
Definition: types.h:112
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361

◆ operator new() [1/2]

PVOID __inline FxObject::operator new ( __in size_t  Size,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in FxObjectType  Type 
)
inline

Definition at line 538 of file fxobject.hpp.

543  {
545 
546  return FxObjectHandleAlloc(FxDriverGlobals,
547  NonPagedPool,
548  Size,
549  0,
551  0,
552  Type);
553  }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
enum FxObjectType UINT32 enum FxWmiInstanceAction UINT32 enum FxDriverObjectUmFlags USHORT enum FxWakeInterruptEvents UINT32 PVOID FxObjectHandleAlloc(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType, __in size_t Size, __in ULONG Tag, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize, __in FxObjectType ObjectType)
Definition: handleapi.cpp:163
Type
Definition: Type.h:6
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105

◆ operator new() [2/2]

PVOID __inline FxObject::operator new ( __in size_t  Size,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__in USHORT  ExtraSize = 0 
)
inline

Definition at line 557 of file fxobject.hpp.

563  {
564  return FxObjectHandleAlloc(FxDriverGlobals,
565  NonPagedPool,
566  Size,
567  0,
568  Attributes,
569  ExtraSize,
571  }
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
enum FxObjectType UINT32 enum FxWmiInstanceAction UINT32 enum FxDriverObjectUmFlags USHORT enum FxWakeInterruptEvents UINT32 PVOID FxObjectHandleAlloc(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType, __in size_t Size, __in ULONG Tag, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize, __in FxObjectType ObjectType)
Definition: handleapi.cpp:163
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes

◆ ParentDeleteEvent()

VOID FxObject::ParentDeleteEvent ( VOID  )
private

Definition at line 611 of file fxobjectstatemachine.cpp.

627 {
628  KIRQL oldIrql;
629 
630  //
631  // Note: It's ok for an object to already be in the delete
632  // state since there can be an allowed race between
633  // parent disposing an object, and the DeleteObject()
634  // call on the object itself.
635  //
636  m_SpinLock.Acquire(&oldIrql);
637 
638  //
639  // We no longer have a parent object
640  //
642 
643  //
644  // Perform the right action based on the objects current state
645  //
646  switch(m_ObjectState) {
649  //
650  // This will release the spinlock
651  //
652  DeletedAndDisposedWorkerLocked(oldIrql, TRUE);
653  break;
654 
656  //
657  // Do nothing, workitem will move into disposed
658  //
660  m_SpinLock.Release(oldIrql);
661  break;
662 
663  case FxObjectStateDeletedAndDisposed: // Do nothing, already deleted
664  m_SpinLock.Release(oldIrql);
665  break;
666 
668  //
669  // In the process of deleting, ignore it
670  //
671  m_SpinLock.Release(oldIrql);
672  break;
673 
674  // These are bad states for this event
675 
676 
677 
678 
679 
682 
685  default:
686  //
687  // Bad state
688  //
689  ASSERT(FALSE);
690  m_SpinLock.Release(oldIrql);
691  break;
692  }
693 }
#define TRUE
Definition: types.h:120
FxObject * m_ParentObject
Definition: fxobject.hpp:303
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define NULL
Definition: types.h:112
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930

Referenced by DestroyChildren().

◆ PerformEarlyDispose()

BOOLEAN FxObject::PerformEarlyDispose ( VOID  )
private

Definition at line 476 of file fxobjectstatemachine.cpp.

493 {
494  KIRQL oldIrql;
495  BOOLEAN result;
496 
497  //
498  // By default we assume that the dispose was synchronous
499  //
500  result = TRUE;
501 
502 
503  //
504  // It's OK for an object to already be disposing due to
505  // a parent delete call.
506  //
507  // To check for verifier errors in which two calls to
508  // PerformEarlyDispose() occur, a separate flag is used
509  // rather than complicating the state machine.
510  //
511  m_SpinLock.Acquire(&oldIrql);
512 
513  //
514  // Perform the right action based on the objects current state
515  //
516  switch(m_ObjectState) {
518  //
519  // Start dispose, move into Disposing state
520  // returns with m_SpinLock released
521  //
522  result = PerformEarlyDisposeWorkerAndUnlock(oldIrql, FALSE);
523  break;
524 
526  //
527  // Start the dispose path.
528  //
529  result = PerformEarlyDisposeWorkerAndUnlock(oldIrql, FALSE);
530  break;
531 
533  //
534  // We should only get an early dispose in this state once we have thunked
535  // to passive level via the dispose list.
536  //
537  result = PerformDisposingDisposeChildrenLocked(oldIrql, FALSE);
538  break;
539 
540  case FxObjectStateWaitingForParentDeleteAndDisposed: // Do nothing, parent object will delete and dispose
541  case FxObjectStateDisposed: // Do nothing
542  case FxObjectStateDisposingEarly: // Do nothing
543  case FxObjectStateDeletedDisposing: // Do nothing, workitem will moved into disposed
546  m_SpinLock.Release(oldIrql);
547  break;
548 
549  // These are bad states for this event
552 
553  default:
555  // Bad state
556  ASSERT(FALSE);
557  m_SpinLock.Release(oldIrql);
558  break;
559  }
560 
561  return result;
562 }
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930

◆ ProcessDestroy()

VOID FxObject::ProcessDestroy ( VOID  )
private

Definition at line 251 of file fxobjectstatemachine.cpp.

254 {
255  FxTagTracker* pTagTracker;
256 
257  //
258  // Set the debug info to NULL so that we don't use it after the
259  // SelfDestruct call. Setting the DestroyFunction to NULL
260  // will also prevent reuse of the REF_OBJ after it has been destroyed.
261  //
262  pTagTracker = GetTagTracker();
263 
264  //
265  // We will free debug info later. It useful to hang on to the debug
266  // info after the destructor has been called for debugging purposes.
267  //
268  if (pTagTracker != NULL) {
269  pTagTracker->CheckForAbandondedTags();
270  }
271 
272  //
273  // Call the destroy callback *before* any desctructor is called. This
274  // way the callback has access to a full fledged object that hasn't been
275  // cleaned up yet.
276  //
277  // We only do this for committed objects. A non committed object will
278  // *NOT* have additional contexts to free.
279  //
280  if (m_ObjectSize > 0 && IsCommitted()) {
281  FxContextHeader* pHeader, *pNext;
282  WDFOBJECT h;
283  BOOLEAN first;
284 
285  //
286  // We are getting the object handle when the ref count is zero. We
287  // don't want to ASSERT in this case.
288  //
290 
291 
292 
293 
294 
295 
296 
297 
298 
299 
300 
301 
302 
303  for (pHeader = GetContextHeader();
304  pHeader != NULL;
306 
307  //
308  // Cleanup *may* have been called earlier in the objects
309  // destruction, and in this case the EvtCleanupCallback will
310  // be set to NULL. Ensuring its always called provides
311  // symmetry to the framework.
312  //
313 
314  //
315  // No need to interlockexchange out the value of
316  // EvtCleanupCallback because any codepath that might be calling
317  // CallCleanup must have a valid reference and no longer have
318  // any outstanding references
319  //
320  if (pHeader->EvtCleanupCallback != NULL) {
323  }
324 
325  if (pHeader->EvtDestroyCallback != NULL) {
328  }
329  }
330 
331  first = TRUE;
332  for (pHeader = GetContextHeader(); pHeader != NULL; pHeader = pNext) {
333 
334  pNext = pHeader->NextHeader;
335 
336  //
337  // The first header is embedded, so it will be freed with the
338  // object
339  //
340  if (first == FALSE) {
342  }
343 
344  first = FALSE;
345  }
346  }
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357  //
358  // NOTE: The delete of the tag tracker *MUST* occur before the SelfDestruct()
359  // of this object. The tag tracker has a back pointer to this object which
360  // it dereferences in its own destructor. If SelfDestruct() is called
361  // first, then ~FxTagTracker will touch freed pool and bugcheck.
362  //
363  if (pTagTracker != NULL) {
365  delete pTagTracker;
366  }
367 
368  //
369  // See NOTE above.
370  //
371  SelfDestruct();
372 }
VOID CheckForAbandondedTags(VOID)
FxContextHeader * NextHeader
Definition: fxhandle.h:71
FxTagTracker * GetTagTracker(VOID)
Definition: fxobject.hpp:766
virtual VOID SelfDestruct(VOID)
Definition: fxobject.hpp:437
#define TRUE
Definition: types.h:120
const GLint * first
Definition: glext.h:5794
PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback
Definition: fxhandle.h:76
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FALSE
Definition: types.h:117
FxContextHeader * pHeader
Definition: handleapi.cpp:604
unsigned char BOOLEAN
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback
Definition: fxhandle.h:82
BOOLEAN IsCommitted(VOID)
Definition: fxobject.hpp:1087
FxObjectDebugExtension * GetDebugExtension(VOID)
Definition: fxobject.hpp:401
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
USHORT m_ObjectSize
Definition: fxobject.hpp:254
__inline FxContextHeader * GetContextHeader(VOID)
Definition: fxobject.hpp:720
#define NULL
Definition: types.h:112
FxTagTracker * TagTracker
Definition: fxobject.hpp:208
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361

Referenced by DeferredDisposeWorkItem(), and FinalRelease().

◆ QueryInterface()

_Must_inspect_result_ NTSTATUS FxObject::QueryInterface ( __in FxQueryInterfaceParams Params)
virtual

Reimplemented in FxIoQueue, FxRequest, FxIoTargetRemote, FxFileObject, FxRequestMemory, and FxUserObject.

Definition at line 255 of file fxobject.cpp.

258 {
260 
261  if (Params->Type == FX_TYPE_OBJECT) {
262  *Params->Object = this;
264  }
265  else {
267  }
268 
269  return status;
270 }
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NOINTERFACE
Definition: ntstatus.h:812
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by AutoComplete_LoadList(), CBDAPinControl_fnConstructor(), CExplorerBand::OnWinEvent(), FxUserObject::QueryInterface(), FxSystemWorkItem::QueryInterface(), FxMemoryObject::QueryInterface(), FxFileObject::QueryInterface(), FxIoTarget::QueryInterface(), FxDriver::QueryInterface(), FxDeviceBase::QueryInterface(), FxRequest::QueryInterface(), and FxIoQueue::QueryInterface().

◆ QueueDeferredDisposeLocked()

VOID FxObject::QueueDeferredDisposeLocked ( __in FxObjectState  NewDeferedState)
private

Definition at line 958 of file fxobjectstatemachine.cpp.

981 {
982  //
983  // Queue workitem, which will run DisposeChildrenWorker()
984  //
985  ASSERT(m_Globals != NULL);
987 
988  SetObjectStateLocked(NewDeferedState);
989 
990  //FxToObjectItf::FxAddToDisposeList(m_DeviceBase, m_Globals, this);
991  if (m_DeviceBase != NULL) {
993  }
994  else {
995  m_Globals->Driver->GetDisposeList()->Add(this);
996  }
997 }
VOID __inline SetObjectStateLocked(__in FxObjectState NewState)
Definition: fxobject.hpp:369
FxDriver * Driver
Definition: fxglobals.h:374
VOID AddToDisposeList(__inout FxObject *Object)
Definition: fxdevice.hpp:387
#define ASSERT(a)
Definition: mode.c:45
VOID Add(FxObject *object)
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328
__inline FxDisposeList * GetDisposeList()
Definition: fxdriver.hpp:354
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
#define NULL
Definition: types.h:112

◆ Release()

virtual ULONG FxObject::Release ( __in_opt PVOID  Tag = NULL,
__in LONG  Line = 0,
__in_opt PSTR  File = NULL 
)
inlinevirtual

Definition at line 853 of file fxobject.hpp.

858  {
859  FxTagTracker* pTagTracker;
860  ULONG c;
861 
862  pTagTracker = GetTagTracker();
863  if (pTagTracker != NULL) {
864  pTagTracker->UpdateTagHistory(Tag, Line, File, TagRelease, m_Refcnt - 1);
865  }
866 
868 
869  if (c == 0) {
870  FinalRelease();
871  }
872 
873  return c;
874  }
VOID FinalRelease(VOID)
Definition: fxobject.cpp:207
FxTagTracker * GetTagTracker(VOID)
Definition: fxobject.hpp:766
LONG m_Refcnt
Definition: fxobject.hpp:257
const GLubyte * c
Definition: glext.h:8905
VOID UpdateTagHistory(__in PVOID Tag, __in LONG Line, __in_opt PSTR File, __in FxTagRefType RefType, __in ULONG RefCount)
Definition: ncftp.h:79
#define InterlockedDecrement
Definition: armddk.h:52
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
#define NULL
Definition: types.h:112
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
Definition: File.h:15

Referenced by FxSystemWorkItem::_Create(), _DereferenceActual(), CBDADeviceControl_fnConstructor(), CBDAPinControl_fnConstructor(), CKsProxy::CreateClockInstance(), FxPkgIo::EnqueueRequest(), FxDriver::GetRegistryPath(), CKsAllocator::KsCreateAllocatorAndGetHandle(), FxMemoryObject::Release(), FxRequest::Release(), FxRequest::ReleaseOverride(), ReleaseOverride(), CKsProxy::SetSyncSource(), and FxDmaPacketTransaction::StageTransfer().

◆ ReleaseOverride()

virtual ULONG FxObject::ReleaseOverride ( __in WDFOBJECT_OFFSET  Offset,
__in_opt PVOID  Tag = NULL,
__in LONG  Line = 0,
__in_opt PSTR  File = NULL 
)
inlinevirtual

Definition at line 892 of file fxobject.hpp.

898  {
900 
901  return Release(Tag, Line, File);
902  }
virtual ULONG Release(__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:853
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: File.h:15

Referenced by _DereferenceActual().

◆ RemoveChildObjectInternal()

_Must_inspect_result_ NTSTATUS FxObject::RemoveChildObjectInternal ( __in FxObject ChildObject)
private

Definition at line 770 of file fxobject.cpp.

803 {
804  KIRQL oldIrql;
805 
806  m_SpinLock.Acquire(&oldIrql);
807 
808  //
809  // Object is already being deleted, this object will be removed as a child
810  // by the parents Dispose()
811  //
814  m_SpinLock.Release(oldIrql);
815  return STATUS_DELETE_PENDING;
816  }
817 
818  //
819  // We should be the child object's parent
820  //
821  ASSERT(ChildObject->m_ParentObject == this);
822 
823  //
824  // Child should be on our list
825  //
826  ASSERT(!IsListEmpty(&ChildObject->m_ChildEntry));
827 
828  //
829  // We should have entries if someone wants to remove from our list
830  //
832 
833  RemoveEntryList(&ChildObject->m_ChildEntry);
834 
835  //
836  // Mark it removed
837  //
838  InitializeListHead(&ChildObject->m_ChildEntry);
839 
840  //
841  // We did not take a reference on the child object when it
842  // was added to the list, so we do not dereference it
843  // on the remove call.
844  //
845  // Note: We only dereference child objects when we are deleted
846  // ourselves, not when the child object manually breaks the
847  // association by calling this method.
848  //
849  m_SpinLock.Release(oldIrql);
850 
851  return STATUS_SUCCESS;
852 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
MxLock m_SpinLock
Definition: fxobject.hpp:296
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define ASSERT(a)
Definition: mode.c:45
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define STATUS_SUCCESS
Definition: shellext.h:65
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930

Referenced by DeleteEarlyDisposedObject(), DeleteObject(), EarlyDispose(), and RemoveParentAssignment().

◆ RemoveParentAssignment()

_Must_inspect_result_ NTSTATUS FxObject::RemoveParentAssignment ( VOID  )

Definition at line 566 of file fxobjectstatemachine.cpp.

581 {
582  KIRQL oldIrql;
584 
585  m_SpinLock.Acquire(&oldIrql);
586 
587  //
588  // Object is already being deleted, this object will be removed as a child
589  // by the parents Dispose()
590  //
593  m_SpinLock.Release(oldIrql);
594  return STATUS_DELETE_PENDING;
595  }
596 
597  // We should have a parent
599 
601  if (NT_SUCCESS(status)) {
603  }
604 
605  m_SpinLock.Release(oldIrql);
606 
607  return status;
608 }
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LONG NTSTATUS
Definition: precomp.h:26
MxLock m_SpinLock
Definition: fxobject.hpp:296
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
USHORT m_ObjectState
Definition: fxobject.hpp:290
#define NULL
Definition: types.h:112
static SERVICE_STATUS status
Definition: service.c:31
VOID __inline TraceDroppedEvent(__in FxObjectDroppedEvent Event)
Definition: fxobject.hpp:930
_Must_inspect_result_ NTSTATUS RemoveChildObjectInternal(__in FxObject *ChildObject)
Definition: fxobject.cpp:770
Definition: ps.c:97

◆ RemoveParentAssociation()

_Must_inspect_result_ NTSTATUS FxObject::RemoveParentAssociation ( VOID  )
private

◆ SelfDestruct()

virtual VOID FxObject::SelfDestruct ( VOID  )
inlineprotectedvirtual

Reimplemented in FxRequestFromLookaside, FxMemoryBufferFromPoolLookaside, and FxMemoryBufferFromLookaside.

Definition at line 437 of file fxobject.hpp.

440  {
441  delete this;
442  }

Referenced by ProcessDestroy().

◆ SetCOMWrapper()

void FxObject::SetCOMWrapper ( __drv_aliasesMem PVOID  Wrapper)
inline

Definition at line 520 of file fxobject.hpp.

520 { m_COMWrapper = Wrapper; }
PVOID m_COMWrapper
Definition: fxobject.hpp:243

◆ SetDeviceBase()

◆ SetNoContextHeader()

VOID FxObject::SetNoContextHeader ( VOID  )
inline

Definition at line 594 of file fxobject.hpp.

597  {
598  m_ObjectSize = 0;
599  }
USHORT m_ObjectSize
Definition: fxobject.hpp:254

◆ SetObjectStateLocked()

VOID __inline FxObject::SetObjectStateLocked ( __in FxObjectState  NewState)
inlineprivate

Definition at line 369 of file fxobject.hpp.

372  {
376  "Object %p, WDFOBJECT %p transitioning from %!FxObjectState! to "
377  "%!FxObjectState!", this, GetObjectHandleUnchecked(),
378  m_ObjectState, NewState);
379  if (IsDebug()) {
380  FxObjectDebugExtension* pExtension;
381 
382  pExtension = GetDebugExtension();
383  pExtension->StateHistory[
384  InterlockedIncrement(&pExtension->StateHistoryIndex)] =
385  (BYTE) NewState;
386  }
387  }
388 
389  m_ObjectState = (USHORT) NewState;
390  }
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define TRACINGOBJECT
Definition: dbgtrace.h:59
USHORT m_ObjectState
Definition: fxobject.hpp:290
FxObjectDebugExtension * GetDebugExtension(VOID)
Definition: fxobject.hpp:401
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
unsigned char BYTE
Definition: xxhash.c:193
USHORT m_ObjectFlags
Definition: fxobject.hpp:263
#define InterlockedIncrement
Definition: armddk.h:53
unsigned short USHORT
Definition: pedump.c:61
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
BOOLEAN IsDebug(VOID)
Definition: fxobject.hpp:409

Referenced by __drv_requiresIRQL(), _Releases_lock_(), DeferredDisposeWorkItem(), DeleteEarlyDisposedObject(), DeleteObject(), EarlyDispose(), FinalRelease(), QueueDeferredDisposeLocked(), and ~FxObject().

◆ ShouldDeferDisposeLocked()

BOOLEAN FxObject::ShouldDeferDisposeLocked ( __out_opt PKIRQL  PreviousIrql = NULL)
inlineprivate

Definition at line 1383 of file fxobject.hpp.

1386  {
1388  return TRUE;
1389  }
1390  else if (IsPassiveDisposeLocked()) {
1391  //
1392  // Only call KeGetCurrentIrql() if absolutely necessary. It is an
1393  // expensive call and we want to minimize the cycles required when
1394  // destroying an object that requires passive rundown
1395  //
1396 
1397  //
1398  // Cases:
1399  // 1) Caller does not know the current IRQL, so we must query for it
1400  //
1401  // 2) Caller knew prev IRQL, so we used the caller's value
1402  //
1403  if (PreviousIrql == NULL) { // case 1
1405  return TRUE;
1406  }
1407  }
1408  else if (*PreviousIrql != PASSIVE_LEVEL) { // case 2
1409  return TRUE;
1410  }
1411  }
1412 
1413  return FALSE;
1414  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN IsPassiveDisposeLocked(VOID)
Definition: fxobject.hpp:1367
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
BOOLEAN IsForceDisposeThreadLocked(VOID)
Definition: fxobject.hpp:1375
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define NULL
Definition: types.h:112

Referenced by FinalRelease().

◆ TraceDroppedEvent()

VOID __inline FxObject::TraceDroppedEvent ( __in FxObjectDroppedEvent  Event)
inline

Definition at line 930 of file fxobject.hpp.

933  {
934  if (IsTraceState()) {
937  "Object %p, WDFOBJECT %p, state %!FxObjectState! dropping event"
938  " %!FxObjectDroppedEvent!",
940  }
941  }
BOOLEAN __inline IsTraceState(VOID)
Definition: fxobject.hpp:921
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
#define TRACINGOBJECT
Definition: dbgtrace.h:59
USHORT m_ObjectState
Definition: fxobject.hpp:290
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259

Referenced by AddChildObjectInternal(), AssignParentObject(), DeleteObject(), ParentDeleteEvent(), PerformEarlyDispose(), RemoveChildObjectInternal(), and RemoveParentAssignment().

Friends And Related Function Documentation

◆ GetTriageInfo

VOID GetTriageInfo ( VOID  )
friend

Definition at line 75 of file fxlibrarycommon.cpp.

78 {
79  // Object
80  _WdfObjectTriageInfo.RawObjectSize = sizeof(FxObject);
87 
88  // Context Triage Info
89  _WdfContextTriageInfo.HeaderSize = sizeof(FxContextHeader);
90  _WdfContextTriageInfo.NextHeader = FIELD_OFFSET(FxContextHeader, NextHeader);
92  _WdfContextTriageInfo.TypeInfoPtr = FIELD_OFFSET(FxContextHeader, ContextTypeInfo);
94 
95  // Context type Triage info
99 
100  // WdfRequest Queue
101  _WdfQueueTriageInfo.QueueSize = sizeof(FxIoQueue);
102  _WdfQueueTriageInfo.IrpQueue1 = FIELD_OFFSET(FxIoQueue, m_Queue);
103  _WdfQueueTriageInfo.IrpQueue2 = FIELD_OFFSET(FxIoQueue, m_DriverCancelable);
104  _WdfQueueTriageInfo.RequestList1 = FIELD_OFFSET(FxIoQueue, m_Cancelled);
105  _WdfQueueTriageInfo.RequestList2 = FIELD_OFFSET(FxIoQueue, m_CanceledOnQueueList);
106  _WdfQueueTriageInfo.FwdProgressContext = FIELD_OFFSET(FxIoQueue, m_FwdProgContext);
107  _WdfQueueTriageInfo.PkgIo = FIELD_OFFSET(FxIoQueue, m_PkgIo);
108 
109  // Forward Progress
110  _WdfFwdProgressTriageInfo.ReservedRequestList =
111  FIELD_OFFSET(FXIO_FORWARD_PROGRESS_CONTEXT, m_ReservedRequestList);
112  _WdfFwdProgressTriageInfo.ReservedRequestInUseList =
113  FIELD_OFFSET(FXIO_FORWARD_PROGRESS_CONTEXT, m_ReservedRequestInUseList);
114  _WdfFwdProgressTriageInfo.PendedIrpList =
116 
117  // Irp Queue
118  _WdfIrpQueueTriageInfo.IrpQueueSize = sizeof(FxIrpQueue);
119  _WdfIrpQueueTriageInfo.IrpListHeader = FIELD_OFFSET(FxIrpQueue, m_Queue);
120  _WdfIrpQueueTriageInfo.IrpListEntry = FIELD_OFFSET(IRP, Tail.Overlay.ListEntry);
122  Tail.Overlay.DriverContext[FX_IRP_QUEUE_CSQ_CONTEXT_ENTRY]);
123 
124  // WdfRequest
125  _WdfRequestTriageInfo.RequestSize = sizeof(FxRequest);
126  _WdfRequestTriageInfo.CsqContext = FIELD_OFFSET(FxRequest, m_CsqContext);
128  _WdfRequestTriageInfo.ListEntryQueueOwned =
129  FIELD_OFFSET(FxRequest, m_OwnerListEntry);
130  _WdfRequestTriageInfo.ListEntryQueueOwned2 =
131  FIELD_OFFSET(FxRequest, m_OwnerListEntry2);
132  _WdfRequestTriageInfo.RequestListEntry =
133  FIELD_OFFSET(FxRequest, m_ListEntry);
134  _WdfRequestTriageInfo.FwdProgressList =
135  FIELD_OFFSET(FxRequest, m_ForwardProgressList);
136 
137  // WdfDevice
138  _WdfDeviceTriageInfo.DeviceInitSize = sizeof(WDFDEVICE_INIT);
139  _WdfDeviceTriageInfo.DeviceDriver = FIELD_OFFSET(FxDevice, m_Driver);
140 
141  // FxIrp
142  _WdfIrpTriageInfo.FxIrpSize = sizeof(FxIrp);
143  _WdfIrpTriageInfo.IrpPtr = FIELD_OFFSET(FxIrp, m_Irp);
144 }
FxObject * m_ParentObject
Definition: fxobject.hpp:303
LIST_ENTRY m_ChildEntry
Definition: fxobject.hpp:311
Definition: fxirp.hpp:28
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
#define FX_IRP_QUEUE_CSQ_CONTEXT_ENTRY
Definition: fxirpqueue.hpp:47
static WDFREQUEST_TRIAGE_INFO _WdfRequestTriageInfo
static WDFFWDPROGRESS_TRIAGE_INFO _WdfFwdProgressTriageInfo
struct _WDF_OBJECT_CONTEXT_TYPE_INFO WDF_OBJECT_CONTEXT_TYPE_INFO
FxObject(VOID)
Definition: fxobject.hpp:333
static WDFCONTEXT_TRIAGE_INFO _WdfContextTriageInfo
static WDFDEVICE_TRIAGE_INFO _WdfDeviceTriageInfo
static WDFOBJECT_TRIAGE_INFO _WdfObjectTriageInfo
static WDFIRP_TRIAGE_INFO _WdfIrpTriageInfo
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
USHORT m_ObjectSize
Definition: fxobject.hpp:254
WDFTYPE m_Type
Definition: fxobject.hpp:247
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
PFX_DRIVER_GLOBALS m_Globals
Definition: fxobject.hpp:259
static WDFIRPQUEUE_TRIAGE_INFO _WdfIrpQueueTriageInfo
static WDFCONTEXTTYPE_TRIAGE_INFO _WdfContextTypeTriageInfo
static WDFQUEUE_TRIAGE_INFO _WdfQueueTriageInfo
LIST_ENTRY m_ChildListHead
Definition: fxobject.hpp:293

Member Data Documentation

◆ @4555

union { ... }

◆ @4557

union { ... }

◆ CanDefer [1/2]

__in BOOLEAN FxObject::CanDefer
private

Definition at line 1432 of file fxobject.hpp.

Referenced by _Releases_lock_().

◆ CanDefer [2/2]

__in __drv_restoresIRQL KIRQL __in BOOLEAN FxObject::CanDefer
private

Definition at line 1465 of file fxobject.hpp.

◆ Committed

USHORT FxObject::Committed

Definition at line 276 of file fxobject.hpp.

◆ DeleteCalled

USHORT FxObject::DeleteCalled

Definition at line 275 of file fxobject.hpp.

◆ EarlyDisposedExt

USHORT FxObject::EarlyDisposedExt

Definition at line 281 of file fxobject.hpp.

◆ ForceDisposeThread

USHORT FxObject::ForceDisposeThread

Definition at line 278 of file fxobject.hpp.

◆ FxDisposeList

friend FxObject::FxDisposeList
private

Definition at line 236 of file fxobject.hpp.

◆ HasDebug

USHORT FxObject::HasDebug

Definition at line 280 of file fxobject.hpp.

◆ m_ChildEntry

LIST_ENTRY FxObject::m_ChildEntry
private

Definition at line 311 of file fxobject.hpp.

Referenced by AssignParentObject(), Construct(), DestroyChildren(), and ~FxObject().

◆ m_ChildListHead

LIST_ENTRY FxObject::m_ChildListHead
private

◆ m_COMWrapper

PVOID FxObject::m_COMWrapper
private

Definition at line 243 of file fxobject.hpp.

Referenced by GetCOMWrapper(), and SetCOMWrapper().

◆ m_Device

CfxDevice* FxObject::m_Device

Definition at line 329 of file fxobject.hpp.

Referenced by __drv_when(), FxPkgPdo::_PnpEject(), FxPkgFdo::_PnpPassDown(), FxPkgPdo::_PnpQueryBusInformation(), FxPkgPdo::_PnpQueryDeviceText(), FxPkgPdo::_PnpQueryId(), FxPkgPdo::_PnpSetLock(), FxPkgFdo::_PowerPassDown(), FxPkgPdo::_QueryCapsWorkItem(), FxPkgGeneral::AcquireRemoveLockForClose(), FxPkgPdo::AddEjectionDevice(), FxPkgPnp::AddRemovalDevice(), FxPkgPnp::AddUsageDevice(), FxPkgPnp::AllocateEnumInfo(), FxIoQueue::AllocateReservedRequest(), FxInterrupt::AssignResources(), FxDmaSystemTransaction::CallEvtDmaCompleted(), FxPkgPnp::CleanupStateMachines(), FxPkgPnp::CommitUsageNotification(), FxPkgPnp::CompletePnpRequest(), FxPkgPnp::CompletePowerRequest(), FxUsbPipeContinuousReader::Config(), FxPkgGeneral::ConfigureConstraints(), FxIoQueue::ConfigureConstraints(), FxPkgGeneral::ConfigureFileObjectClass(), FxInterrupt::Connect(), FxInterrupt::ConnectInternal(), FxPkgGeneral::CreateCompleted(), FxPkgFdo::CreateDefaultDeviceList(), FxChildList::CreateDevice(), FxPkgPnp::CreatePowerThread(), FxPkgPnp::CreatePowerThreadIfNeeded(), FxPkgIo::CreateQueue(), FxInterrupt::CreateWakeInterruptMachine(), FxPkgGeneral::DecrementOpenHandleCount(), FxPkgPnp::DeleteDevice(), FxFileObject::DeleteFileObjectFromFailedCreate(), FxInterrupt::DeleteObject(), FxPkgFdo::DeleteSymbolicLinkOverload(), FxPkgPdo::DeleteSymbolicLinkOverload(), FxInterrupt::Disconnect(), FxInterrupt::DisconnectInternal(), FxPkgPnp::DisconnectInterruptNP(), FxDefaultIrpHandler::Dispatch(), FxWmiIrpHandler::Dispatch(), FxPkgIo::Dispatch(), FxPkgGeneral::Dispatch(), FxPkgPnp::Dispatch(), FxPkgFdo::DispatchDeviceSetPower(), FxPkgPdo::DispatchDeviceSetPower(), FxPkgIo::DispatchStep1(), FxPkgIo::DispatchStep2(), FxPkgFdo::DispatchSystemSetPower(), FxPkgPdo::DispatchSystemSetPower(), FxPkgPnp::DispatchWaitWake(), FxPkgIo::DispathToInCallerContextCallback(), FxChildList::Dispose(), FxInterrupt::DpcHandler(), FxChildList::EndScan(), FxPkgPnp::FilterResourceRequirements(), FxInterrupt::FlushAndRundown(), FxInterrupt::ForceDisconnect(), FxInterrupt::ForceReconnect(), FxPkgGeneral::ForwardCreateRequest(), FxIoQueue::ForwardRequestToParent(), FxChildList::FxChildList(), FxFileObject::FxFileObject(), FxIoQueue::FxIoQueue(), FxPackage::FxPackage(), FxPkgIo::FxPkgIo(), FxPackage::GetDevice(), FxFileObject::GetDevice(), FxChildList::GetDevice(), FxPkgIo::GetDevice(), FxInterrupt::GetDevice(), FxRequest::GetDevice(), FxIoQueue::GetDevice(), GetDevice(), FxIoTarget::GetDeviceHandle(), FxIoTargetSelf::GetDispatchQueue(), FxPkgIo::GetDriver(), FxPkgIo::GetIoQueueListLocked(), FxPkgPnp::HandleQueryBusInformation(), FxPkgPnp::HandleQueryBusRelations(), FxPkgPnp::HandleQueryDeviceRelations(), FxPkgPnp::HandleQueryInterface(), FxPkgFdo::HandleQueryPnpDeviceStateCompletion(), if(), FxPkgFdo::Initialize(), FxTimer::Initialize(), FxWorkItem::Initialize(), FxPkgPdo::Initialize(), FxInterrupt::Initialize(), FxChildList::Initialize(), FxIoQueue::Initialize(), FxPkgPnp::Initialize(), FxInterrupt::InitializeWorker(), FxInterrupt::InterruptDisableInvokeCallback(), FxInterrupt::InterruptEnableInvokeCallback(), FxUsbDevice::IsObjectDisposedOnRemove(), FxUsbInterface::MakeAndConfigurePipes(), FxPkgPnp::NotPowerPolicyOwnerEnterNewState(), FxPkgGeneral::OnCleanup(), FxPkgGeneral::OnClose(), FxPkgGeneral::OnCreate(), FxPkgGeneral::OnShutdown(), FxPkgPnp::PnpCheckAndIncrementRestartCount(), FxPkgPnp::PnpCleanupForRemove(), FxPkgPnp::PnpDeviceUsageNotification(), FxPkgPnp::PnpEnableInterfacesAndRegisterWmi(), FxPkgPnp::PnpEnterNewState(), FxPkgPdo::PnpEventEjectHardwareOverload(), FxPkgPdo::PnpEventPdoRemovedOverload(), FxPkgPnp::PnpEventRemovedCommonCode(), FxPkgFdo::PnpFilterResourceRequirements(), FxPkgPnp::PnpMatchResources(), FxPkgPnp::PnpProcessEvent(), FxPkgPnp::PnpProcessEventInner(), FxPkgPdo::PnpQueryCapabilities(), FxPkgPdo::PnpQueryDeviceRelations(), FxPkgPdo::PnpQueryResourceRequirements(), FxPkgPdo::PnpQueryResources(), FxPkgPnp::PnpReleaseHardware(), FxPkgFdo::PnpSendStartDeviceDownTheStackOverload(), FxPkgFdo::PostCreateDeviceInitialize(), FxPkgGeneral::PostCreateDeviceInitialize(), FxPkgPdo::PowerCheckParentOverload(), FxPkgPnp::PowerConnectInterruptFailed(), FxPkgPdo::PowerDisableWakeAtBusOverload(), FxPkgPdo::PowerEnableWakeAtBusOverload(), FxPkgPnp::PowerEnterNewState(), FxPkgPnp::PowerGotoDx(), FxPkgPnp::PowerGotoDxIoStopped(), FxPkgPnp::PowerGotoDxIoStoppedNP(), FxPkgPnp::PowerMakeWakeRequestNonCancelable(), FxPkgPdo::PowerNotifyParentChildWakeArmed(), FxPkgPdo::PowerNotifyParentChildWakeDisarmed(), FxPkgPdo::PowerParentPowerDereference(), FxPkgPnp::PowerPolicyCanIdlePowerDown(), FxPkgPnp::PowerPolicyDisarmWakeFromSx(), FxPkgPnp::PowerPolicyEnterNewState(), FxPkgPnp::PowerPolicyProcessEvent(), FxPkgPnp::PowerPolicyProcessEventInner(), FxPkgPnp::PowerPolicySendDevicePowerRequest(), FxPkgPnp::PowerPolicySendWaitWakeRequest(), FxPkgPnp::PowerPolicySetS0IdleSettings(), FxPkgPnp::PowerPolicyUpdateSystemWakeSource(), FxPkgPnp::PowerProcessEvent(), FxPkgPnp::PowerProcessEventInner(), FxPkgPnp::PowerSetDevicePowerState(), FxChildList::ProcessBusRelations(), FxPkgPnp::ProcessDelayedDeletion(), FxChildList::ProcessModificationsLocked(), FxPkgFdo::ProcessRemoveDeviceOverload(), FxPkgPdo::ProcessRemoveDeviceOverload(), FxPkgPnp::QueryForCapabilities(), FxPkgPnp::QueryForD3ColdInterface(), FxPkgFdo::QueryForPowerThread(), FxPkgFdo::QueryForReenumerationInterface(), FxIoQueue::QueueDriverCreatedRequest(), FxPkgFdo::RaiseDevicePower(), FxPkgPnp::ReadRegistryS0Idle(), FxPkgPnp::ReadRegistrySxWake(), FxPkgPnp::ReadStateFromRegistry(), FxInterrupt::ReportActive(), FxInterrupt::ReportInactive(), FxPkgIo::ResetStateForRestart(), FxPkgIo::ResumeProcessingForPower(), FxPkgPnp::RevertUsageNotificationFlags(), FxPkgPnp::SaveState(), FxUsbDevice::SelectConfig(), FxUsbInterface::SelectSetting(), FxIoTargetSelf::Send(), FxPkgFdo::SendIrpSynchronously(), FxPkgPnp::SetDeviceFailed(), FxPkgPnp::SetInternalFailure(), FxPkgPnp::SetPendingPnpIrp(), FxIoQueue::SetTransitionFromEmpty(), FxPkgPnp::SetUsageNotificationFlags(), FxPkgIo::StopProcessingForPower(), FxPkgPnp::UpdateWmiInstance(), FxPkgPnp::ValidateCmResource(), FxPkgPnp::ValidateInterruptResourceCm(), FxInterrupt::WorkItemHandler(), FxInterrupt::~FxInterrupt(), FxPkgIo::~FxPkgIo(), and FxPkgPnp::~FxPkgPnp().

◆ m_DeviceBase

◆ m_DisposeSingleEntry

SINGLE_LIST_ENTRY FxObject::m_DisposeSingleEntry
private

Definition at line 316 of file fxobject.hpp.

Referenced by _FromDisposeEntry(), Construct(), and ~FxObject().

◆ m_Globals

◆ m_ObjectFlags

◆ m_ObjectFlagsByName

struct { ... } FxObject::m_ObjectFlagsByName

◆ m_ObjectSize

USHORT FxObject::m_ObjectSize
private

◆ m_ObjectState

◆ m_ParentObject

◆ m_Refcnt

LONG FxObject::m_Refcnt
private

Definition at line 257 of file fxobject.hpp.

Referenced by AddRef(), Construct(), GetRefCnt(), and Release().

◆ m_SpinLock

MxLock FxObject::m_SpinLock
private

Definition at line 296 of file fxobject.hpp.