WdfObjectReferenceActual - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfobject.h

VOID WdfObjectReferenceActual(
  [in]           WDFOBJECT Handle,
  [in, optional] PVOID     Tag,
  [in]           LONG      Line,
  [in]           PCCH      File
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfobject-wdfobjectreferenceactual)

WdfObjectReferenceActual function

Description

[Applies to KMDF and UMDF]

The WdfObjectReferenceActual method increments the reference count for a specified framework object and assigns a tag value, line number, and file name to the reference.

Parameters

Handle [in]

A handle to a framework object.

Tag [in, optional]

A driver-defined value that the framework stores as an identification tag for the object reference.

Line [in]

A numeric value that represents a line number in a driver source file.

File [in]

A pointer to a null-terminated constant character string that represents the name of a driver source file. This parameter is optional and can be NULL.

Remarks

A bug check occurs if the driver supplies an invalid object handle.

If your driver calls WdfObjectReferenceActual to increment a reference count, the driver must call WdfObjectDereferenceActual to decrement the count.

Calling WdfObjectReferenceActual or WdfObjectReferenceWithTag instead of WdfObjectReference provides additional information (tag value, line number, and file name) to Microsoft debuggers. WdfObjectReferenceActual allows your driver to specify the line number and file name, while WdfObjectReferenceWithTag uses the driver's current line number and file name.

You can view the tag, line number, and file name values by using the !wdftagtracker debugger extension. The debugger extension displays the tag value as both a pointer and a series of characters. For more about debugger extensions, see Debugging a KMDF Driver.

For more information about object reference counts, see Framework Object Life Cycle.

For more information about the cleanup rules for a framework object hierarchy, see Framework Object Life Cycle.

Examples

The following code example increments an object's reference count and assigns a tag value, line number, and file name to the reference.

WdfObjectReferenceActual(
                         object,
                         pTag,
                         line,
                         FILE_NAME
                         );

See also

WdfObjectReference