IPnpCallbackHardware2::OnReleaseHardware method (wudfddi.h)

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

The OnReleaseHardware method performs operations that are needed when a device is no longer accessible.

Syntax

HRESULT OnReleaseHardware(
  [in] IWDFDevice3        *pWdfDevice,
  [in] IWDFCmResourceList *pWdfResourcesTranslated
);

Parameters

[in] pWdfDevice

A pointer to the IWDFDevice3 interface for the framework device object.

[in] pWdfResourcesTranslated

A pointer to the IWDFCmResourceList interface for the framework resource-list object that identifies the translated hardware resources that the Plug and Play manager has assigned to the device.

Return value

OnReleaseHardware returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h. Do not return HRESULT_FROM_NT(STATUS_NOT_SUPPORTED).

Remarks

A driver registers the IPnpCallbackHardware2 interface when the driver calls the IWDFDriver::CreateDevice method to create a device object.

The OnReleaseHardware method must free resources that were allocated during the call to the driver's IPnpCallbackHardware2::OnPrepareHardware method, regardless of whether OnPrepareHardware succeeded or failed. As such, OnReleaseHardware must be able to handle the cleanup of partial resources.

For information about deleting an interrupt object, see Deleting an Interrupt Object.

For information about parsing hardware resources, see Finding and Mapping Hardware Resources in a UMDF Driver.

Examples

See example code in IWDFDevice3::MapIoSpace.

Requirements

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.11
Header wudfddi.h

See also

IPnpCallbackHardware2

OnPrepareHardware