ReactOS 0.4.15-dev-8096-ga0eec98
FxResourceCollection Class Reference

#include <fxresource.hpp>

Inheritance diagram for FxResourceCollection:
Collaboration diagram for FxResourceCollection:

Public Member Functions

BOOLEAN RemoveAndDelete (__in ULONG Index)
 
_Must_inspect_result_ NTSTATUS AddAt (__in ULONG Index, __in FxObject *Object)
 
BOOLEAN IsRemoveAllowed (VOID)
 
BOOLEAN IsAddAllowed (VOID)
 
VOID MarkChanged (VOID)
 
BOOLEAN IsChanged (VOID)
 
- Public Member Functions inherited from FxCollection
 FxCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 ~FxCollection (VOID)
 
BOOLEAN Add (__in FxObject *Item)
 
VOID StealCollection (__in FxCollection *Collection)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 
- Public Member Functions inherited from FxCollectionInternal
 FxCollectionInternal (VOID)
 
 ~FxCollectionInternal (VOID)
 
_Must_inspect_result_ FxCollectionEntryFindEntry (__in ULONG Index)
 
_Must_inspect_result_ FxCollectionEntryFindEntryByObject (__in FxObject *Object)
 
ULONG Count (VOID)
 
BOOLEAN Add (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Item)
 
_Must_inspect_result_ FxObjectGetItem (__in ULONG Index)
 
_Must_inspect_result_ FxObjectGetFirstItem (VOID)
 
_Must_inspect_result_ FxObjectGetLastItem (VOID)
 
NTSTATUS Remove (__in ULONG Index)
 
VOID CleanupEntry (__in FxCollectionEntry *Entry)
 
VOID CleanupEntryObject (__in FxObject *Object)
 
NTSTATUS RemoveEntry (__in FxCollectionEntry *Entry)
 
_Must_inspect_result_ NTSTATUS RemoveItem (__in FxObject *Item)
 
_Must_inspect_result_ FxCollectionEntryStart (VOID)
 
_Must_inspect_result_ FxCollectionEntryEnd (VOID)
 
VOID Clear (VOID)
 

Public Attributes

UCHAR m_AccessFlags
 
BOOLEAN m_Changed
 

Protected Member Functions

 FxResourceCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFTYPE Type, __in USHORT Size, __in UCHAR AccessFlags=FxResourceNoAccess)
 
- Protected Member Functions inherited from FxCollection
 FxCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFTYPE Type, __in USHORT Size)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 
- Protected Member Functions inherited from FxCollectionInternal
_Must_inspect_result_ FxCollectionEntryAllocateEntry (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID AddEntry (__in FxCollectionEntry *Node, __in FxObject *Item)
 

Additional Inherited Members

- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 
- Protected Attributes inherited from FxCollectionInternal
ULONG m_Count
 
LIST_ENTRY m_ListHead
 

Detailed Description

Definition at line 280 of file fxresource.hpp.

Constructor & Destructor Documentation

◆ FxResourceCollection()

FxResourceCollection::FxResourceCollection ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFTYPE  Type,
__in USHORT  Size,
__in UCHAR  AccessFlags = FxResourceNoAccess 
)
inlineprotected

Definition at line 282 of file fxresource.hpp.

287 : FxCollection(FxDriverGlobals, Type, Size),
288 m_AccessFlags(AccessFlags), m_Changed(FALSE)
289 {
290 //
291 // Driver cannot delete this or any of its derivations
292 //
294 }
Type
Definition: Type.h:7
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Member Function Documentation

◆ AddAt()

_Must_inspect_result_ NTSTATUS FxResourceCollection::AddAt ( __in ULONG  Index,
__in FxObject Object 
)

Definition at line 103 of file fxresourcecollection.cpp.

122{
123 FxCollectionEntry *pNew;
126 KIRQL irql;
127
128 if (IsAddAllowed() == FALSE) {
130 "Adds not allowed on handle %p, add at index %d"
131 "failed", GetObjectHandle(), Index);
132
134
136 }
137
138 Lock(&irql);
139
140 ple = NULL;
142
144
145 if (pNew != NULL) {
146 //
147 // Inserting at the current count (i.e. one past the end) is the same
148 // as append.
149 //
150 if (Index == WDF_INSERT_AT_END || Index == Count()) {
151 ple = &m_ListHead;
152 }
153 else {
155 ULONG i;
156
157 for (cur = Start(), end = End(), i = 0;
158 cur != end;
159 cur = cur->Next(), i++) {
160 if (i == Index) {
161 ple = &cur->m_ListEntry;
162 break;
163 }
164 }
165
166 if (ple == NULL) {
167 delete pNew;
169 }
170 }
171 }
172 else {
174 }
175
176 if (NT_SUCCESS(status)) {
177 PLIST_ENTRY blink;
178
179 // ple now points to the list entry which we will insert our node
180 // *before*
181
182 blink = ple->Blink;
183
184 // Link the previous with the new entry
185 blink->Flink = &pNew->m_ListEntry;
186 pNew->m_ListEntry.Blink = blink;
187
188 // Link the current with the new entry
189 pNew->m_ListEntry.Flink = ple;
190 ple->Blink = &pNew->m_ListEntry;
191
192 AddEntry(pNew, Object);
193
194 //
195 // Mark the list as changed so when we go to create a WDM resource list
196 // we know if a new list is needed.
197 //
198 MarkChanged();
199 }
200
201 Unlock(irql);
202
203 if (!NT_SUCCESS(status)) {
204 Object->DeleteFromFailedCreate();
205 }
206
207 return status;
208}
LONG NTSTATUS
Definition: precomp.h:26
FxCollectionEntry * Next(VOID)
LIST_ENTRY m_ListEntry
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
BOOLEAN IsAddAllowed(VOID)
Definition: fxresource.hpp:319
VOID MarkChanged(VOID)
Definition: fxresource.hpp:327
#define TRACINGPNP
Definition: dbgtrace.h:67
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
return pObject GetObjectHandle()
PSINGLE_LIST_ENTRY ple
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxCollectionEntry * cur
GLuint GLuint end
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int Count
Definition: noreturn.cpp:7
#define STATUS_ARRAY_BOUNDS_EXCEEDED
Definition: ntstatus.h:376
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
VOID AddEntry(__in FxCollectionEntry *Node, __in FxObject *Item)
_Must_inspect_result_ FxCollectionEntry * End(VOID)
_Must_inspect_result_ FxCollectionEntry * AllocateEntry(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
@ Start
Definition: partlist.h:33
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
#define WDF_INSERT_AT_END
Definition: wdfresource.h:50
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127

◆ IsAddAllowed()

BOOLEAN FxResourceCollection::IsAddAllowed ( VOID  )
inline

Definition at line 319 of file fxresource.hpp.

322 {
324 }
#define FLAG_TO_BOOL(_Flags, _FlagMask)
Definition: fxobject.hpp:125
@ FxResourceAddAllowed
Definition: fxresource.hpp:275

Referenced by AddAt().

◆ IsChanged()

BOOLEAN FxResourceCollection::IsChanged ( VOID  )
inline

Definition at line 335 of file fxresource.hpp.

338 {
339 return m_Changed;
340 }

Referenced by FxPkgFdo::PnpFilterResourceRequirements(), and FxPkgFdo::PnpSendStartDeviceDownTheStackOverload().

◆ IsRemoveAllowed()

BOOLEAN FxResourceCollection::IsRemoveAllowed ( VOID  )
inline

Definition at line 311 of file fxresource.hpp.

314 {
316 }
@ FxResourceRemoveAllowed
Definition: fxresource.hpp:276

Referenced by RemoveAndDelete().

◆ MarkChanged()

VOID FxResourceCollection::MarkChanged ( VOID  )
inline

Definition at line 327 of file fxresource.hpp.

330 {
331 m_Changed = TRUE;
332 }
#define TRUE
Definition: types.h:120

Referenced by __drv_strictTypeMatch(), AddAt(), if(), RemoveAndDelete(), and while().

◆ RemoveAndDelete()

BOOLEAN FxResourceCollection::RemoveAndDelete ( __in ULONG  Index)

Definition at line 35 of file fxresourcecollection.cpp.

51{
54 KIRQL irql;
55
56 if (IsRemoveAllowed() == FALSE) {
58 "Removes not allowed on handle %p, remove at index %d"
59 "failed", GetObjectHandle(), Index);
60
62 return FALSE;
63 }
64
65 pObject = NULL;
66
67 Lock(&irql);
68
70 if (pEntry != NULL) {
71
72 //
73 // Mark the list as changed so when we go to create a WDM resource list we
74 // know if a new list is needed.
75 //
77
78 pObject = pEntry->m_Object;
79
80 //
81 // Remove the entry
82 //
84 }
85 Unlock(irql);
86
87 if (pObject != NULL) {
88 //
89 // Delete the object since we created it
90 //
92 pObject = NULL;
93
94 return TRUE;
95 }
96 else {
97 return FALSE;
98 }
99}
virtual VOID DeleteObject(VOID)
BOOLEAN IsRemoveAllowed(VOID)
Definition: fxresource.hpp:311
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
FxObject * pObject
_Must_inspect_result_ FxCollectionEntry * FindEntry(__in ULONG Index)
NTSTATUS RemoveEntry(__in FxCollectionEntry *Entry)

Member Data Documentation

◆ m_AccessFlags

UCHAR FxResourceCollection::m_AccessFlags

◆ m_Changed

BOOLEAN FxResourceCollection::m_Changed

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