1 // 2 // Copyright (C) Microsoft. All rights reserved. 3 // 4 #ifndef _FXRELATEDDEVICELIST_H_ 5 #define _FXRELATEDDEVICELIST_H_ 6 7 class FxRelatedDeviceList : protected FxSpinLockTransactionedList { 8 public: FxRelatedDeviceList(VOID)9 FxRelatedDeviceList( 10 VOID 11 ) 12 { 13 m_DeleteOnRemove = TRUE; 14 m_NeedReportMissing = 0; 15 } 16 17 VOID LockForEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)18 LockForEnum( 19 __in PFX_DRIVER_GLOBALS FxDriverGlobals 20 ) 21 { 22 FxSpinLockTransactionedList::LockForEnum(FxDriverGlobals); // __super call 23 } 24 25 VOID UnlockFromEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)26 UnlockFromEnum( 27 __in PFX_DRIVER_GLOBALS FxDriverGlobals 28 ) 29 { 30 FxSpinLockTransactionedList::UnlockFromEnum(FxDriverGlobals); // __super call 31 } 32 33 _Must_inspect_result_ 34 NTSTATUS 35 Add( 36 __in PFX_DRIVER_GLOBALS Globals, 37 __inout FxRelatedDevice* Entry 38 ); 39 40 VOID 41 Remove( 42 __in PFX_DRIVER_GLOBALS Globals, 43 __in MdDeviceObject Device 44 ); 45 46 _Must_inspect_result_ 47 FxRelatedDevice* 48 GetNextEntry( 49 __in_opt FxRelatedDevice* Entry 50 ); 51 52 UCHAR IncrementRetries(VOID)53 IncrementRetries( 54 VOID 55 ) 56 { 57 m_Retries++; 58 return m_Retries; 59 } 60 61 VOID ZeroRetries(VOID)62 ZeroRetries( 63 VOID 64 ) 65 { 66 m_Retries = 0; 67 } 68 69 _Must_inspect_result_ 70 PVOID operator new(__in size_t Size,__in PFX_DRIVER_GLOBALS FxDriverGlobals)71 operator new( 72 __in size_t Size, 73 __in PFX_DRIVER_GLOBALS FxDriverGlobals 74 ) 75 { 76 return FxPoolAllocate(FxDriverGlobals, NonPagedPool, Size); 77 } 78 79 VOID operator delete(__in PVOID pointer)80 operator delete( 81 __in PVOID pointer 82 ) 83 { 84 FxPoolFree(pointer); 85 } 86 87 protected: 88 virtual 89 _Must_inspect_result_ 90 NTSTATUS 91 ProcessAdd( 92 __in FxTransactionedEntry *Entry 93 ); 94 95 virtual 96 BOOLEAN 97 Compare( 98 __in FxTransactionedEntry* Entry, 99 __in PVOID Data 100 ); 101 102 virtual 103 VOID 104 EntryRemoved( 105 __in FxTransactionedEntry* Entry 106 ); 107 108 public: 109 ULONG m_NeedReportMissing; 110 }; 111 112 #endif // _FXRELATEDDEVICELIST_H_ 113