Rediger

Del via


Handling a GUID_TARGET_DEVICE_REMOVE_CANCELLED Event

If an IRP_MN_QUERY_REMOVE_DEVICE request fails, the PnP manager sends an IRP_MN_CANCEL_REMOVE_DEVICE IRP to the drivers for the device. After the cancel-remove IRP completes successfully, the PnP manager calls any notification callback routines that registered for EventCategoryTargetDeviceChange on the device. The PnP manager specifies a NotificationStructure.Event of GUID_TARGET_DEVICE_REMOVE_CANCELLED.

When handling a GUID_TARGET_DEVICE_REMOVE_CANCELLED event, a notification callback routine should:

  • Reregister for target device notification.

    Because the driver closed the previous registration handle in response to the query-remove notification, the driver must open a new handle. The driver must:

    1. Remove the old registration with IoUnregisterPlugPlayNotification.

    2. Open a new handle to the device.

    3. Reregister for notification on the new handle with IoRegisterPlugPlayNotification.