WdfDeviceInitSetReleaseHardwareOrderOnFailure function (wdfdevice.h)
[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.
void WdfDeviceInitSetReleaseHardwareOrderOnFailure( PWDFDEVICE_INIT DeviceInit, WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure );
[in] A pointer to a WDFDEVICE_INIT structure.
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.
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 );
|Minimum KMDF version||1.11|
|Minimum UMDF version||2.0|
|Header||wdfdevice.h (include Wdf.h)|
|Library||Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)|
|DDI compliance rules||DriverCreate|