ReactOS 0.4.15-dev-7931-gfd331f1
FxDeviceDescriptionEntry Struct Reference

#include <fxchildlist.hpp>

Inheritance diagram for FxDeviceDescriptionEntry:
Collaboration diagram for FxDeviceDescriptionEntry:

Public Member Functions

 FxDeviceDescriptionEntry (__inout FxChildList *DeviceList, __in ULONG AddressDescriptionSize, __in ULONG IdentificationDescriptionSize)
 
 ~FxDeviceDescriptionEntry ()
 
_Must_inspect_result_ PVOID operator new (__in size_t AllocatorBlock, __in PFX_DRIVER_GLOBALS DriverGlobals, __in size_t TotalDescriptionSize)
 
FxChildListGetParentList (VOID)
 
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER GetId (VOID)
 
BOOLEAN IsDeviceReportedMissing (VOID)
 
BOOLEAN IsDeviceRemoved (VOID)
 
VOID ProcessDeviceRemoved (VOID)
 
VOID DeviceSurpriseRemoved (VOID)
 
_Must_inspect_result_ FxDeviceDescriptionEntryClone (__inout PLIST_ENTRY FreeListHead)
 
BOOLEAN MatchStateToFlags (__in ULONG Flags)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Protected Member Functions

BOOLEAN __inline IsPresent (VOID)
 
- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 

Static Protected Member Functions

static FxDeviceDescriptionEntry_FromDescriptionLink (__in PLIST_ENTRY Link)
 
static FxDeviceDescriptionEntry_FromModificationLink (__in PLIST_ENTRY Link)
 

Protected Attributes

LIST_ENTRY m_DescriptionLink
 
FxChildListDescriptionState m_DescriptionState
 
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription
 
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER m_AddressDescription
 
LIST_ENTRY m_ModificationLink
 
FxChildListModificationState m_ModificationState
 
CfxDevicem_Pdo
 
FxChildListm_DeviceList
 
BOOLEAN m_FoundInLastScan
 
BOOLEAN m_ProcessingSurpriseRemove
 
BOOLEAN m_PendingDeleteOnScanEnd
 
FxChildListReportedMissingCallbackState m_ReportedMissingCallbackState
 

Friends

class FxDevice
 
class FxChildList
 

Detailed Description

Definition at line 666 of file fxchildlist.hpp.

Constructor & Destructor Documentation

◆ FxDeviceDescriptionEntry()

FxDeviceDescriptionEntry::FxDeviceDescriptionEntry ( __inout FxChildList DeviceList,
__in ULONG  AddressDescriptionSize,
__in ULONG  IdentificationDescriptionSize 
)

Definition at line 31 of file fxchildlist.cpp.

36{
39 this, WDF_ALIGN_SIZE_UP(sizeof(*this), sizeof(PVOID)));
40
42 AddressDescriptionSize;
43
48 WDF_ALIGN_SIZE_UP(AddressDescriptionSize, sizeof(PVOID)));
49
52 }
53
56
58
60
64
65 //
66 // The parent DO can go away while the child still exists (stuck in a
67 // suprise remove state w/an open handle). As such, when the parent is
68 // destroyed, it will release its reference on the FxChildList. Each
69 // description will have its own reference to the list to keep the list
70 // alive as long as the child DO exists.
71 //
72 m_DeviceList->ADDREF(this);
73}
#define FALSE
Definition: types.h:117
PDEVICE_LIST DeviceList
Definition: utils.c:27
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
@ ModificationInsert
description Header IdentificationDescriptionSize
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER m_IdentificationDescription
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER m_AddressDescription
FxChildList * m_DeviceList
FxChildListModificationState m_ModificationState
struct _WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER * PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER
struct _WDF_CHILD_ADDRESS_DESCRIPTION_HEADER * PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144

◆ ~FxDeviceDescriptionEntry()

FxDeviceDescriptionEntry::~FxDeviceDescriptionEntry ( )

Definition at line 75 of file fxchildlist.cpp.

76{
77 m_DeviceList->RELEASE(this);
78}

Member Function Documentation

◆ _FromDescriptionLink()

◆ _FromModificationLink()

◆ Clone()

_Must_inspect_result_ FxDeviceDescriptionEntry * FxDeviceDescriptionEntry::Clone ( __inout PLIST_ENTRY  FreeListHead)

Definition at line 259 of file fxchildlist.cpp.

262{
263 FxDeviceDescriptionEntry* pNewEntry;
265
266 pNewEntry = new(m_DeviceList->GetDriverGlobals(),
271
272 if (pNewEntry == NULL) {
273 return NULL;
274 }
275
278
282 }
283
284 if (NT_SUCCESS(status)) {
285 pNewEntry->m_FoundInLastScan = TRUE;
286 }
287 else {
288 //
289 // Free it later
290 //
291 InsertTailList(FreeListHead, &pNewEntry->m_DescriptionLink);
292 pNewEntry = NULL;
293 }
294
295 return pNewEntry;
296}
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN HasAddressDescriptions(VOID)
ULONG m_IdentificationDescriptionSize
ULONG m_AddressDescriptionSize
_Must_inspect_result_ NTSTATUS DuplicateId(__out PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Dest, __in PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Source)
_Must_inspect_result_ NTSTATUS DuplicateAddress(__out PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER Dest, __in PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER Source)
size_t m_TotalDescriptionSize
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InsertTailList(ListHead, Entry)
Definition: ps.c:97

◆ DeviceSurpriseRemoved()

VOID FxDeviceDescriptionEntry::DeviceSurpriseRemoved ( VOID  )

Definition at line 102 of file fxchildlist.cpp.

105{
106 KIRQL irql;
107
111}
KSPIN_LOCK m_ListLock
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609

Referenced by FxPkgPdo::_PnpSurpriseRemoval(), and FxPkgPdo::PnpEventSurpriseRemovePendingOverload().

◆ GetId()

PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER FxDeviceDescriptionEntry::GetId ( VOID  )
inline

Definition at line 697 of file fxchildlist.hpp.

700 {
702 }

Referenced by FxPkgPdo::PnpEventEjectHardwareOverload().

◆ GetParentList()

FxChildList * FxDeviceDescriptionEntry::GetParentList ( VOID  )
inline

◆ IsDeviceRemoved()

BOOLEAN FxDeviceDescriptionEntry::IsDeviceRemoved ( VOID  )

Definition at line 148 of file fxchildlist.cpp.

151{
152 KIRQL irql;
153 BOOLEAN removed;
155
157 removed = FALSE;
159
161
163
165 //
166 // We should delete this entry as it was reported missing.
167 //
169
171
172 //
173 // Remove from the current list if no scan going on.
174 // Note that the description entry can't be removed from list if scan
175 // count is > 0 because it might be part of an iterator that driver is
176 // still using to iterate thru the child list.
177 //
178 if (pList->GetScanCount() == 0) {
179 //
180 // Remove from the current list
181 //
184 }
185 else {
186 //
187 // The entry will be removed and deleted when scan count goes to
188 // zero by the scanning thread, so make sure pdo deosn't reference
189 // the entry any more.
190 //
192 if (m_Pdo != NULL) {
194 }
195 }
196
197 removed = TRUE;
198
199 //
200 // No need to add a reference to m_DeviceList becuase as we hold a
201 // reference to it already. This reference is bound by the lifetime
202 // of this object, so we can always safely touch m_DeviceList even if
203 // the FDO is gone before the child is removed.
204 //
205 }
206
208
209 return removed;
210}
unsigned char BOOLEAN
ULONG GetScanCount(VOID)
__inline FxPkgPdo * GetPdoPkg(VOID)
Definition: fxdevice.hpp:1254
FxDeviceDescriptionEntry * m_Description
Definition: fxpkgpdo.hpp:40
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
@ ModificationUnspecified
@ DescriptionUnspecified
@ DescriptionReportedMissing
FxChildList * pList
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define ASSERT(a)
Definition: mode.c:44
FxChildListDescriptionState m_DescriptionState
FxChildList * GetParentList(VOID)

Referenced by FxPkgPdo::PnpEventCheckForDevicePresenceOverload().

◆ IsDeviceReportedMissing()

BOOLEAN FxDeviceDescriptionEntry::IsDeviceReportedMissing ( VOID  )

Definition at line 114 of file fxchildlist.cpp.

131{
132 KIRQL irql;
134
137 result = TRUE;
138 }
139 else {
140 result = FALSE;
141 }
143
144 return result;
145}
GLuint64EXT * result
Definition: glext.h:11304

Referenced by FxPkgPdo::DeleteSymbolicLinkOverload().

◆ IsPresent()

BOOLEAN __inline FxDeviceDescriptionEntry::IsPresent ( VOID  )
inlineprotected

Definition at line 755 of file fxchildlist.hpp.

758 {
761 return TRUE;
762 }
763 else {
764 return FALSE;
765 }
766 }
@ DescriptionPresentNeedsInstantiation
@ DescriptionInstantiatedHasObject

◆ MatchStateToFlags()

BOOLEAN FxDeviceDescriptionEntry::MatchStateToFlags ( __in ULONG  Flags)
inline

Definition at line 731 of file fxchildlist.hpp.

734 {
737 ||
741 ||
744 ) {
745
746 return TRUE;
747 }
748
749 return FALSE;
750 }
@ DescriptionNotPresent
@ WdfRetrievePendingChildren
Definition: wdfchildlist.h:63
@ WdfRetrieveMissingChildren
Definition: wdfchildlist.h:62
@ WdfRetrievePresentChildren
Definition: wdfchildlist.h:61
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

◆ operator new()

_Must_inspect_result_ PVOID FxDeviceDescriptionEntry::operator new ( __in size_t  AllocatorBlock,
__in PFX_DRIVER_GLOBALS  DriverGlobals,
__in size_t  TotalDescriptionSize 
)

Definition at line 82 of file fxchildlist.cpp.

87{
88 PVOID p;
89
90 UNREFERENCED_PARAMETER(AllocatorBlock);
91
92 p = FxPoolAllocate(FxDriverGlobals, NonPagedPool, TotalDescriptionSize);
93
94 if (p != NULL) {
95 RtlZeroMemory(p, TotalDescriptionSize);
96 }
97
98 return p;
99}
#define NonPagedPool
Definition: env_spec_w32.h:307
GLfloat GLfloat p
Definition: glext.h:8902
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ ProcessDeviceRemoved()

VOID FxDeviceDescriptionEntry::ProcessDeviceRemoved ( VOID  )

Definition at line 213 of file fxchildlist.cpp.

216{
217 LIST_ENTRY freeHead;
218 KIRQL irql;
220
222
224 InitializeListHead(&freeHead);
226
227 //
228 // Remove from the current list. In some cases the entry may not be in any
229 // list in which case RemoveEntryList() will be a noop.
230 // Note that the description entry can't be removed from list if scan count
231 // is > 0 because it might be part of an iterator that driver is still using
232 // to iterate thru the child list.
233 //
236
237 //
238 // Instead of reimplementing a single description cleanup, just use the
239 // version which cleans up a list.
240 //
242 }
243 else {
244 //
245 // The entry will be removed when scan count goes to zero.
246 //
250 }
251
253
255}
VOID DrainFreeListHead(__inout PLIST_ENTRY FreeListHead)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Definition: typedefs.h:120

Referenced by FxPkgPdo::PnpEventPdoRemovedOverload().

Friends And Related Function Documentation

◆ FxChildList

friend class FxChildList
friend

Definition at line 668 of file fxchildlist.hpp.

◆ FxDevice

friend class FxDevice
friend

Definition at line 667 of file fxchildlist.hpp.

Member Data Documentation

◆ m_AddressDescription

PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER FxDeviceDescriptionEntry::m_AddressDescription
protected

Definition at line 797 of file fxchildlist.hpp.

Referenced by Clone(), FxChildList::CloneEntryLocked(), and FxDeviceDescriptionEntry().

◆ m_DescriptionLink

LIST_ENTRY FxDeviceDescriptionEntry::m_DescriptionLink
protected

◆ m_DescriptionState

FxChildListDescriptionState FxDeviceDescriptionEntry::m_DescriptionState
protected

◆ m_DeviceList

◆ m_FoundInLastScan

BOOLEAN FxDeviceDescriptionEntry::m_FoundInLastScan
protected

Definition at line 807 of file fxchildlist.hpp.

Referenced by Clone(), and FxDeviceDescriptionEntry().

◆ m_IdentificationDescription

PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER FxDeviceDescriptionEntry::m_IdentificationDescription
protected

Definition at line 795 of file fxchildlist.hpp.

Referenced by Clone(), FxDeviceDescriptionEntry(), and GetId().

◆ m_ModificationLink

LIST_ENTRY FxDeviceDescriptionEntry::m_ModificationLink
protected

Definition at line 799 of file fxchildlist.hpp.

Referenced by _FromModificationLink(), and FxDeviceDescriptionEntry().

◆ m_ModificationState

FxChildListModificationState FxDeviceDescriptionEntry::m_ModificationState
protected

◆ m_Pdo

CfxDevice* FxDeviceDescriptionEntry::m_Pdo
protected

Definition at line 803 of file fxchildlist.hpp.

Referenced by IsDeviceRemoved().

◆ m_PendingDeleteOnScanEnd

BOOLEAN FxDeviceDescriptionEntry::m_PendingDeleteOnScanEnd
protected

◆ m_ProcessingSurpriseRemove

BOOLEAN FxDeviceDescriptionEntry::m_ProcessingSurpriseRemove
protected

◆ m_ReportedMissingCallbackState

FxChildListReportedMissingCallbackState FxDeviceDescriptionEntry::m_ReportedMissingCallbackState
protected

Definition at line 813 of file fxchildlist.hpp.


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