Expand Minimize

WdfDeviceInitSetReleaseHardwareOrderOnFailure method

[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.

Syntax


void WdfDeviceInitSetReleaseHardwareOrderOnFailure(
  [in]  PWDFDEVICE_INIT DeviceInit,
  [in]  WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE ReleaseHardwareOrderOnFailure
);

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.

Return value

This method does not return a value.

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
                       );

Requirements

Minimum KMDF version

1.11

Minimum UMDF version

2.0

Header

Wdfdevice.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

DriverCreate

See also

EvtDeviceReleaseHardware
WDFDEVICE_INIT
WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft