Table of contents
Collapse the table of content
Expand the table of content

Handling Plug and Play and Power Management Events

Last Updated: 1/24/2017

When a Plug and Play (PnP) or Power Management (PM) event occurs, the user-mode driver framework (UMDF) calls one or more methods in the CDevice class to handle the event. (The CDevice class is defined in the file Device.cpp.) The event handlers are found in three interfaces: IPnpCallback, IPnpCallbackHardware, and IPnpCallbackSelfManagedIo.

In the WpdHelloWorldDriver sample, most of the PnP and PM event handlers either return no value or S_OK. There are two exceptions: IPnpCallbackHardware::OnPrepareHardwareand IPnPCallbackHardware::OnReleaseHardware. The following table describes each method.

IPnpCallbackHardware::OnPrepareHardwareCalls the WpdBaseDriver::Initialize method. Initializes the WPD class extension and updates the device-friendly name.
IPnPCallbackHardware::OnReleaseHardwareCalls the WpdBaseDriver::Uninitialize method and uninitializes the WPD class extension.

For a description of each interface and its methods, see the UMDF documentation..

The WPD Driver Samples

Send comments about this topic to Microsoft

© 2017 Microsoft