ReactOS  0.4.15-dev-3163-gf17c2c0
FxRequestSystemBuffer Struct Reference

#include <fxrequest.hpp>

Inheritance diagram for FxRequestSystemBuffer:
Collaboration diagram for FxRequestSystemBuffer:

Public Member Functions

 FxRequestSystemBuffer (VOID)
 
virtual _Must_inspect_result_ PVOID GetBuffer (VOID)
 
virtual size_t GetBufferSize (VOID)
 
virtual _Must_inspect_result_ PMDL GetMdl (VOID)
 
virtual WDFMEMORY GetHandle (VOID)
 
virtual USHORT GetFlags (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)
 
__inline BOOLEAN IsBufferSet (VOID)
 
__inline VOID ClearBufferMdl (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)
 

Public Attributes

friend FxRequest
 
PVOID m_Buffer
 
PMDL m_Mdl
 

Protected Member Functions

__inline VOID SetBuffer (PVOID Buffer)
 
__inline VOID SetMdl (PMDL Mdl)
 
FxRequestGetRequest (VOID)
 

Protected Attributes

union {
   PVOID   m_Buffer
 
   PMDL   m_Mdl
 
}; 
 

Additional Inherited Members

- 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 95 of file fxrequest.hpp.

Constructor & Destructor Documentation

◆ FxRequestSystemBuffer()

FxRequestSystemBuffer::FxRequestSystemBuffer ( VOID  )
inline

Definition at line 99 of file fxrequest.hpp.

102  {
103  m_Buffer = NULL;
104  }
#define NULL
Definition: types.h:112

Member Function Documentation

◆ AddRef()

ULONG FxRequestSystemBuffer::AddRef ( __in PVOID  Tag,
__in LONG  Line,
__in_opt PSTR  File 
)
virtual

Implements IFxMemory.

Definition at line 205 of file fxrequestsystembuffer.cpp.

228 {
232 
234 
235  //
236  // This value should never be used by the caller
237  //
238  return 2;
239 }
VOID AddIrpReference(VOID)
Definition: fxrequest.cpp:2470
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
Definition: File.h:15

◆ ClearBufferMdl()

__inline VOID FxRequestSystemBuffer::ClearBufferMdl ( VOID  )
inline

Definition at line 177 of file fxrequest.hpp.

180  {
181  m_Buffer = NULL;
182  m_Mdl = NULL;
183  }
#define NULL
Definition: types.h:112

Referenced by FxRequest::ClearFieldsForReuse().

◆ Delete()

VOID FxRequestSystemBuffer::Delete ( VOID  )
virtual

Implements IFxMemory.

Definition at line 296 of file fxrequestsystembuffer.cpp.

314 {
315  // this function should never be called
316  ASSERT(FALSE);
317 }
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44

◆ GetBuffer()

_Must_inspect_result_ PVOID FxRequestSystemBuffer::GetBuffer ( VOID  )
virtual

Implements IFxMemory.

Definition at line 38 of file fxrequestsystembufferkm.cpp.

53 {
55  FxIrp* irp = GetRequest()->GetFxIrp();
56  WDF_DEVICE_IO_TYPE ioType;
57 
58  switch (irp->GetMajorFunction()) {
61  return m_Buffer;
62 
63  case IRP_MJ_READ:
64  case IRP_MJ_WRITE:
66  ioType = pDevice->GetIoType();
67 
68  switch (ioType) {
70  return m_Buffer;
71 
72  case WdfDeviceIoDirect:
73  //
74  // FxRequest::GetMemoryObject has already called MmGetSystemAddressForMdlSafe
75  // and returned success, so we know that we can safely call
76  // MmGetSystemAddressForMdlSafe again to get a valid VA pointer.
77  //
79 
80  case WdfDeviceIoNeither:
81  return m_Buffer;
82 
83  default:
84  ASSERT(FALSE);
85  return NULL;
86  }
87 
88  default:
89  ASSERT(FALSE);
90  return NULL;
91  }
92 }
MdDeviceObject GetDeviceObject(VOID)
Definition: fxirpum.cpp:1352
__inline WDF_DEVICE_IO_TYPE GetIoType(VOID)
Definition: fxdevice.hpp:1084
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
static FxDevice * GetFxDevice(__in MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:60
Definition: fxirp.hpp:28
#define FALSE
Definition: types.h:117
FxDevice * pDevice
#define ASSERT(a)
Definition: mode.c:44
static __inline PVOID MxGetSystemAddressForMdlSafe(__inout PMDL Mdl, __in ULONG Priority)
Definition: mxgeneralkm.h:366
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
#define NULL
Definition: types.h:112
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
FxIrp * irp
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by FxRequest::CompleteInternal().

◆ GetBufferSize()

size_t FxRequestSystemBuffer::GetBufferSize ( VOID  )
virtual

Implements IFxMemory.

Definition at line 37 of file fxrequestsystembuffer.cpp.

52 {
53  FxIrp* irp = GetRequest()->GetFxIrp();
54 
55  switch (irp->GetMajorFunction()) {
56  case IRP_MJ_READ:
57  return irp->GetParameterReadLength();
58 
59  case IRP_MJ_WRITE:
60  return irp->GetParameterWriteLength();
61 
65 
66  default:
67  // should not get here
68  ASSERT(FALSE);
69  return 0;
70  }
71 }
ULONG GetParameterReadLength(VOID)
Definition: fxirpum.cpp:1589
Definition: fxirp.hpp:28
#define FALSE
Definition: types.h:117
ULONG GetParameterIoctlInputBufferLength(VOID)
Definition: fxirpum.cpp:1518
#define ASSERT(a)
Definition: mode.c:44
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
ULONG GetParameterWriteLength(VOID)
Definition: fxirpum.cpp:1601
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
FxIrp * irp
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by FxRequest::CompleteInternal().

◆ GetDriverGlobals()

PFX_DRIVER_GLOBALS FxRequestSystemBuffer::GetDriverGlobals ( VOID  )
virtual

Implements IFxMemory.

Definition at line 185 of file fxrequestsystembuffer.cpp.

200 {
201  return GetRequest()->GetDriverGlobals();
202 }
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734

◆ GetFlags()

USHORT FxRequestSystemBuffer::GetFlags ( VOID  )
virtual

Implements IFxMemory.

Definition at line 140 of file fxrequestsystembuffer.cpp.

156 {
157  FxIrp* irp = GetRequest()->GetFxIrp();
158 
159  switch (irp->GetMajorFunction()) {
163  case METHOD_BUFFERED:
164  case METHOD_NEITHER:
165  return 0;
166 
167  case METHOD_IN_DIRECT:
168  case METHOD_OUT_DIRECT:
169  return IFxMemoryFlagReadOnly;
170  }
171 
172  case IRP_MJ_READ:
173  return 0;
174 
175  case IRP_MJ_WRITE:
176  return IFxMemoryFlagReadOnly;
177 
178  default:
179  ASSERT(FALSE);
180  return 0;
181  }
182 }
Definition: fxirp.hpp:28
#define METHOD_IN_DIRECT
Definition: nt_native.h:595
#define METHOD_NEITHER
Definition: nt_native.h:597
#define FALSE
Definition: types.h:117
#define METHOD_OUT_DIRECT
Definition: nt_native.h:596
#define ASSERT(a)
Definition: mode.c:44
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
#define METHOD_BUFFERED
Definition: nt_native.h:594
ULONG GetParameterIoctlCodeBufferMethod(VOID)
Definition: fxirpum.cpp:1490
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
FxIrp * irp
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

◆ GetHandle()

WDFMEMORY FxRequestSystemBuffer::GetHandle ( VOID  )
virtual

Implements IFxMemory.

Definition at line 119 of file fxrequestsystembuffer.cpp.

134 {
135  return GetRequest()->GetMemoryHandle(
136  FIELD_OFFSET(FxRequest, m_SystemBufferOffset));
137 }
WDFMEMORY GetMemoryHandle(__in USHORT Offset)
Definition: fxrequest.hpp:658
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by FxRequest::CompleteInternal().

◆ GetMdl()

_Must_inspect_result_ PMDL FxRequestSystemBuffer::GetMdl ( VOID  )
virtual

Implements IFxMemory.

Definition at line 75 of file fxrequestsystembuffer.cpp.

90 {
92  FxIrp* irp = GetRequest()->GetFxIrp();
93 
94  switch (irp->GetMajorFunction()) {
95  case IRP_MJ_READ:
96  case IRP_MJ_WRITE:
98 
100  return m_Mdl;
101  }
102  // || || Fall through || ||
103  // \/ \/ \/ \/
104 
107  //
108  // For IOCLs, the outbuffer will return the PMDL
109  //
110  // || || Fall through || ||
111  // \/ \/ \/ \/
112 
113  default:
114  return NULL;
115  }
116 }
MdDeviceObject GetDeviceObject(VOID)
Definition: fxirpum.cpp:1352
__inline WDF_DEVICE_IO_TYPE GetIoType(VOID)
Definition: fxdevice.hpp:1084
static FxDevice * GetFxDevice(__in MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:60
Definition: fxirp.hpp:28
FxDevice * pDevice
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
FxIrp * GetFxIrp(VOID)
Definition: fxrequest.hpp:957
#define NULL
Definition: types.h:112
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
FxIrp * irp
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by FxRequest::CompleteInternal().

◆ GetRequest()

FxRequest * FxRequestSystemBuffer::GetRequest ( VOID  )
protected

Definition at line 276 of file fxrequestsystembuffer.cpp.

291 {
292  return CONTAINING_RECORD(this, FxRequest, m_SystemBuffer);
293 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by AddRef(), GetBuffer(), GetBufferSize(), GetDriverGlobals(), GetFlags(), GetHandle(), GetMdl(), and Release().

◆ IsBufferSet()

__inline BOOLEAN FxRequestSystemBuffer::IsBufferSet ( VOID  )
inline

Definition at line 168 of file fxrequest.hpp.

171  {
172  return m_Buffer != NULL ? TRUE : FALSE;
173  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

Referenced by FxRequest::AssignMemoryBuffers().

◆ Release()

ULONG FxRequestSystemBuffer::Release ( __in PVOID  Tag,
__in LONG  Line,
__in_opt PSTR  File 
)
virtual

Implements IFxMemory.

Definition at line 242 of file fxrequestsystembuffer.cpp.

265 {
269 
271 
272  return 1;
273 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: ncftp.h:79
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
VOID ReleaseIrpReference(VOID)
Definition: fxrequest.cpp:2512
Definition: File.h:15

◆ SetBuffer()

__inline VOID FxRequestSystemBuffer::SetBuffer ( PVOID  Buffer)
inlineprotected

Definition at line 188 of file fxrequest.hpp.

191  {
192  ASSERT(m_Buffer == NULL);
193  m_Buffer = Buffer;
194  }
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

Referenced by FxRequest::AssignMemoryBuffers().

◆ SetMdl()

__inline VOID FxRequestSystemBuffer::SetMdl ( PMDL  Mdl)
inlineprotected

Definition at line 198 of file fxrequest.hpp.

201  {
202  ASSERT(m_Mdl == NULL);
203  m_Mdl = Mdl;
204  }
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl

Referenced by FxRequest::GetMemoryObject().

Member Data Documentation

◆ @4551

union { ... }

◆ FxRequest

friend FxRequestSystemBuffer::FxRequest

Definition at line 96 of file fxrequest.hpp.

◆ m_Buffer

PVOID FxRequestSystemBuffer::m_Buffer

◆ m_Mdl

PMDL FxRequestSystemBuffer::m_Mdl

Definition at line 238 of file fxrequest.hpp.

Referenced by ClearBufferMdl(), GetBuffer(), GetMdl(), FxRequest::GetMemoryObject(), and SetMdl().


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