ReactOS 0.4.15-dev-7842-g558ab78
FxNPagedLookasideListFromPool Class Reference

#include <fxnpagedlookasidelist.hpp>

Inheritance diagram for FxNPagedLookasideListFromPool:
Collaboration diagram for FxNPagedLookasideListFromPool:

Public Member Functions

 FxNPagedLookasideListFromPool (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in ULONG PoolTag)
 
virtual _Must_inspect_result_ NTSTATUS Initialize (__in size_t BufferSize, __in PWDF_OBJECT_ATTRIBUTES MemoryAttributes)
 
virtual _Must_inspect_result_ NTSTATUS Allocate (__out FxMemoryObject **PPMemory)
 
- Public Member Functions inherited from FxLookasideListFromPool
 FxLookasideListFromPool (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in ULONG PoolTag)
 
- Public Member Functions inherited from FxLookasideList
 FxLookasideList (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in ULONG PoolTag)
 
virtual _Must_inspect_result_ NTSTATUS Initialize (__in size_t BufferSize, __in PWDF_OBJECT_ATTRIBUTES MemoryAttributes)=0
 
virtual _Must_inspect_result_ NTSTATUS Allocate (__out FxMemoryObject **PPMemory)=0
 
size_t GetBufferSize (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)
 

Protected Member Functions

 ~FxNPagedLookasideListFromPool (VOID)
 
virtual VOID Reclaim (__in FxMemoryBufferFromLookaside *Memory)
 
virtual VOID ReclaimPool (__inout PVOID Pool)
 
virtual VOID ReclaimPool (__inout PVOID Pool)=0
 
- Protected Member Functions inherited from FxLookasideList
virtual ~FxLookasideList ()
 
virtual VOID Reclaim (__in FxMemoryBufferFromLookaside *Memory)=0
 
_Must_inspect_result_ NTSTATUS InitializeLookaside (__in USHORT BufferSize, __in USHORT MemoryObjectSize, __in PWDF_OBJECT_ATTRIBUTES MemoryAttributes)
 
PVOID InitObjectAlloc (__out_bcount(this->m_MemoryObjectSize) PVOID Alloc)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 

Protected Attributes

NPAGED_LOOKASIDE_LIST m_ObjectLookaside
 
NPAGED_LOOKASIDE_LIST m_PoolLookaside
 
- Protected Attributes inherited from FxLookasideList
size_t m_BufferSize
 
size_t m_MemoryObjectSize
 
ULONG m_PoolTag
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Private Attributes

friend FxMemoryBufferFromPoolLookaside
 

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)
 
- Public Attributes inherited from FxLookasideList
WDF_OBJECT_ATTRIBUTES m_MemoryAttributes
 
- Static Protected Member Functions inherited from FxLookasideList
static VOID _Reclaim (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __inout PNPAGED_LOOKASIDE_LIST List, __in FxMemoryBufferFromLookaside *Memory)
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 59 of file fxnpagedlookasidelist.hpp.

Constructor & Destructor Documentation

◆ FxNPagedLookasideListFromPool()

FxNPagedLookasideListFromPool::FxNPagedLookasideListFromPool ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in ULONG  PoolTag 
)

Definition at line 140 of file fxnpagedlookasidelistkm.cpp.

143 : FxLookasideListFromPool(FxDriverGlobals, sizeof(*this), PoolTag)
144{
145}
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:164

◆ ~FxNPagedLookasideListFromPool()

FxNPagedLookasideListFromPool::~FxNPagedLookasideListFromPool ( VOID  )
protected

Definition at line 147 of file fxnpagedlookasidelistkm.cpp.

150{
151 if (m_MemoryObjectSize != 0) {
153 }
154
155 if (m_BufferSize != 0) {
157 }
158}
VOID NTAPI ExDeleteNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside)
Definition: lookas.c:170

Member Function Documentation

◆ Allocate()

_Must_inspect_result_ NTSTATUS FxNPagedLookasideListFromPool::Allocate ( __out FxMemoryObject **  PPMemory)
virtual

Implements FxLookasideList.

Definition at line 210 of file fxnpagedlookasidelistkm.cpp.

213{
215 PVOID pObj, pBuf;
216
217 //
218 // Allocate the object which will contain the 2ndary allocation
219 //
221
222 if (pObj == NULL) {
224 }
225
226 pObj = InitObjectAlloc(pObj);
227
228 //
229 // Create the 2ndary allocation (the one the driver writer uses), what will
230 // be FxMemoryBufferFromPoolLookaside::m_Pool below.
231 //
233 if (pBuf == NULL) {
234 //
235 // This case is safe because Reclaim doesn't treat the pointer as an
236 // object, rather it just performs pointer math and then frees the alloc
237 //
240 }
241
242 //
243 // Construct a new FxMemoryBufferFromLookaside using the pool allocated
244 // above.
245 //
248 this,
250 pBuf);
251
252 //
253 // pBuffer might be displaced if there is a debug extension
254 //
255 ASSERT(_GetBase(pBuffer) == pObj);
256
257 *PPMemory = pBuffer;
258
259 return STATUS_SUCCESS;
260}
PVOID InitObjectAlloc(__out_bcount(this->m_MemoryObjectSize) PVOID Alloc)
WDF_OBJECT_ATTRIBUTES m_MemoryAttributes
virtual VOID Reclaim(__in FxMemoryBufferFromLookaside *Memory)
static PVOID _GetBase(__in FxObject *Object)
Definition: fxobject.hpp:418
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
__inline PVOID FxAllocateFromNPagedLookasideList(_In_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ size_t ElementSize=0)
Definition: fxglobalskm.h:565
#define ASSERT(a)
Definition: mode.c:44
PVOID pBuffer
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ Initialize()

_Must_inspect_result_ NTSTATUS FxNPagedLookasideListFromPool::Initialize ( __in size_t  BufferSize,
__in PWDF_OBJECT_ATTRIBUTES  MemoryAttributes 
)
virtual

Implements FxLookasideList.

Definition at line 162 of file fxnpagedlookasidelistkm.cpp.

166{
168
172
173 if (!NT_SUCCESS(status)) {
174 return status;
175 }
176
177 //
178 // Initialize a non-paged pool with these characteristics.
179 //
181 NULL,
182 NULL,
183 0,
185 m_PoolTag,
186 0);
187
189
190 //
191 // Initialize a non-paged pool with these characteristics.
192 //
193 // Free and Allocate are left intentionally NULL so that we use the Ex
194 // versions. We want to use the Ex versions because the allocations are >=
195 // PAGE_SIZE and we don't want to burn a whole page for pool tracking.
196 //
198 NULL,
199 NULL,
200 0,
202 m_PoolTag,
203 0);
204
205 return status;
206}
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ NTSTATUS InitializeLookaside(__in USHORT BufferSize, __in USHORT MemoryObjectSize, __in PWDF_OBJECT_ATTRIBUTES MemoryAttributes)
#define BufferSize
Definition: mmc.h:75
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:218
Definition: ps.c:97
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
Definition: wdfmemory.h:409

◆ Reclaim()

VOID FxNPagedLookasideListFromPool::Reclaim ( __in FxMemoryBufferFromLookaside Memory)
protectedvirtual

Implements FxLookasideList.

Definition at line 263 of file fxnpagedlookasidelistkm.cpp.

266{
268}
static VOID _Reclaim(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __inout PNPAGED_LOOKASIDE_LIST List, __in FxMemoryBufferFromLookaside *Memory)
_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

Referenced by Allocate().

◆ ReclaimPool()

virtual VOID FxNPagedLookasideListFromPool::ReclaimPool ( __inout PVOID  Pool)
inlineprotectedvirtual

Implements FxLookasideListFromPool.

Definition at line 97 of file fxnpagedlookasidelist.hpp.

100 {
102 }
Definition: bufpool.h:50
__inline VOID FxFreeToNPagedLookasideList(__in PNPAGED_LOOKASIDE_LIST Lookaside, __in PVOID Entry)
Definition: fxglobalskm.h:611

Member Data Documentation

◆ FxMemoryBufferFromPoolLookaside

friend FxNPagedLookasideListFromPool::FxMemoryBufferFromPoolLookaside
private

Definition at line 61 of file fxnpagedlookasidelist.hpp.

Referenced by Allocate().

◆ m_ObjectLookaside

NPAGED_LOOKASIDE_LIST FxNPagedLookasideListFromPool::m_ObjectLookaside
protected

◆ m_PoolLookaside

NPAGED_LOOKASIDE_LIST FxNPagedLookasideListFromPool::m_PoolLookaside
protected

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