NTSTATUS
ObReferenceObjectByPointer(
IN PVOID Object,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_TYPE ObjectType,
IN KPROCESSOR_MODE AccessMode
);
ObReferenceObjectByPointer increments the pointer reference count for a given object.
ObReferenceObjectByPointer can return one of the following status codes:
STATUS_SUCCESS
STATUS_OBJECT_TYPE_MISMATCH
Calling this routine prevents the object from being deleted, possibly by another component’s call to ObDereferenceObject or ZwClose.
Callers of this function must be running at IRQL PASSIVE_LEVEL.