WdfDeviceInitSetReleaseHardwareOrderOnFailure - NtDoc

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

VOID WdfDeviceInitSetReleaseHardwareOrderOnFailure(
  [in] PWDFDEVICE_INIT                       DeviceInit,
  [in] WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdeviceinitsetreleasehardwareorderonfailure)

WdfDeviceInitSetReleaseHardwareOrderOnFailure function

Description

[Applies to KMDF and UMDF]

The WdfDeviceInitSetReleaseHardwareOrderOnFailure method specifies whether the framework calls the driver's EvtDeviceReleaseHardware callback function immediately after device failure, or waits until all child devices have been removed.

Parameters

DeviceInit [in]

A pointer to a WDFDEVICE_INIT structure.

ReleaseHardwareOrderOnFailure [in]

A WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE-typed enumerator that specifies when the framework calls the driver's EvtDeviceReleaseHardware callback function.

Remarks

Typically, the framework calls a driver's EvtDeviceReleaseHardware callback function after it has called the EvtDeviceReleaseHardware function for all child devices that the driver enumerates.

In the event of a device power-up or power-down failure, however, the framework might call the driver's EvtDeviceReleaseHardware before it has called the EvtDeviceReleaseHardware functions for all child devices.

To override this default behavior, a driver can call WdfDeviceInitSetReleaseHardwareOrderOnFailure to specify that, even in device failure scenarios, the framework should always wait to call its EvtDeviceReleaseHardware function until it has called the EvtDeviceReleaseHardware functions of the child devices.

For example, a bus driver that performs hardware access on behalf of its child devices could use this technique to ensure that its child devices do not request access to hardware after the framework has called the bus driver's EvtDeviceReleaseHardware callback function.

If a driver calls WdfDeviceInitSetReleaseHardwareOrderOnFailure, it must do so before it calls WdfDeviceCreate. For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

Examples

The following code example shows how a bus driver can request that the framework wait to call its EvtDeviceReleaseHardware callback function until all of its child devices have been removed.

WdfDeviceInitSetReleaseHardwareOrderOnFailure(
                       DeviceInit,
                       WdfReleaseHardwareOrderOnFailureAfterDescendants
                       );

See also

EvtDeviceReleaseHardware

WDFDEVICE_INIT

WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE