ReactOS 0.4.16-dev-401-g45b008d
FxRequestBuffer Struct Reference

#include <fxrequestbuffer.hpp>

Collaboration diagram for FxRequestBuffer:

Public Member Functions

 FxRequestBuffer (VOID)
 
NTSTATUS ValidateMemoryDescriptor (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_MEMORY_DESCRIPTOR Descriptor, __in ULONG Flags=0x0)
 
VOID SetMemory (__in IFxMemory *Memory, __in PWDFMEMORY_OFFSET Offsets)
 
VOID SetMdl (__in PMDL Mdl, __in ULONG Length)
 
__inline VOID SetBuffer (__in PVOID Buffer, __in ULONG Length)
 
__inline BOOLEAN HasMdl (VOID)
 
ULONG GetBufferLength (VOID)
 
_Must_inspect_result_ NTSTATUS GetBuffer (__deref_out PVOID *Buffer)
 
_Must_inspect_result_ NTSTATUS GetOrAllocateMdl (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __deref_out_opt PMDL *Mdl, __inout PMDL *MdlToFree, __inout PBOOLEAN UnlockWhenFreed, __in LOCK_OPERATION Operation, __in BOOLEAN ReuseMdl=FALSE, __inout_opt size_t *SizeOfMdl=NULL)
 
NTSTATUS GetOrAllocateMdlWorker (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __deref_out PMDL *Mdl, __in BOOLEAN *ReuseMdl, __in LONG Length, __in PVOID Buffer, __inout size_t *SizeOfMdl, __in BOOLEAN UnlockWhenFreed, __deref_out_opt PMDL *MdlToFree)
 
VOID AssignValues (__deref_out_opt PVOID *PPBuffer, __deref_out_opt PMDL *PPMdl, __out PULONG BufferLength)
 

Public Attributes

FxRequestBufferType DataType
 
union {
   struct {
      IFxMemory *   Memory
 
      PWDFMEMORY_OFFSET   Offsets
 
   }   Memory
 
   struct {
      PMDL   Mdl
 
      ULONG   Length
 
   }   Mdl
 
   struct {
      PVOID   Buffer
 
      ULONG   Length
 
   }   Buffer
 
   struct {
      IFxMemory *   Memory
 
      PWDFMEMORY_OFFSET   Offsets
 
      PMDL   Mdl
 
   }   RefMdl
 
u
 

Detailed Description

Definition at line 39 of file fxrequestbuffer.hpp.

Constructor & Destructor Documentation

◆ FxRequestBuffer()

FxRequestBuffer::FxRequestBuffer ( VOID  )

Definition at line 31 of file fxrequestbuffer.cpp.

34{
36 RtlZeroMemory(&u, sizeof(u));
37}
@ FxRequestBufferUnspecified
DataType
Definition: simd.h:252
union FxRequestBuffer::@4817 u
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Member Function Documentation

◆ AssignValues()

VOID FxRequestBuffer::AssignValues ( __deref_out_opt PVOID PPBuffer,
__deref_out_opt PMDL PPMdl,
__out PULONG  BufferLength 
)

Definition at line 273 of file fxrequestbuffer.cpp.

278{
280 PMDL pMdl;
281 size_t bufferSize;
282
283 //
284 // Make sure we have valid double pointers, make life simpler below
285 //
286 if (PPBuffer == NULL) {
287 PPBuffer = &pBuffer;
288 }
289 if (PPMdl == NULL) {
290 PPMdl = &pMdl;
291 }
292
293 switch (DataType) {
295 pBuffer = u.Memory.Memory->GetBuffer();
296 bufferSize = u.Memory.Memory->GetBufferSize();
297
298 if (u.Memory.Offsets != NULL) {
299 if (u.Memory.Offsets->BufferLength > 0) {
300 bufferSize = u.Memory.Offsets->BufferLength;
301 }
302 if (u.Memory.Offsets->BufferOffset > 0) {
303 pBuffer = WDF_PTR_ADD_OFFSET(pBuffer, u.Memory.Offsets->BufferOffset);
304 }
305 }
306
307 *PPBuffer = pBuffer;
309 break;
310
312 *PPMdl = u.Mdl.Mdl;
313 *PPBuffer = NULL;
314 *BufferLength = u.Mdl.Length;
315 break;
316
318 *PPMdl = NULL;
319 *PPBuffer = u.Buffer.Buffer;
320 *BufferLength = u.Buffer.Length;
321 break;
322
324 *PPMdl = u.RefMdl.Mdl;
325 *PPBuffer = NULL;
326 if (u.RefMdl.Offsets != NULL && u.RefMdl.Offsets->BufferLength > 0) {
327 *BufferLength = (ULONG) u.RefMdl.Offsets->BufferLength;
328 }
329 else {
330 *BufferLength = (ULONG) u.RefMdl.Memory->GetBufferSize();
331 }
332 break;
333
334 default:
335 *PPMdl = NULL;
336 *PPBuffer = NULL;
337 *BufferLength = 0;
338 break;
339 }
340}
#define NULL
Definition: types.h:112
@ FxRequestBufferMemory
@ FxRequestBufferBuffer
@ FxRequestBufferReferencedMdl
@ FxRequestBufferMdl
size_t bufferSize
PVOID pBuffer
uint32_t ULONG
Definition: typedefs.h:59
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771

◆ GetBuffer()

_Must_inspect_result_ NTSTATUS FxRequestBuffer::GetBuffer ( __deref_out PVOID Buffer)

Definition at line 221 of file fxrequestbuffer.cpp.

224{
225 switch (DataType) {
227 *Buffer = NULL;
228 return STATUS_SUCCESS;
229
231 if (u.Memory.Offsets != NULL) {
232 *Buffer = WDF_PTR_ADD_OFFSET(u.Memory.Memory->GetBuffer(),
233 u.Memory.Offsets->BufferOffset);
234 }
235 else {
236 *Buffer = u.Memory.Memory->GetBuffer();
237 }
238 return STATUS_SUCCESS;
239
241 *Buffer = u.Buffer.Buffer;
242 return STATUS_SUCCESS;
243
246 if (*Buffer != NULL) {
247 return STATUS_SUCCESS;
248 }
249 else {
251 }
252
255 if (*Buffer != NULL) {
256 if (u.RefMdl.Offsets != NULL) {
258 u.RefMdl.Offsets->BufferOffset);
259 }
260 return STATUS_SUCCESS;
261 }
262 else {
264 }
265
266 default:
268 }
269}
Definition: bufpool.h:45
static __inline PVOID MxGetSystemAddressForMdlSafe(__inout PMDL Mdl, __in ULONG Priority)
Definition: mxgeneralkm.h:366
@ NormalPagePriority
Definition: imports.h:54
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

◆ GetBufferLength()

ULONG FxRequestBuffer::GetBufferLength ( VOID  )

Definition at line 158 of file fxrequestbuffer.cpp.

161{
162 switch (DataType) {
164 //
165 // If the BufferLength and BufferOffset is zero, then the transfer length is same
166 // as the length of the request.
167 //
168 if (u.Memory.Offsets == NULL ||
169 (u.Memory.Offsets->BufferOffset == 0 && u.Memory.Offsets->BufferLength == 0)) {
170 return (ULONG) u.Memory.Memory->GetBufferSize();
171 }
172 else {
173 //
174 // If the BufferLength value is zero then the transfer length is request length
175 // minus the offset value.
176 //
177 if (u.Memory.Offsets->BufferLength == 0) {
178 return ((ULONG) u.RefMdl.Memory->GetBufferSize() - (ULONG) u.RefMdl.Offsets->BufferOffset);
179 }
180 else {
181 return (ULONG) u.Memory.Offsets->BufferLength;
182 }
183 }
184 break;
185
187 return u.Mdl.Length;
188
190 //
191 // If the BufferLength and BufferOffset is zero, then the transfer length is same
192 // as the length of the request.
193 //
194 if (u.RefMdl.Offsets == NULL ||
195 (u.RefMdl.Offsets->BufferOffset == 0 && u.RefMdl.Offsets->BufferLength == 0)) {
196 return (ULONG) u.RefMdl.Memory->GetBufferSize();
197 }
198 else {
199 //
200 // If the BufferLength value is zero then the transfer length is request length
201 // minus the offset value.
202 //
203 if (u.RefMdl.Offsets->BufferLength == 0) {
204 return ((ULONG) u.RefMdl.Memory->GetBufferSize() - (ULONG) u.RefMdl.Offsets->BufferOffset);
205 }
206 else {
207 return (ULONG) u.RefMdl.Offsets->BufferLength;
208 }
209 }
210
212 return u.Buffer.Length;
213
214 default:
215 return 0;
216 }
217}

Referenced by GetOrAllocateMdl().

◆ GetOrAllocateMdl()

_Must_inspect_result_ NTSTATUS FxRequestBuffer::GetOrAllocateMdl ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__deref_out_opt PMDL Mdl,
__inout PMDL MdlToFree,
__inout PBOOLEAN  UnlockWhenFreed,
__in LOCK_OPERATION  Operation,
__in BOOLEAN  ReuseMdl = FALSE,
__inout_opt size_t SizeOfMdl = NULL 
)

Definition at line 33 of file fxrequestbufferkm.cpp.

80{
81 PVOID pBuf;
84 BOOLEAN oldUnlockValue;
85
86 pBuf = NULL;
87
88 oldUnlockValue = *UnlockWhenFreed;
89
90 //
91 // Format functions that use this helper call
92 // FxRequestBase::ValidateTarget which calls ContextReleaseAndRestore
93 // which unlocks any locked pages.
94 //
95 // Hence pages must already be unlocked now. Let's assert that.
96 //
97 // This condition needs to be true since we unconditionally set
98 // *UnlockWhenFreed to FALSE just below.
99 //
100 ASSERT (oldUnlockValue == FALSE);
101
102 *UnlockWhenFreed = FALSE;
103
104 //
105 // Even if ReuseMdl is not true, SizeOfMdl may be supplied to store
106 // the size of allocated MDL to be used later
107 //
108 ASSERT(ReuseMdl ? (SizeOfMdl != NULL && *MdlToFree != NULL) : TRUE);
109
110 switch (DataType) {
112 *Mdl = NULL;
113 //
114 // We should not set *MdlToFree to NULL as *MdlToFree might have a valid
115 // MDL which we should not overwrite with NULL without freeing it
116 //
117 return STATUS_SUCCESS;
118
120 if (u.Memory.Offsets != NULL) {
121 pBuf = WDF_PTR_ADD_OFFSET(u.Memory.Memory->GetBuffer(),
122 u.Memory.Offsets->BufferOffset);
123 }
124 else {
125 pBuf = u.Memory.Memory->GetBuffer();
126 }
127 // || ||
128 // \/ \/ fall through
129
131 if (pBuf == NULL) {
132 pBuf = u.Buffer.Buffer;
133 }
134
136 status = GetOrAllocateMdlWorker(FxDriverGlobals,
137 Mdl,
138 &ReuseMdl,
139 length,
140 pBuf,
141 SizeOfMdl,
142 oldUnlockValue,
143 MdlToFree
144 );
145 if (!NT_SUCCESS(status)) {
147 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
148 "Couldn't allocate memory for MDL of length 0x%x %!STATUS!", length, status);
149 return status;
150 }
151
152 //
153 // If we are reusing the MDL we need to initialize it with current
154 // buffer.
155 //
156 if (ReuseMdl == TRUE) {
158 }
159
161
162 if (!NT_SUCCESS(status)) {
164 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
165 "Couldn't lock pages for MDL 0x%p %!STATUS!", *Mdl, status);
166
167 //
168 // Free MDL only if it was not reused.
169 //
170 if (ReuseMdl == FALSE) {
171 FxMdlFree(FxDriverGlobals, *Mdl);
172 }
173
174 *Mdl = NULL;
175 return status;
176 }
177
178 *UnlockWhenFreed = TRUE;
179 *MdlToFree = *Mdl;
180
181 return STATUS_SUCCESS;
182
184 *Mdl = u.Mdl.Mdl;
185 //
186 // We should not set *MdlToFree to NULL as *MdlToFree might have a valid
187 // MDL which we should not overwrite with NULL without freeing it
188 //
189 return STATUS_SUCCESS;
190
192 if (u.RefMdl.Offsets == NULL ||
193 (u.RefMdl.Offsets->BufferOffset == 0 && u.RefMdl.Offsets->BufferLength == 0)) {
194 *Mdl = u.RefMdl.Mdl;
195 //
196 // We should not set *MdlToFree to NULL as *MdlToFree might have a valid
197 // MDL which we should not overwrite with NULL without freeing it
198 //
199 }
200 else {
201 //
202 // Do not use MmGetSystemAddressForMdlSafe because StartVa could be
203 // in UM while MappedVa (obviously) is in KM. Since
204 // IoBuildPartial Mdl basically uses
205 // pBuf - MmGetMdlVirtualAddress(SrcMdl) to compute offset, if one
206 // VA is in UM (e.g. MmGetMdlVirtualAddress(SrcMdl)), you get the
207 // (drastically) wrong offset.
208 //
209 pBuf = Mx::MxGetMdlVirtualAddress(u.RefMdl.Mdl);
210 ASSERT(pBuf != NULL);
211
212 pBuf = WDF_PTR_ADD_OFFSET(pBuf, u.RefMdl.Offsets->BufferOffset);
213
214 //
215 // GetBufferLength will compute the correct length with the given offsets
216 //
218 status = GetOrAllocateMdlWorker(FxDriverGlobals,
219 Mdl,
220 &ReuseMdl,
221 length,
222 pBuf,
223 SizeOfMdl,
224 oldUnlockValue,
225 MdlToFree
226 );
227 if (!NT_SUCCESS(status)) {
229 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
230 "Couldn't allocate memory for MDL of length 0x%x %!STATUS!", length, status);
231 return status;
232 }
233
235 u.RefMdl.Mdl,
236 *Mdl,
237 pBuf,
238 length
239 );
240
241 *MdlToFree = *Mdl;
242 }
243
244 return STATUS_SUCCESS;
245
246 default:
247 *Mdl = NULL;
248 //
249 // We should not set *MdlToFree to NULL as *MdlToFree might have a valid
250 // MDL which we should not overwrite with NULL without freeing it
251 //
253 }
254}
static ULONG SizeOfMdl(VOID)
Definition: NtReadFile.c:36
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
static __inline VOID MxBuildPartialMdl(_In_ PMDL SourceMdl, _Inout_ PMDL TargetMdl, _In_ PVOID VirtualAddress, _In_ ULONG Length)
Definition: mxgeneralkm.h:663
static __inline PVOID MxGetMdlVirtualAddress(_In_ PMDL Mdl)
Definition: mxgeneralkm.h:654
static __inline VOID MxInitializeMdl(_In_ PMDL MemoryDescriptorList, _In_ PVOID BaseVa, _In_ SIZE_T Length)
Definition: mxgeneralkm.h:643
#define TRACINGAPIERROR
Definition: dbgtrace.h:60
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
FP_OP Operation
Definition: fpcontrol.c:150
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
VOID __inline FxMdlFree(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PMDL Mdl)
Definition: fxmdl.h:60
NTSTATUS FxProbeAndLockWithAccess(__in PMDL Mdl, __in KPROCESSOR_MODE AccessMode, __in LOCK_OPERATION Operation)
Definition: probeandlock.c:74
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define ASSERT(a)
Definition: mode.c:44
#define KernelMode
Definition: asm.h:38
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
ULONG GetBufferLength(VOID)
NTSTATUS GetOrAllocateMdlWorker(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __deref_out PMDL *Mdl, __in BOOLEAN *ReuseMdl, __in LONG Length, __in PVOID Buffer, __inout size_t *SizeOfMdl, __in BOOLEAN UnlockWhenFreed, __deref_out_opt PMDL *MdlToFree)
Definition: ps.c:97
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl

◆ GetOrAllocateMdlWorker()

__inline NTSTATUS FxRequestBuffer::GetOrAllocateMdlWorker ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__deref_out PMDL Mdl,
__in BOOLEAN ReuseMdl,
__in LONG  Length,
__in PVOID  Buffer,
__inout size_t SizeOfMdl,
__in BOOLEAN  UnlockWhenFreed,
__deref_out_opt PMDL MdlToFree 
)

Definition at line 42 of file fxrequestbufferkm.hpp.

52{
53 size_t sizeofCurrentMdl;
54 sizeofCurrentMdl = MmSizeOfMdl(Buffer, Length);
55
56 //
57 // Caller of this function (GetOrAllocateMdl) verifies that pages
58 // are already unlocked. Asserting here, in case we start using this
59 // function elsewhere.
60 //
61 // This is why we don't unlock pages either in reuse or non-reuse case.
62 //
63 ASSERT(UnlockWhenFreed == FALSE);
64 UNREFERENCED_PARAMETER(UnlockWhenFreed); //for fre build
65
66 //
67 // If ReuseMdl is TRUE then the Mdl to be reused is passed in.
68 //
69 if (*ReuseMdl && sizeofCurrentMdl <= *SizeOfMdl) {
70 MmPrepareMdlForReuse(*MdlToFree);
71 *Mdl = *MdlToFree;
72 }
73 else {
74 *ReuseMdl = FALSE;
75
76 //
77 // Since *Mdl may have the original IRP Mdl
78 // free *MdlToFree and not *Mdl
79 //
80 if (*MdlToFree != NULL) {
81 FxMdlFree(FxDriverGlobals, *MdlToFree);
82 *MdlToFree = NULL;
83 if (SizeOfMdl != NULL) {
84 *SizeOfMdl = 0;
85 }
86 }
87
88 *Mdl = FxMdlAllocate(FxDriverGlobals,
89 NULL, // owning FxObject
90 Buffer,
91 Length,
92 FALSE,
93 FALSE);
94
95 if (*Mdl == NULL) {
96
97 ASSERT(SizeOfMdl ? (*SizeOfMdl == 0) : TRUE);
98
100 }
101
102 if (SizeOfMdl != NULL) {
103 *SizeOfMdl = sizeofCurrentMdl;
104 }
105 }
106
107 return STATUS_SUCCESS;
108}
PMDL FORCEINLINE FxMdlAllocate(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Owner, __in PVOID VirtualAddress, __in ULONG Length, __in BOOLEAN SecondaryBuffer, __in BOOLEAN ChargeQuota)
Definition: fxmdl.h:31
SIZE_T NTAPI MmSizeOfMdl(IN PVOID Base, IN SIZE_T Length)
Definition: mdlsup.c:409
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define MmPrepareMdlForReuse(_Mdl)

Referenced by GetOrAllocateMdl().

◆ HasMdl()

__inline BOOLEAN FxRequestBuffer::HasMdl ( VOID  )
inline

Definition at line 76 of file fxrequestbuffer.hpp.

◆ SetBuffer()

__inline VOID FxRequestBuffer::SetBuffer ( __in PVOID  Buffer,
__in ULONG  Length 
)
inline

Definition at line 64 of file fxrequestbuffer.hpp.

68 {
70 u.Buffer.Buffer = Buffer;
71 u.Buffer.Length = Length;
72 }

Referenced by ValidateMemoryDescriptor().

◆ SetMdl()

__inline VOID FxRequestBuffer::SetMdl ( __in PMDL  Mdl,
__in ULONG  Length 
)

Definition at line 30 of file fxrequestbufferkm.hpp.

34{
36 u.Mdl.Mdl = Mdl;
37 u.Mdl.Length = Length;
38}

Referenced by ValidateMemoryDescriptor().

◆ SetMemory()

VOID FxRequestBuffer::SetMemory ( __in IFxMemory Memory,
__in PWDFMEMORY_OFFSET  Offsets 
)

Definition at line 257 of file fxrequestbufferkm.cpp.

261{
262 PMDL pMdl;
263
264 pMdl = Memory->GetMdl();
265 if (pMdl != NULL) {
267 u.RefMdl.Memory = Memory;
268 u.RefMdl.Offsets = Offsets;
269 u.RefMdl.Mdl = pMdl;
270 }
271 else {
273 u.Memory.Memory = Memory;
274 u.Memory.Offsets = Offsets;
275 }
276}
PWDFMEMORY_OFFSET Offsets
_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 FxIoTargetFormatIo(), FxIoTargetFormatIoctl(), and ValidateMemoryDescriptor().

◆ ValidateMemoryDescriptor()

NTSTATUS FxRequestBuffer::ValidateMemoryDescriptor ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PWDF_MEMORY_DESCRIPTOR  Descriptor,
__in ULONG  Flags = 0x0 
)

Definition at line 40 of file fxrequestbuffer.cpp.

45{
48
49 if (Descriptor == NULL) {
51 return STATUS_SUCCESS;
52 }
53 else {
55 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
56 "A NULL Descriptor is not allowed");
57
59 }
60 }
61
62 //
63 // For each type, check to see if the buffer is non NULL and err out if the
64 // calller considers this an error. If the buffer is NULL, but a length
65 // was specified, this is considered an error.
66 //
67 switch (Descriptor->Type) {
69 if (Descriptor->u.BufferType.Buffer == NULL) {
72 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
73 "A NULL Buffer is not allowed");
74
76 }
77 else if (Descriptor->u.BufferType.Length != 0) {
79 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
80 "Buffer is NULL, but a length (0x%x) is specified",
81 Descriptor->u.BufferType.Length);
82
84 }
85 }
86
87 SetBuffer(Descriptor->u.BufferType.Buffer,
88 Descriptor->u.BufferType.Length);
89
91 break;
92
94 if (Descriptor->u.MdlType.Mdl == NULL) {
97 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
98 "A NULL MDL is not allowed");
99
101 }
102 else if (Descriptor->u.MdlType.BufferLength != 0) {
104 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
105 "MDL is NULL, but a length (0x%x) is specified",
106 Descriptor->u.MdlType.BufferLength);
107
109 }
110 }
111
112 SetMdl(Descriptor->u.MdlType.Mdl, Descriptor->u.MdlType.BufferLength);
114 break;
115
117 pMemory = NULL;
118 if (Descriptor->u.HandleType.Memory == NULL) {
121 }
122 else {
124 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
125 "A NULL WDFMEMORY handle is not allowed");
126
128 }
129 }
130 else {
131 FxObjectHandleGetPtr(FxDriverGlobals,
132 Descriptor->u.HandleType.Memory,
134 (PVOID*) &pMemory);
135
137 Descriptor->u.HandleType.Offsets);
138 if (!NT_SUCCESS(status)) {
140 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGAPIERROR,
141 "Memory offset values are not valid %!STATUS!", status);
142 }
143 }
144
145 if (NT_SUCCESS(status) && pMemory != NULL) {
146 SetMemory(pMemory, Descriptor->u.HandleType.Offsets);
147 }
148 break;
149
150 default:
152 }
153
154 return status;
155}
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
FxMemoryObject * pMemory
@ MemoryDescriptorNullAllowed
@ MemoryDescriptorNoBufferAllowed
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55
VOID SetMemory(__in IFxMemory *Memory, __in PWDFMEMORY_OFFSET Offsets)
VOID SetMdl(__in PMDL Mdl, __in ULONG Length)
__inline VOID SetBuffer(__in PVOID Buffer, __in ULONG Length)
@ WdfMemoryDescriptorTypeBuffer
Definition: wdfmemory.h:54
@ WdfMemoryDescriptorTypeHandle
Definition: wdfmemory.h:56
@ WdfMemoryDescriptorTypeMdl
Definition: wdfmemory.h:55
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by FxIoTargetSendIo(), and FxIoTargetSendIoctl().

Member Data Documentation

◆ Buffer [1/2]

PVOID FxRequestBuffer::Buffer

Definition at line 139 of file fxrequestbuffer.hpp.

Referenced by SetBuffer().

◆  [2/2]

struct { ... } FxRequestBuffer::Buffer

◆ DataType

FxRequestBufferType FxRequestBuffer::DataType

Definition at line 127 of file fxrequestbuffer.hpp.

◆ Length

ULONG FxRequestBuffer::Length

Definition at line 136 of file fxrequestbuffer.hpp.

Referenced by SetBuffer(), and SetMdl().

◆ Mdl [1/2]

PMDL FxRequestBuffer::Mdl

Definition at line 135 of file fxrequestbuffer.hpp.

Referenced by GetOrAllocateMdl(), and SetMdl().

◆  [2/2]

struct { ... } FxRequestBuffer::Mdl

◆ Memory [1/2]

IFxMemory* FxRequestBuffer::Memory

Definition at line 131 of file fxrequestbuffer.hpp.

Referenced by SetMemory().

◆  [2/2]

struct { ... } FxRequestBuffer::Memory

◆ Offsets

PWDFMEMORY_OFFSET FxRequestBuffer::Offsets

Definition at line 132 of file fxrequestbuffer.hpp.

Referenced by SetMemory().

◆ 

struct { ... } FxRequestBuffer::RefMdl

◆ 


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