Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ObReferenceObject routine

The ObReferenceObject routine increments the reference count to the given object.

Syntax


VOID ObReferenceObject(
  _In_  PVOID Object
);

Parameters

Object [in]

Pointer to the object. The caller obtained this parameter either when it created the object or from a preceding call to ObReferenceObjectByHandle after it opened the object.

Return value

ObReferenceObject returns a value that is reserved for system use. Drivers must treat this value as VOID.

Remarks

ObReferenceObject simply increments the pointer reference count for an object, without making any access checks on the given object, as ObReferenceObjectByHandle and ObReferenceObjectByPointer do.

ObReferenceObject prevents deletion of the object at least until the driver subsequently calls its reciprocal, ObDereferenceObject, or closes the given object. The caller must decrement the reference count with ObDereferenceObject as soon as it is done with the object.

When the reference count for an object reaches zero, a kernel-mode component can remove the object from the system. However, a driver can remove only those objects that it created, and a driver should never attempt to remove any object that it did not create.

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<=DISPATCH_LEVEL

DDI compliance rules

HwStorPortProhibitedDDIs

See also

ObReferenceObjectByHandle
ObReferenceObjectByPointer
ObDereferenceObject
ZwClose

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.