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:
Remove the old registration with IoUnregisterPlugPlayNotification.
Open a new handle to the device.
Reregister for notification on the new handle with IoRegisterPlugPlayNotification.