ReactOS 0.4.15-dev-7918-g2a2556c
fxhandle.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FxContextHeader
 

Macros

#define FX_CONTEXT_HEADER_SIZE   FIELD_OFFSET(FxContextHeader, Context)
 
#define COMPUTE_RAW_OBJECT_SIZE(_rawObjectSize)    ((USHORT) WDF_ALIGN_SIZE_UP(_rawObjectSize, MEMORY_ALLOCATION_ALIGNMENT))
 
#define COMPUTE_OBJECT_SIZE(_rawObjectSize, _extraSize)    (COMPUTE_RAW_OBJECT_SIZE(_rawObjectSize) + (USHORT) WDF_ALIGN_SIZE_UP(_extraSize, MEMORY_ALLOCATION_ALIGNMENT))
 

Functions

size_t FxGetContextSize (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize2 (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT RawObjectSize, __in USHORT ExtraSize, __in size_t ContextSize, __out size_t *Total)
 
_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT RawObjectSize, __in USHORT ExtraSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out size_t *Total)
 
PVOID FxObjectHandleAlloc (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType, __in size_t Size, __in ULONG Tag, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize, __in FxObjectType ObjectType)
 
VOID FxContextHeaderInit (__in FxContextHeader *Header, __in FxObject *Object, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
 
PVOID FxObjectAndHandleHeaderInit (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID AllocationStart, __in USHORT ObjectSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in FxObjectType ObjectType)
 
VOID __inline FxObjectHandleCreate (__in FxObject *Object, __out PWDFOBJECT Handle)
 
VOID FxObjectHandleGetPtrQI (__in FxObject *Object, __out PVOID *PPObject, __in WDFOBJECT Handle, __in WDFTYPE Type, __in WDFOBJECT_OFFSET Offset)
 
_Must_inspect_result_ NTSTATUS FxObjectAllocateContext (__in FxObject *Object, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in BOOLEAN AllowCallbacksOnly, __deref_opt_out PVOID *Context)
 
__inline BOOLEAN FxObjectCheckType (__in FxObject *Object, __in WDFTYPE Type)
 
__inline VOID FxObjectHandleGetPtr (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFOBJECT Handle, __in WDFTYPE Type, __out PVOID *PPObject)
 
__inline VOID FxObjectHandleGetPtrOffset (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFOBJECT Handle, __in WDFTYPE Type, __out PVOID *PPObject, __out PWDFOBJECT_OFFSET Offset)
 
VOID __inline FxObjectHandleGetPtrAndGlobals (__in PFX_DRIVER_GLOBALS CallersGlobals, __in WDFOBJECT Handle, __in WDFTYPE Type, __out PVOID *PPObject, __out PFX_DRIVER_GLOBALS *ObjectGlobals)
 
VOID __inline FxObjectHandleGetGlobals (__in PFX_DRIVER_GLOBALS CallersGlobals, __in WDFOBJECT Handle, __out PFX_DRIVER_GLOBALS *ObjectGlobals)
 

Macro Definition Documentation

◆ COMPUTE_OBJECT_SIZE

#define COMPUTE_OBJECT_SIZE (   _rawObjectSize,
  _extraSize 
)     (COMPUTE_RAW_OBJECT_SIZE(_rawObjectSize) + (USHORT) WDF_ALIGN_SIZE_UP(_extraSize, MEMORY_ALLOCATION_ALIGNMENT))

Definition at line 107 of file fxhandle.h.

◆ COMPUTE_RAW_OBJECT_SIZE

#define COMPUTE_RAW_OBJECT_SIZE (   _rawObjectSize)     ((USHORT) WDF_ALIGN_SIZE_UP(_rawObjectSize, MEMORY_ALLOCATION_ALIGNMENT))

Definition at line 100 of file fxhandle.h.

◆ FX_CONTEXT_HEADER_SIZE

#define FX_CONTEXT_HEADER_SIZE   FIELD_OFFSET(FxContextHeader, Context)

Definition at line 98 of file fxhandle.h.

Function Documentation

◆ FxCalculateObjectTotalSize()

_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in USHORT  RawObjectSize,
__in USHORT  ExtraSize,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__out size_t Total 
)

Definition at line 147 of file handleapi.cpp.

154{
155 return FxCalculateObjectTotalSize2(FxDriverGlobals,
156 RawObjectSize,
157 ExtraSize,
159 Total);
160}
size_t FxGetContextSize(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: handleapi.cpp:38
_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize2(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT RawObjectSize, __in USHORT ExtraSize, __in size_t ContextSize, __out size_t *Total)
Definition: handleapi.cpp:73
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes

Referenced by FxObjectAllocateContext(), FxObjectHandleAlloc(), FxLookasideList::InitializeLookaside(), and VfAllocateContext().

◆ FxCalculateObjectTotalSize2()

_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize2 ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in USHORT  RawObjectSize,
__in USHORT  ExtraSize,
__in size_t  ContextSize,
__out size_t Total 
)

Definition at line 73 of file handleapi.cpp.

97{
99
100 *Total = 0;
101
102 status = RtlSizeTAdd(
105 Total
106 );
107
108 if (NT_SUCCESS(status)) {
109 if (ContextSize != 0) {
110 size_t alignUp;
111
112 alignUp = ALIGN_UP(ContextSize, PVOID);
113
114 //
115 // overflow after aligning up to a pointer boundary;
116 //
117 if (alignUp < ContextSize) {
119 }
120
121 status = RtlSizeTAdd(*Total, alignUp, Total);
122 }
123 }
124
125 if (NT_SUCCESS(status) && FxDriverGlobals->IsObjectDebugOn()) {
126 //
127 // Attempt to add in the debug extension
128 //
129 status = RtlSizeTAdd(*Total,
131 Total);
132 }
133
134 if (!NT_SUCCESS(status)) {
136 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGOBJECT,
137 "Size overflow, object size 0x%x, extra object size 0x%x, "
138 "context size 0x%I64x, %!STATUS!",
139 RawObjectSize, ExtraSize, ContextSize, status);
140 }
141
142 return status;
143}
LONG NTSTATUS
Definition: precomp.h:26
#define TRACINGOBJECT
Definition: dbgtrace.h:59
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
#define FX_CONTEXT_HEADER_SIZE
Definition: fxhandle.h:98
#define COMPUTE_OBJECT_SIZE(_rawObjectSize, _extraSize)
Definition: fxhandle.h:107
@ FxObjectDebugExtensionSize
Definition: fxobject.hpp:226
NTSTATUS status
Definition: handleapi.cpp:537
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGHANDLE, "Attempting to get context type %s from WDFOBJECT 0x%p", pGivenName, Handle)
#define MEMORY_ALLOCATION_ALIGNMENT
Definition: ntbasedef.h:90
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define ALIGN_UP(size, type)
Definition: umtypes.h:91
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129

Referenced by FxCalculateObjectTotalSize(), and FxDevice::Initialize().

◆ FxContextHeaderInit()

VOID FxContextHeaderInit ( __in FxContextHeader Header,
__in FxObject Object,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes 
)

Definition at line 248 of file handleapi.cpp.

264{
266
267 Header->Object = Object;
268
269 if (Attributes != NULL) {
270 if (Attributes->ContextTypeInfo != NULL) {
271 size_t contextSize;
272
273 if (Attributes->ContextSizeOverride != 0) {
274 contextSize = Attributes->ContextSizeOverride;
275
276 }
277 else {
278 contextSize = Attributes->ContextTypeInfo->ContextSize;
279 }
280
281 //
282 // Zero initialize the entire context
283 //
284 RtlZeroMemory(&Header->Context[0], ALIGN_UP(contextSize, PVOID));
285 }
286
287 Header->ContextTypeInfo = Attributes->ContextTypeInfo;
288 }
289}
Definition: Header.h:9
return NULL
Definition: handleapi.cpp:653
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by FxObjectAllocateContext(), FxObjectAndHandleHeaderInit(), and VfAddContextToHandle().

◆ FxGetContextSize()

size_t FxGetContextSize ( __in_opt PWDF_OBJECT_ATTRIBUTES  Attributes)

Definition at line 38 of file handleapi.cpp.

54{
55 size_t contextSize = 0;
56
57 if (Attributes != NULL) {
58 if (Attributes->ContextTypeInfo != NULL) {
59 if (Attributes->ContextSizeOverride != 0) {
60 contextSize = Attributes->ContextSizeOverride;
61 }
62 else {
63 contextSize = Attributes->ContextTypeInfo->ContextSize;
64 }
65 }
66 }
67
68 return contextSize;
69}

Referenced by FxCalculateObjectTotalSize(), and FxDevice::Initialize().

◆ FxObjectAllocateContext()

_Must_inspect_result_ NTSTATUS FxObjectAllocateContext ( __in FxObject Object,
__in PWDF_OBJECT_ATTRIBUTES  Attributes,
__in BOOLEAN  AllowCallbacksOnly,
__deref_opt_out PVOID Context 
)

Definition at line 397 of file handleapi.cpp.

419{
423 size_t size;
424 BOOLEAN relRef;
425 ULONG flags;
426
427 fxDriverGlobals = Object->GetDriverGlobals();
428 header = NULL;
429 relRef = FALSE;
430
431 //
432 // Init validation flags.
433 //
437 }
438
439 //
440 // Basic validations.
441 //
443 if (!NT_SUCCESS(status)) {
444 goto Done;
445 }
446
447 //
448 // Check for context type!
449 //
450 if (Attributes->ContextTypeInfo == NULL && AllowCallbacksOnly == FALSE) {
454 "Attributes %p ContextTypeInfo is NULL, %!STATUS!",
456 goto Done;
457 }
458
459 Object->ADDREF(&status);
460 relRef = TRUE;
461
462 //
463 // By passing 0's for raw object size and extra size, we can compute the
464 // size of only the header and its contents.
465 //
467 if (!NT_SUCCESS(status)) {
468 goto Done;
469 }
470
472 FxPoolAllocate(fxDriverGlobals, NonPagedPool, size);
473
474 if (header == NULL) {
476 goto Done;
477 }
478
480
481 status = Object->AddContext(header, Context, Attributes);
482
483 //
484 // STATUS_OBJECT_NAME_EXISTS will not fail NT_SUCCESS, so check
485 // explicitly for STATUS_SUCCESS.
486 //
487 if (status != STATUS_SUCCESS) {
489 }
490
491Done:
492
493 if (relRef) {
494 Object->RELEASE(&status);
495 }
496
497 return status;
498}
unsigned char BOOLEAN
#define TRACINGHANDLE
Definition: dbgtrace.h:61
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NonPagedPool
Definition: env_spec_w32.h:307
PFX_DRIVER_GLOBALS fxDriverGlobals
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
@ FX_VALIDATE_OPTION_ATTRIBUTES_REQUIRED
@ FX_VALIDATE_OPTION_PARENT_NOT_ALLOWED
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
_Must_inspect_result_ NTSTATUS FxCalculateObjectTotalSize(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in USHORT RawObjectSize, __in USHORT ExtraSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out size_t *Total)
Definition: handleapi.cpp:147
VOID FxContextHeaderInit(__in FxContextHeader *Header, __in FxObject *Object, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: handleapi.cpp:248
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
Definition: globalskm.cpp:92
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by FxPkgGeneral::OnCreate(), and FxUsbInterface::UpdatePipeAttributes().

◆ FxObjectAndHandleHeaderInit()

PVOID FxObjectAndHandleHeaderInit ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in PVOID  AllocationStart,
__in USHORT  ObjectSize,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__in FxObjectType  ObjectType 
)

Definition at line 292 of file handleapi.cpp.

318{
320
321 if (FxDriverGlobals->IsObjectDebugOn()) {
322 FxObjectDebugExtension* pExtension;
323
324 pExtension = (FxObjectDebugExtension*) AllocationStart;
325
328
329 pObject = (FxObject*) &pExtension->AllocationStart[0];
330 }
331 else {
332 pObject = (FxObject*) AllocationStart;
333 }
334
338 pObject,
340 );
341 }
342
343 return pObject;
344}
@ FxObjectDebugExtensionSignature
Definition: fxobject.hpp:227
@ FxObjectTypeExternal
Definition: fxobject.hpp:120
FxObject * pObject
Definition: handleapi.cpp:605
ObjectType
Definition: metafile.c:81
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144

Referenced by FxDevice::AllocateRequestMemory(), FxObjectHandleAlloc(), FxMemoryBufferFromPoolLookaside::operator new(), and FxMemoryBufferFromLookaside::operator new().

◆ FxObjectCheckType()

__inline BOOLEAN FxObjectCheckType ( __in FxObject Object,
__in WDFTYPE  Type 
)

Definition at line 240 of file fxhandle.h.

257{
259 PVOID tmpObject;
260 FxQueryInterfaceParams params = {&tmpObject, Type, 0};
261
262 //
263 // Do a quick non virtual call for the type and only do the slow QI if
264 // the first types do not match
265 //
266
267 if (Object->GetType() == Type) {
268 return TRUE;
269 }
270
271 status = Object->QueryInterface(&params);
272
273 if (!NT_SUCCESS(status)) {
274 return FALSE;
275 }
276
277 return TRUE;
278
279}
Type
Definition: Type.h:7
GLenum const GLfloat * params
Definition: glext.h:5645

Referenced by FxUsbDevice::IsObjectDisposedOnRemove().

◆ FxObjectHandleAlloc()

PVOID FxObjectHandleAlloc ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in POOL_TYPE  PoolType,
__in size_t  Size,
__in ULONG  Tag,
__in_opt PWDF_OBJECT_ATTRIBUTES  Attributes,
__in USHORT  ExtraSize,
__in FxObjectType  ObjectType 
)

Definition at line 163 of file handleapi.cpp.

195{
196 PVOID blob;
197 size_t totalSize;
199
200 if (Tag == 0) {
201 Tag = FxDriverGlobals->Tag;
202 ASSERT(Tag != 0);
203 }
204
206 //
207 // An internal object might need the debug extension size added to it,
208 // but that's it. No extra size, no FxContextHeader.
209 //
210 if (FxDriverGlobals->IsObjectDebugOn()) {
211 status = RtlSizeTAdd(Size,
213 &totalSize);
214 }
215 else {
216 totalSize = Size;
218 }
219 }
220 else {
221 status = FxCalculateObjectTotalSize(FxDriverGlobals,
222 (USHORT) Size,
223 ExtraSize,
225 &totalSize);
226 }
227
228 if (!NT_SUCCESS(status)) {
229 return NULL;
230 }
231
232 blob = FxPoolAllocateWithTag(FxDriverGlobals, PoolType, totalSize, Tag);
233
234 if (blob != NULL) {
236 FxDriverGlobals,
237 blob,
238 COMPUTE_OBJECT_SIZE((USHORT) Size, ExtraSize),
241 );
242 }
243
244 return blob;
245}
@ FxObjectTypeInternal
Definition: fxobject.hpp:119
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
#define ASSERT(a)
Definition: mode.c:44
unsigned short USHORT
Definition: pedump.c:61
Definition: image.c:134
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

◆ FxObjectHandleCreate()

VOID __inline FxObjectHandleCreate ( __in FxObject Object,
__out PWDFOBJECT  Handle 
)

Definition at line 176 of file fxhandle.h.

180{
181#if FX_SUPER_DBG
182 if (Object->GetDriverGlobals()->FxVerifierHandle) {
183
184
185
186
187
188
189 ASSERT(Object->GetObjectSize() > 0);
190 ASSERT(Object == Object->GetContextHeader()->Object);
191 }
192#endif
193
194 ASSERT((((ULONG_PTR) Object) & FxHandleFlagMask) == 0x0);
195 *Handle = Object->GetObjectHandle();
196}
@ FxHandleFlagMask
Definition: fxobject.hpp:62
ULONG Handle
Definition: gdb_input.c:15
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by FxObject::Commit().

◆ FxObjectHandleGetGlobals()

VOID __inline FxObjectHandleGetGlobals ( __in PFX_DRIVER_GLOBALS  CallersGlobals,
__in WDFOBJECT  Handle,
__out PFX_DRIVER_GLOBALS ObjectGlobals 
)

Definition at line 453 of file fxhandle.h.

470{
472
473 FxObjectHandleGetPtrAndGlobals(CallersGlobals,
474 Handle,
476 &pObject,
477 ObjectGlobals);
478
480}
VOID __inline FxObjectHandleGetPtrAndGlobals(__in PFX_DRIVER_GLOBALS CallersGlobals, __in WDFOBJECT Handle, __in WDFTYPE Type, __out PVOID *PPObject, __out PFX_DRIVER_GLOBALS *ObjectGlobals)
Definition: fxhandle.h:414
FxObject * pObject
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

Referenced by if().

◆ FxObjectHandleGetPtr()

__inline VOID FxObjectHandleGetPtr ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFOBJECT  Handle,
__in WDFTYPE  Type,
__out PVOID PPObject 
)

Definition at line 283 of file fxhandle.h.

301{
304
305 if (Handle == NULL) {
306
307
308
309
310
311 FxVerifierBugCheck(FxDriverGlobals,
314 Type);
315
316 /* NOTREACHED */
317 return;
318 }
319
320 offset = 0;
322
323 //
324 // The only DDI you can call on an object which has a ref count of zero is
325 // WdfObjectGetTypedContextWorker().
326 //
327 ASSERT(pObject->GetRefCnt() > 0);
328
329 //
330 // Do a quick non virtual call for the type and only do the slow QI if
331 // the first types do not match
332 //
333 if (pObject->GetType() == Type) {
334 *PPObject = pObject;
335 ASSERT(offset == 0x0);
336 return;
337 }
338 else {
340 }
341}
static FxObject * _GetObjectFromHandle(__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
Definition: fxobject.hpp:613
WDFTYPE GetType(VOID)
Definition: fxobject.hpp:742
LONG GetRefCnt(VOID)
Definition: fxobject.hpp:758
#define NULL
Definition: types.h:112
VOID FxObjectHandleGetPtrQI(__in FxObject *Object, __out PVOID *PPObject, __in WDFOBJECT Handle, __in WDFTYPE Type, __in WDFOBJECT_OFFSET Offset)
Definition: handleapi.cpp:347
USHORT WDFOBJECT_OFFSET
Definition: fxobject.hpp:80
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
Definition: fxverifier.h:58
GLintptr offset
Definition: glext.h:5920
@ WDF_INVALID_HANDLE
Definition: wdfbugcodes.h:62

Referenced by FxObjectHandleGetPtrAndGlobals().

◆ FxObjectHandleGetPtrAndGlobals()

VOID __inline FxObjectHandleGetPtrAndGlobals ( __in PFX_DRIVER_GLOBALS  CallersGlobals,
__in WDFOBJECT  Handle,
__in WDFTYPE  Type,
__out PVOID PPObject,
__out PFX_DRIVER_GLOBALS ObjectGlobals 
)

Definition at line 414 of file fxhandle.h.

434{
435 //
436 // All FX_TYPEs except for IFX_TYPE_MEMORY derive from FxObject, so our cast
437 // below will work with all types but IFX_TYPE_MEMORY (in which case the caller
438 // should call FxObjectHandleGetPtr and then get the globals on their own
439 // from the IFxMemory interface).
440 //
442
443 FxObjectHandleGetPtr(CallersGlobals,
444 Handle,
445 Type,
446 PPObject);
447
448 *ObjectGlobals = ((FxObject*) (*PPObject))->GetDriverGlobals();
449}
__inline VOID FxObjectHandleGetPtr(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFOBJECT Handle, __in WDFTYPE Type, __out PVOID *PPObject)
Definition: fxhandle.h:283
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55

Referenced by FxObjectHandleGetGlobals().

◆ FxObjectHandleGetPtrOffset()

__inline VOID FxObjectHandleGetPtrOffset ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in WDFOBJECT  Handle,
__in WDFTYPE  Type,
__out PVOID PPObject,
__out PWDFOBJECT_OFFSET  Offset 
)

Definition at line 345 of file fxhandle.h.

371{
373
374 if (Handle == NULL) {
375
376
377
378
379
380 FxVerifierBugCheck(FxDriverGlobals,
383 Type);
384
385 /* NOTREACHED */
386 return;
387 }
388
389 *Offset = 0;
391
392 //
393 // The only DDI you can call on an object which has a ref count of zero is
394 // WdfObjectGetTypedContextWorker().
395 //
396 ASSERT(pObject->GetRefCnt() > 0);
397
398 //
399 // Do a quick non virtual call for the type and only do the slow QI if
400 // the first types do not match
401 //
402 if (pObject->GetType() == Type) {
403 *PPObject = pObject;
404 ASSERT(*Offset == 0x0);
405 return;
406 }
407 else {
409 }
410}
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101

◆ FxObjectHandleGetPtrQI()

VOID FxObjectHandleGetPtrQI ( __in FxObject Object,
__out PVOID PPObject,
__in WDFOBJECT  Handle,
__in WDFTYPE  Type,
__in WDFOBJECT_OFFSET  Offset 
)

Definition at line 347 of file handleapi.cpp.

370{
371 FxQueryInterfaceParams params = { PPObject, Type, Offset };
373
374 *PPObject = NULL;
375
376 status = Object->QueryInterface(&params);
377
378 if (!NT_SUCCESS(status)) {
380 Object->GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGDEVICE,
381 "Object Type Mismatch, Handle 0x%p, Type 0x%x, "
382 "Obj 0x%p, SB 0x%x",
383 Handle, Type, Object, Object->GetType());
384
385 FxVerifierBugCheck(Object->GetDriverGlobals(),
388 Type);
389
390 /* NOTREACHED */
391 return;
392 }
393}
#define TRACINGDEVICE
Definition: dbgtrace.h:58
_Must_inspect_result_ __in WDFOBJECT Handle
Definition: handleapi.cpp:512

Referenced by FxObjectHandleGetPtr(), and FxObjectHandleGetPtrOffset().