WdfDeviceStopIdleWithTag macro (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceStopIdleWithTag macro increments the power reference count for a specified framework device object and assigns the driver's current file name and line number to the reference. The macro also assigns a tag value to the reference.


NTSTATUS WdfDeviceStopIdleWithTag(
    _In_ WDFDEVICE Device,
    _In_ BOOLEAN WaitForD0,
    _In_ PVOID Tag



[in] A handle to a framework device object.


[in] A Boolean value that indicates when WdfDeviceStopIdleWithTag will return. If TRUE, it returns only after the specified device has entered the D0 device power state. If FALSE, the method returns immediately.


[in] A driver-defined value that the framework stores as an identification tag for the power reference.

Return value



If the operation succeeds, WdfDeviceStopIdleWithTag returns STATUS_SUCCESS.

Additional return values include:

Return code Description

The device is being powered up asynchronously.


The driver is not the power policy owner for the device.


A device failure occurred and the device cannot enter its D0 power state.

The method might return other NTSTATUS values.

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

If your driver calls WdfDeviceStopIdleWithTag to increment a reference count, the driver must call WdfDeviceResumeIdleWithTag to decrement the count.

Calling WdfDeviceStopIdleWithTag instead of WdfDeviceStopIdle provides additional information (tag value, line number, and file name) that you can view in Microsoft debuggers. WdfDeviceStopIdleWithTag 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.

Use !wdfkd.wdfdevice with verbose flags on and locate the link to !wdftagtracker in the output:

kd> !wdfdevice <handle> f 


Target Platform Universal
Minimum KMDF version 1.15
Minimum UMDF version 2.15
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL See Remarks section.
DDI compliance rules DriverCreate, KmdfIrql, KmdfIrql2

See also

Debugging Power Reference Leaks in WDF