ReactOS  0.4.15-dev-2704-gd5265b0
FxRequestMemory Class Reference

#include <fxrequestmemory.hpp>

Inheritance diagram for FxRequestMemory:
Collaboration diagram for FxRequestMemory:

Public Member Functions

 FxRequestMemory (__in PFX_DRIVER_GLOBALS Globals)
 
virtual PVOID GetBuffer (VOID)
 
virtual _Must_inspect_result_ PMDL GetMdl (VOID)
 
virtual USHORT GetFlags (VOID)
 
VOID SetBuffer (_In_ FxRequest *Request, _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ PMDL BackingMdl, _In_ size_t BufferSize, _In_ BOOLEAN ReadOnly)
 
VOID SetMdl (__in FxRequest *Request, __in PMDL Mdl, __in PVOID MdlBuffer, __in size_t BufferSize, __in BOOLEAN ReadOnly)
 
_Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
 ~FxRequestMemory (VOID)
 
- Public Member Functions inherited from FxMemoryBufferPreallocated
 FxMemoryBufferPreallocated (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
 
VOID UpdateBuffer (_Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
 
_Must_inspect_result_ NTSTATUS QueryInterface (__inout FxQueryInterfaceParams *Params)
 
- Public Member Functions inherited from FxMemoryObject
virtual size_t GetBufferSize (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)
 
- 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)
 
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 NTSTATUS Create (__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out FxRequestMemory **Object)
 
- 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

VOID SetFlags (__in USHORT Flags)
 
- Protected Member Functions inherited from FxMemoryBufferPreallocated
 FxMemoryBufferPreallocated (__in USHORT ObjectSize, __in PFX_DRIVER_GLOBALS Globals)
 
 FxMemoryBufferPreallocated (_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ USHORT ObjectSize, _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
 
 ~FxMemoryBufferPreallocated ()
 
- Protected Member Functions inherited from FxMemoryObject
 FxMemoryObject (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT ObjectSize, __in size_t BufferSize)
 
- 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

FxRequestm_Request
 
PMDL m_Mdl
 
USHORT m_Flags
 
- Protected Attributes inherited from FxMemoryBufferPreallocated
PVOID m_pBuffer
 
- 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 33 of file fxrequestmemory.hpp.

Constructor & Destructor Documentation

◆ FxRequestMemory()

FxRequestMemory::FxRequestMemory ( __in PFX_DRIVER_GLOBALS  Globals)

Definition at line 83 of file fxrequestmemory.cpp.

85  :
86  FxMemoryBufferPreallocated(sizeof(*this), FxDriverGlobals)
87 /*++
88 
89 Routine Description:
90 
91  Default constructor for this object.
92 
93  --*/
94 {
95 
96  //
97  // Our constructor chain:
98  //
99  // FxRequestMemory(ObjectSize, PFX_DRIVER_GLOBALS),
100  // : FxMemoryBufferPreallocated(ObjectSize, PFX_DRIVER_GLOBALS),
101  // : FxMemoryObject(PFX_DRIVER_GLOBALS, ObjectSize, ObjectSize),
102  // : FxObject(FX_TYPE_MEMORY, ObjectSize, PFX_DRIVER_GLOBALS)
103  //
104  m_Request = NULL;
105 
106  m_Mdl = NULL;
107 
108  m_Flags = 0;
109 }
FxRequest * m_Request
FxMemoryBufferPreallocated(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
#define NULL
Definition: types.h:112

Referenced by Create().

◆ ~FxRequestMemory()

FxRequestMemory::~FxRequestMemory ( VOID  )

Definition at line 112 of file fxrequestmemory.cpp.

128 {
129  //
130  // Non-embedded case releases resources in the destructor
131  // rather than Dispose to ensure all outstanding device driver
132  // references are gone.
133  //
134 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
135  if( m_Mdl != NULL ) {
138  m_Mdl = NULL;
139  }
140 #endif
141 
142  if( m_Request != NULL ) {
144  m_Request = NULL;
145  }
146 }
FxRequest * m_Request
virtual PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
VOID __inline FxMdlFree(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PMDL Mdl)
Definition: fxmdl.h:60
static __inline VOID MxUnlockPages(__in PMDL Mdl)
Definition: mxgeneralkm.h:357
VOID ReleaseIrpReference(VOID)
Definition: fxrequest.cpp:2512
#define NULL
Definition: types.h:112

Member Function Documentation

◆ Create()

NTSTATUS FxRequestMemory::Create ( __in PFX_DRIVER_GLOBALS  DriverGlobals,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__out FxRequestMemory **  Object 
)
static

Definition at line 54 of file fxrequestmemory.cpp.

68 {
70 
71  // Build an FxRequestMemory object now
73 
74  if (pMemory == NULL) {
76  }
77 
78  *Object = pMemory;
79 
80  return STATUS_SUCCESS;
81 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
FxMemoryObject * pMemory
DriverGlobals
FxRequestMemory(__in PFX_DRIVER_GLOBALS Globals)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes

Referenced by FxRequest::ProbeAndLockForRead(), and FxRequest::ProbeAndLockForWrite().

◆ GetBuffer()

PVOID FxRequestMemory::GetBuffer ( VOID  )
virtual

Reimplemented from FxMemoryBufferPreallocated.

Definition at line 164 of file fxrequestmemory.cpp.

181 {
182  return m_pBuffer;
183 }

◆ GetFlags()

virtual USHORT FxRequestMemory::GetFlags ( VOID  )
inlinevirtual

Reimplemented from FxMemoryObject.

Definition at line 65 of file fxrequestmemory.hpp.

68  {
69  return m_Flags;
70  }

◆ GetMdl()

_Must_inspect_result_ PMDL FxRequestMemory::GetMdl ( VOID  )
virtual

Reimplemented from FxMemoryObject.

Definition at line 187 of file fxrequestmemory.cpp.

202 {
203  return m_Mdl;
204 }

◆ QueryInterface()

_Must_inspect_result_ NTSTATUS FxRequestMemory::QueryInterface ( __in FxQueryInterfaceParams Params)
virtual

Reimplemented from FxObject.

Definition at line 150 of file fxrequestmemory.cpp.

153 {
154  if (Params->Type == FX_TYPE_REQUEST_MEMORY) {
155  *Params->Object = (FxRequestMemory*) this;
156  return STATUS_SUCCESS;
157  }
158  else {
159  return FxMemoryBufferPreallocated::QueryInterface(Params); // __super call
160  }
161 }
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
_Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ SetBuffer()

VOID FxRequestMemory::SetBuffer ( _In_ FxRequest Request,
_Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID  Buffer,
_In_ PMDL  BackingMdl,
_In_ size_t  BufferSize,
_In_ BOOLEAN  ReadOnly 
)

Definition at line 207 of file fxrequestmemory.cpp.

236 {
237  ASSERT(m_pBuffer == NULL);
238  ASSERT(m_Request == NULL);
239  ASSERT(m_Mdl == NULL);
240 
241  ASSERT(Request != NULL);
242 
243  m_pBuffer = Buffer;
244  m_Mdl = BackingMdl;
246 
247  m_Request = Request;
248 
249  //
250  // A single FxRequest IRP reference
251  // is outstanding until destroy
252  //
254 
255  // Set access checking if its a readonly buffer
256  if (ReadOnly) {
258  }
259 }
VOID AddIrpReference(VOID)
Definition: fxrequest.cpp:2470
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
Definition: arc.h:80
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
VOID SetFlags(__in USHORT Flags)
FxRequest * m_Request
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
#define BufferSize
Definition: mmc.h:75

◆ SetFlags()

VOID FxRequestMemory::SetFlags ( __in USHORT  Flags)
inlineprotected

Definition at line 103 of file fxrequestmemory.hpp.

106  {
107  m_Flags = Flags;
108  }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by SetBuffer(), and SetMdl().

◆ SetMdl()

VOID FxRequestMemory::SetMdl ( __in FxRequest Request,
__in PMDL  Mdl,
__in PVOID  MdlBuffer,
__in size_t  BufferSize,
__in BOOLEAN  ReadOnly 
)

Definition at line 262 of file fxrequestmemory.cpp.

298 {
299 
300  ASSERT(m_pBuffer == NULL);
301  ASSERT(m_Mdl == NULL);
302  ASSERT(m_Request == NULL);
303  ASSERT(Request != NULL);
304 
305  m_Mdl = Mdl;
306  m_pBuffer = MdlBuffer;
308 
309  m_Request = Request;
310 
311  //
312  // A single FxRequest IRP reference is outstanding until destroy
313  //
315 
316  // Set access checking if it's a readonly buffer
317  if (ReadOnly) {
319  }
320 
321  return;
322 }
VOID AddIrpReference(VOID)
Definition: fxrequest.cpp:2470
Definition: arc.h:80
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
VOID SetFlags(__in USHORT Flags)
FxRequest * m_Request
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define BufferSize
Definition: mmc.h:75

Member Data Documentation

◆ m_Flags

USHORT FxRequestMemory::m_Flags
protected

Definition at line 119 of file fxrequestmemory.hpp.

Referenced by FxRequestMemory(), GetFlags(), and SetFlags().

◆ m_Mdl

PMDL FxRequestMemory::m_Mdl
protected

Definition at line 117 of file fxrequestmemory.hpp.

Referenced by FxRequestMemory(), GetMdl(), SetBuffer(), SetMdl(), and ~FxRequestMemory().

◆ m_Request

FxRequest* FxRequestMemory::m_Request
protected

Definition at line 112 of file fxrequestmemory.hpp.

Referenced by FxRequestMemory(), SetBuffer(), SetMdl(), and ~FxRequestMemory().


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