ReactOS  0.4.15-dev-2700-g4b4ffa9
FxMemoryBufferFromPool Class Reference

#include <fxmemorybufferfrompool.hpp>

Inheritance diagram for FxMemoryBufferFromPool:
Collaboration diagram for FxMemoryBufferFromPool:

Public Member Functions

 FxMemoryBufferFromPool (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
 
virtual PVOID GetBuffer (VOID)
 
BOOLEAN AllocateBuffer (__in POOL_TYPE Type, __in ULONG Tag)
 
- 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
_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)
 
_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)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _Create (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in POOL_TYPE PoolType, __in ULONG PoolTag, __in size_t BufferSize, __out FxMemoryObject **Buffer)
 
- 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)
 

Protected Member Functions

 FxMemoryBufferFromPool (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize, __in USHORT ObjectSize)
 
 ~FxMemoryBufferFromPool ()
 
- 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

PVOID m_Pool
 
- 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 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 25 of file fxmemorybufferfrompool.hpp.

Constructor & Destructor Documentation

◆ FxMemoryBufferFromPool() [1/2]

FxMemoryBufferFromPool::FxMemoryBufferFromPool ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in size_t  BufferSize 
)

Definition at line 26 of file fxmemorybufferfrompool.cpp.

29  :
30  FxMemoryObject(FxDriverGlobals, sizeof(*this), BufferSize)
31 /*++
32 
33 Routine Description:
34  Constructor for this object.
35 
36 Arguments:
37  BufferSize - The buffer size associated with this object
38 
39 Return Value:
40  None
41 
42  --*/
43 {
44  m_Pool = NULL;
45 }
FxMemoryObject(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in size_t BufferSize)
#define NULL
Definition: types.h:112
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by _Create().

◆ FxMemoryBufferFromPool() [2/2]

FxMemoryBufferFromPool::FxMemoryBufferFromPool ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in size_t  BufferSize,
__in USHORT  ObjectSize 
)
protected

Definition at line 47 of file fxmemorybufferfrompool.cpp.

51  :
52  FxMemoryObject(FxDriverGlobals, ObjectSize, BufferSize)
53 /*++
54 
55 Routine Description:
56  Constructor for this object.
57 
58 Arguments:
59  BufferSize - The buffer size associated with this object
60 
61  ObjectSize - size of the derived object
62 
63 Return Value:
64  None
65 
66  --*/
67 {
68  m_Pool = NULL;
69 }
FxMemoryObject(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in size_t BufferSize)
#define NULL
Definition: types.h:112
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

◆ ~FxMemoryBufferFromPool()

FxMemoryBufferFromPool::~FxMemoryBufferFromPool ( )
protected

Definition at line 71 of file fxmemorybufferfrompool.cpp.

85 {
86  if (m_Pool != NULL) {
88  }
89 }
static __inline VOID MxFreePool(__in PVOID Ptr)
Definition: mxmemorykm.h:41
#define NULL
Definition: types.h:112

Member Function Documentation

◆ _Create()

_Must_inspect_result_ NTSTATUS FxMemoryBufferFromPool::_Create ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__in POOL_TYPE  PoolType,
__in ULONG  PoolTag,
__in size_t  BufferSize,
__out FxMemoryObject **  Buffer 
)
static

Definition at line 93 of file fxmemorybufferfrompool.cpp.

101 {
105  BOOLEAN isPaged;
106 
107  isPaged = FxIsPagedPoolType(PoolType);
108 
109  if (isPaged) {
111  Attributes);
112  }
113  else {
114  pDeviceBase = NULL;
115  }
116 
117  //
118  // FxMemoryBufferFromPool can handle paged allocation as well. We only
119  // use FxMemoryPagedBufferFromPool if we have an FxDeviceBase that we can use
120  // in the dispose path, otherwise these 2 classes are the same.
121  //
122  if (pDeviceBase != NULL) {
123  ASSERT(isPaged);
124  pBuffer = new(FxDriverGlobals, Attributes)
126  }
127  else {
128  pBuffer = new(FxDriverGlobals, Attributes)
129  FxMemoryBufferFromPool(FxDriverGlobals, BufferSize);
130  }
131 
132  if (pBuffer == NULL) {
134  }
135 
137 
138  if (pBuffer->AllocateBuffer(PoolType, PoolTag) == FALSE) {
140  }
141 
142  if (!NT_SUCCESS(status)) {
143  pBuffer->DeleteFromFailedCreate();
144  return status;
145  }
146 
147  if (isPaged) {
148  //
149  // Callbacks might be a bit excessive (passive dispose is what we are
150  // really after) because this object has no callbacks, but this is being
151  // proactive in case any callbacks are added. If they are added, this
152  // will take care of them w/out additional changes to object setup.
153  //
154  pBuffer->MarkPassiveCallbacks(ObjectDoNotLock);
155  }
156 
157  *Buffer = pBuffer;
158 
159  return STATUS_SUCCESS;
160 }
BOOLEAN FxIsPagedPoolType(__in POOL_TYPE Type)
Definition: wdfpool.cpp:43
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
FxDeviceBase * pDeviceBase
LONG NTSTATUS
Definition: precomp.h:26
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
PVOID pBuffer
Definition: bufpool.h:45
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
FxMemoryBufferFromPool(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97

Referenced by FxMemoryObject::_Create().

◆ AllocateBuffer()

BOOLEAN FxMemoryBufferFromPool::AllocateBuffer ( __in POOL_TYPE  Type,
__in ULONG  Tag 
)
inline

Definition at line 55 of file fxmemorybufferfrompool.hpp.

59  {
61  return m_Pool != NULL ? TRUE : FALSE;
62  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
Definition: mxmemorykm.h:30
Type
Definition: Type.h:6
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
virtual size_t GetBufferSize(VOID)
#define NULL
Definition: types.h:112

◆ GetBuffer()

virtual PVOID FxMemoryBufferFromPool::GetBuffer ( VOID  )
inlinevirtual

Implements IFxMemory.

Definition at line 47 of file fxmemorybufferfrompool.hpp.

50  {
51  return m_Pool;
52  }

Member Data Documentation

◆ m_Pool

PVOID FxMemoryBufferFromPool::m_Pool
protected

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