ObReferenceObjectByPointer function

The ObReferenceObjectByPointer routine increments the pointer reference count for a given object.

Syntax

NTSTATUS ObReferenceObjectByPointer(
  PVOID           Object,
  ACCESS_MASK     DesiredAccess,
  POBJECT_TYPE    ObjectType,
  KPROCESSOR_MODE AccessMode
);

Parameters

Object

Pointer to the object's body.

DesiredAccess

Specifies a mask representing the requested access to the object.

ObjectType

Pointer to the object type. ObjectType can be *ExEventObjectType, *ExSemaphoreObjectType, *IoFileObjectType, *PsProcessType, *PsThreadType, *SeTokenObjectType, *TmEnlistmentObjectType, *TmResourceManagerObjectType, *TmTransactionManagerObjectType, or *TmTransactionObjectType.

Note   The SeTokenObjectType object type is supported in Windows XP and later versions of Windows.
 
This parameter can also be NULL if AccessMode is KernelMode.

AccessMode

Indicates the access mode to use for the access check. It must be either UserMode or KernelMode. Lower-level drivers should specify KernelMode.

Return Value

ObReferenceObjectByPointer returns an NTSTATUS value. Possible return values include:

Remarks

Calling this routine prevents the object from being deleted, possibly by another component's call to ObDereferenceObject or ZwClose. The caller must decrement the reference count with ObDereferenceObject as soon as it is done with the object.

Requirements

   
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL
DDI compliance rules TargetRelationNeedsRef, HwStorPortProhibitedDDIs

See Also

ObDereferenceObject

ObReferenceObject

ObReferenceObjectByHandle

ZwClose