ReactOS 0.4.15-dev-7924-g5949c20
FxMemoryBufferFromLookaside Class Reference

#include <fxmemorybufferfromlookaside.hpp>

Inheritance diagram for FxMemoryBufferFromLookaside:
Collaboration diagram for FxMemoryBufferFromLookaside:

Public Member Functions

 FxMemoryBufferFromLookaside (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __inout FxLookasideList *Lookaside, __in size_t BufferSize)
 
_Must_inspect_result_ PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __inout PVOID ValidMemory, __in size_t BufferSize, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
virtual PVOID GetBuffer (VOID)
 
- Public Member Functions inherited from FxMemoryObject
virtual size_t GetBufferSize (VOID)
 
virtual PMDL GetMdl (VOID)
 
virtual WDFMEMORY GetHandle (VOID)
 
virtual PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
virtual ULONG AddRef (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)
 
virtual ULONG Release (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)
 
virtual VOID Delete (VOID)
 
virtual USHORT GetFlags (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 IFxMemory
virtual PVOID GetBuffer (VOID)=0
 
virtual size_t GetBufferSize (VOID)=0
 
virtual PMDL GetMdl (VOID)=0
 
virtual WDFMEMORY GetHandle (VOID)=0
 
virtual USHORT GetFlags (VOID)=0
 
virtual PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)=0
 
virtual ULONG AddRef (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
 
virtual ULONG Release (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
 
virtual VOID Delete (VOID)=0
 
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets (__in_opt PWDFMEMORY_OFFSET Offsets)
 
_Must_inspect_result_ NTSTATUS CopyFromPtr (__in_opt PWDFMEMORY_OFFSET DestinationOffsets, __in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets)
 
_Must_inspect_result_ NTSTATUS CopyToPtr (__in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
 
virtual PVOID GetBuffer (VOID)=0
 
virtual size_t GetBufferSize (VOID)=0
 
virtual PMDL GetMdl (VOID)=0
 
virtual WDFMEMORY GetHandle (VOID)=0
 
virtual USHORT GetFlags (VOID)=0
 
virtual PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)=0
 
virtual ULONG AddRef (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
 
virtual ULONG Release (__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
 
virtual VOID Delete (VOID)=0
 
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets (__in_opt PWDFMEMORY_OFFSET Offsets)
 
_Must_inspect_result_ NTSTATUS CopyFromPtr (__in_opt PWDFMEMORY_OFFSET DestinationOffsets, __in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets)
 
_Must_inspect_result_ NTSTATUS CopyToPtr (__in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
 

Protected Member Functions

 FxMemoryBufferFromLookaside (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __inout FxLookasideList *Lookaside, __in size_t BufferSize, __in USHORT ObjectSize)
 
 ~FxMemoryBufferFromLookaside ()
 
VOID Init (VOID)
 
virtual VOID SelfDestruct (VOID)
 
- Protected Member Functions inherited from FxMemoryObject
 FxMemoryObject (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in size_t BufferSize)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__inout FxQueryInterfaceParams *Params)
 
- 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

FxLookasideListm_pLookaside
 
- Protected Attributes inherited from FxMemoryObject
size_t m_BufferSize
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Additional Inherited Members

- Static Public Member Functions inherited from FxMemoryObject
static _Must_inspect_result_ NTSTATUS _Create (__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in POOL_TYPE PoolType, __in ULONG PoolTag, __in size_t BufferSize, __out FxMemoryObject **Object)
 
- 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)
 
- Static Protected Member Functions inherited from IFxMemory
static _Must_inspect_result_ NTSTATUS _CopyPtrToPtr (__in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
 
static _Must_inspect_result_ NTSTATUS _CopyPtrToPtr (__in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
 

Detailed Description

Definition at line 24 of file fxmemorybufferfromlookaside.hpp.

Constructor & Destructor Documentation

◆ FxMemoryBufferFromLookaside() [1/2]

FxMemoryBufferFromLookaside::FxMemoryBufferFromLookaside ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__inout FxLookasideList Lookaside,
__in size_t  BufferSize 
)

Definition at line 28 of file fxmemorybufferfromlookaside.cpp.

32 :
33 FxMemoryObject(FxDriverGlobals,
34 COMPUTE_OBJECT_SIZE(sizeof(*this), (ULONG) BufferSize),
37/*++
38
39Routine Description:
40 Constructor for this object. Remembers which lookaside list this object
41 was allocated from
42
43 We round up the object size (via COMPUTE_OBJECT_SIZE) because the object,
44 the context and the memory it returns via GetBuffer() are all in one allocation
45 and the returned memory needs to match the alignment that raw pool follows.
46
47Arguments:
48 Lookaside - The lookaside list which this object will return itself to when
49 its last reference is removed
50
51 BufferSize - The buffer size associated with this object
52
53Return Value:
54 None
55
56 --*/
57{
58 Init();
59}
#define COMPUTE_OBJECT_SIZE(_rawObjectSize, _extraSize)
Definition: fxhandle.h:107
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:414

◆ FxMemoryBufferFromLookaside() [2/2]

FxMemoryBufferFromLookaside::FxMemoryBufferFromLookaside ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__inout FxLookasideList Lookaside,
__in size_t  BufferSize,
__in USHORT  ObjectSize 
)
protected

Definition at line 61 of file fxmemorybufferfromlookaside.cpp.

66 :
67 FxMemoryObject(FxDriverGlobals, ObjectSize, BufferSize),
69/*++
70
71Routine Description:
72 Constructor for this object. Remembers which lookaside list this object
73 was allocated from
74
75 There is no round up of the ObjectSize because the derived class may not
76 embed the buffer in the same allocation as the object. If it were to do so,
77 the derived object should do the round up on its own.
78
79Arguments:
80 Lookaside - The lookaside list which this object will return itself to when
81 its last reference is removed
82
83 BufferSize - The buffer size associated with this object
84
85 ObjectSize - The size of this object.
86
87Return Value:
88 None
89
90 --*/
91{
92 Init();
93}

◆ ~FxMemoryBufferFromLookaside()

FxMemoryBufferFromLookaside::~FxMemoryBufferFromLookaside ( )
protected

Definition at line 105 of file fxmemorybufferfromlookaside.cpp.

117{
118}

Referenced by SelfDestruct().

Member Function Documentation

◆ GetBuffer()

PVOID FxMemoryBufferFromLookaside::GetBuffer ( VOID  )
virtual

Implements IFxMemory.

Reimplemented in FxMemoryBufferFromPoolLookaside.

Definition at line 182 of file fxmemorybufferfromlookaside.cpp.

183{
184 //
185 // The buffer follows the struct itself
186 //
187 return ((PUCHAR) this) + COMPUTE_RAW_OBJECT_SIZE(sizeof(*this));
188}
#define COMPUTE_RAW_OBJECT_SIZE(_rawObjectSize)
Definition: fxhandle.h:100
unsigned char * PUCHAR
Definition: typedefs.h:53

◆ Init()

VOID FxMemoryBufferFromLookaside::Init ( VOID  )
protected

Definition at line 96 of file fxmemorybufferfromlookaside.cpp.

99{
100 m_pLookaside->ADDREF(this);
101}

◆ operator new()

_Must_inspect_result_ PVOID FxMemoryBufferFromLookaside::operator new ( __in size_t  Size,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__inout PVOID  ValidMemory,
__in size_t  BufferSize,
__in PWDF_OBJECT_ATTRIBUTES  Attributes 
)

Definition at line 122 of file fxmemorybufferfromlookaside.cpp.

151{
152 size_t objectSize;
153
155
157
158 //
159 // We round up the object size (via COMPUTE_OBJECT_SIZE) because the object,
160 // and the buffer are all in one allocation and the returned memory needs to
161 // match the alignment that raw pool follows.
162 //
163 // Note that FxMemoryBufferFromLookaside is used for buffer less than a page
164 // size so downcasting to USHORT (via COMPUTE_OBJECT_SIZE) is safe because
165 // size of object plus buffer (<page size) would be smaller than 64K that
166 // could fit in USHORT. See comments in FxMemoryObject.hpp for info on
167 // various fx memory objects.
168 //
170 (ULONG) BufferSize);
171
173 FxDriverGlobals,
174 ValidMemory,
175 (USHORT) objectSize,
178 );
179}
PVOID FxObjectAndHandleHeaderInit(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID AllocationStart, __in USHORT ObjectSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in FxObjectType ObjectType)
Definition: handleapi.cpp:292
@ FxObjectTypeExternal
Definition: fxobject.hpp:120
#define ASSERT(a)
Definition: mode.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
unsigned short USHORT
Definition: pedump.c:61
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

◆ SelfDestruct()

VOID FxMemoryBufferFromLookaside::SelfDestruct ( VOID  )
protectedvirtual

Reimplemented from FxObject.

Reimplemented in FxMemoryBufferFromPoolLookaside.

Definition at line 191 of file fxmemorybufferfromlookaside.cpp.

207{
209
210 //
211 // Call the destructor first.
212 //
213 // Since we were allocated from a lookaside list, return ourself to this
214 // list and then free the reference we have on it. We can't call this from
215 // within the destructor b/c then all parent objects would be destructing on
216 // freed pool.
217 //
219
220 //
221 // After FxLookaside::Reclaim, this no longer points to valid memory so we
222 // must stash off m_pLookaside first so we can use it after the reclaim.
223 //
224 pLookaside = m_pLookaside;
225 pLookaside->Reclaim(this);
226 pLookaside->RELEASE(this);
227}
virtual VOID Reclaim(__in FxMemoryBufferFromLookaside *Memory)=0
FxLookasideList * pLookaside

Referenced by FxMemoryBufferFromPoolLookaside::SelfDestruct().

Member Data Documentation

◆ m_pLookaside

FxLookasideList* FxMemoryBufferFromLookaside::m_pLookaside
protected

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