IPnpCallbackHardware::OnPrepareHardware method

[Applies to UMDF 1.x only]

The OnPrepareHardware method notifies a driver to make the specified hardware accessible.

Syntax


HRESULT OnPrepareHardware(
  [in]  IWDFDevice *pWdfDevice
);

Parameters

pWdfDevice [in]

A pointer to the IWDFDevice interface for the device object of the device to make accessible.

Return value

OnPrepareHardware returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes 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 IPnpCallbackHardware::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, it must be able to handle the cleanup of partial resources.

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 it calls the IWDFDriver::CreateDevice method to create a device object.

Receiving a call to the OnPrepareHardware method is equivalent to a Microsoft Windows Driver Model (WDM) driver receiving an IRP_MN_START_DEVICE IRP.

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

Requirements

Header

Wudfddi.h (include Wudfddi.h)

See also

IPnpCallbackHardware
IPnpCallbackHardware::OnReleaseHardware
IPnpCallbackHardware2::OnPrepareHardware
IRP_MN_START_DEVICE
IWDFDevice
IWDFDriver::CreateDevice

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.