Bewerken

Delen via


IPnpCallbackHardware::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 notifies a driver to perform operations that are necessary when the specified hardware is no longer accessible.

Syntax

HRESULT OnReleaseHardware(
  [in] IWDFDevice *pWdfDevice
);

Parameters

[in] pWdfDevice

A pointer to the IWDFDevice interface for the device object of the device that is no longer accessible.

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

This method must use the HRESULT_FROM_NT macro to return a specific HRESULT value to return status to a kernel-mode client. For more information, see Supporting Kernel-mode Clients.

Remarks

A driver registers the IPnpCallbackHardware 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 IPnpCallbackHardware::OnPrepareHardware method whether OnPrepareHardware succeeded or failed. Therefore, OnReleaseHardware must be able to handle the cleanup of partial resources.

For more information, see Finding and Mapping Hardware Resources in a UMDF Driver.

Requirements

Requirement Value
Target Platform Windows
Header wudfddi.h (include Wudfddi.h)

See also

IPnpCallbackHardware

IPnpCallbackHardware2::OnReleaseHardware

IPnpCallbackHardware::OnPrepareHardware

IWDFDevice

IWDFDriver::CreateDevice