Using PnP Target Device Change Notification

A driver registers for EventCategoryTargetDeviceChange notification on a device so the driver can be notified when the device is about to be removed. For example, if a driver opens a handle to a device, the driver should register for EventCategoryTargetDeviceChange notification on the device so the driver can close its handle when the PnP manager needs to remove the device.

Drivers can also use EventCategoryTargetDeviceChange notification for custom notification. (See Using PnP Custom Notification.)

The following subsections discuss how to register for target device change notification and how to handle target device change events in a PnP notification callback routine:

Registering for Target Device Change Notification

Handling a GUID_TARGET_DEVICE_QUERY_REMOVE Event

Handling a GUID_TARGET_DEVICE_REMOVE_COMPLETE Event

Handling a GUID_TARGET_DEVICE_REMOVE_CANCELLED Event

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft