31#if defined(EVENT_TRACING)
32#include "HandleAPI.tmh"
55 size_t contextSize = 0;
63 contextSize =
Attributes->ContextTypeInfo->ContextSize;
121 status = RtlSizeTAdd(*Total, alignUp, Total);
129 status = RtlSizeTAdd(*Total,
137 "Size overflow, object size 0x%x, extra object size 0x%x, "
138 "context size 0x%I64x, %!STATUS!",
201 Tag = FxDriverGlobals->Tag;
210 if (FxDriverGlobals->IsObjectDebugOn()) {
232 blob = FxPoolAllocateWithTag(FxDriverGlobals,
PoolType, totalSize,
Tag);
274 contextSize =
Attributes->ContextSizeOverride;
278 contextSize =
Attributes->ContextTypeInfo->ContextSize;
321 if (FxDriverGlobals->IsObjectDebugOn()) {
381 "Object Type Mismatch, Handle 0x%p, Type 0x%x, "
454 "Attributes %p ContextTypeInfo is NULL, %!STATUS!",
559 "WDFHANDLE %p cannot have contexts added to it, %!STATUS!",
650 "Attempting to get context type %s from WDFOBJECT 0x%p",
690 #pragma prefast(push);
693 #pragma prefast(disable:__WARNING_BUFFER_UNDERFLOW, "No way to express that passed in ptr is at an offset");
698 #pragma prefast(pop);
static FxObject * _GetObjectFromHandle(__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
PVOID __inline GetObjectHandle(VOID)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__inline FxContextHeader * GetContextHeader(VOID)
#define NT_SUCCESS(StatCode)
#define __drv_maxIRQL(irql)
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
PFX_DRIVER_GLOBALS fxDriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
#define DDI_ENTRY_IMPERSONATION_OK()
#define FX_CONTEXT_HEADER_SIZE
#define COMPUTE_OBJECT_SIZE(_rawObjectSize, _extraSize)
#define FxPointerNotNull(FxDriverGlobals, Ptr)
@ FxObjectDebugExtensionSignature
@ FxObjectDebugExtensionSize
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
@ 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)
#define FxVerifierBugCheck(FxDriverGlobals, Error,...)
GLenum const GLfloat * params
PVOID FxObjectAndHandleHeaderInit(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID AllocationStart, __in USHORT ObjectSize, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in FxObjectType ObjectType)
_Must_inspect_result_ __in WDFOBJECT __in PWDF_OBJECT_ATTRIBUTES __deref_opt_out PVOID * Context
__in WDFOBJECT __in PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo
size_t FxGetContextSize(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
_Must_inspect_result_ NTSTATUS FxObjectAllocateContext(__in FxObject *Object, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in BOOLEAN AllowCallbacksOnly, __deref_opt_out PVOID *Context)
FxContextHeader * pHeader
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)
_Must_inspect_result_ __in WDFOBJECT __in PWDF_OBJECT_ATTRIBUTES Attributes
_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)
_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_ __in WDFOBJECT Handle
VOID FxObjectHandleGetPtrQI(__in FxObject *Object, __out PVOID *PPObject, __in WDFOBJECT Handle, __in WDFTYPE Type, __in WDFOBJECT_OFFSET Offset)
__in PVOID ContextPointer
VOID FxContextHeaderInit(__in FxContextHeader *Header, __in FxObject *Object, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
PFX_DRIVER_GLOBALS pFxDriverGlobals
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_WARNING, TRACINGHANDLE, "Attempting to get context type %s from WDFOBJECT 0x%p", pGivenName, Handle)
#define _Must_inspect_result_
#define MEMORY_ALLOCATION_ALIGNMENT
_In_ ULONG _In_ ULONG Offset
#define STATUS_OBJECT_PATH_INVALID
#define STATUS_INTEGER_OVERFLOW
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_ERROR
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_INSUFFICIENT_RESOURCES
#define ALIGN_UP(size, type)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
FORCEINLINE WDFOBJECT WdfObjectContextGetObject(_In_ PVOID ContextPointer)
FORCEINLINE PVOID WdfObjectGetTypedContextWorker(_In_ WDFOBJECT Handle, _In_ PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo)
FORCEINLINE NTSTATUS WdfObjectAllocateContext(_In_ WDFOBJECT Handle, _In_ PWDF_OBJECT_ATTRIBUTES ContextAttributes, _Outptr_opt_ PVOID *Context)