IPnpCallbackHardware2::OnPrepareHardware 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 OnPrepareHardware method performs any operations that are needed to make a device accessible to the driver.

Syntax

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

Parameters

[in] pWdfDevice

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

[in] pWdfResourcesRaw

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

[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

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

If OnPrepareHardware returns an error code, the framework will still call the IPnpCallbackHardware2::OnReleaseHardware method. The OnReleaseHardware method can then free resources that were allocated during the call to OnPrepareHardware. Because OnReleaseHardware must free resources for both success and failure cases of OnPrepareHardware, OnReleaseHardware must be able to handle the cleanup of partial resources.

Remarks

The IPnpCallbackHardware2::OnPrepareHardware method differs from the IPnpCallbackHardware::OnPrepareHardware method in that it receives raw and translated resources.

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

OnReleaseHardware