Handling Hardware Profile Change Events
At specific times during a hardware profile change, the PnP manager calls notification callback routines that registered for EventCategoryHardwareProfileChange:
Before there is a change in the machine's hardware profile, the PnP manager calls registered notification callback routines and specifies a NotificationStructure.Event of GUID_HWPROFILE_QUERY_CHANGE.
After the machine's hardware profile change is complete, the PnP manager calls registered notification callback routines and specifies a NotificationStructure.Event of GUID_HWPROFILE_CHANGE_COMPLETE.
If the machine's hardware profile change is canceled, the PnP manager calls registered notification callback routines and specifies a NotificationStructure.Event of GUID_HWPROFILE_CHANGE_CANCELLED.
For a GUID_HWPROFILE_QUERY_CHANGE event the PnP manager calls user-mode callback routines and then calls kernel-mode callback routines. In response to a GUID_HWPROFILE_QUERY_CHANGE event, a driver's notification callback routine typically just returns STATUS_SUCCESS.
For a GUID_HWPROFILE_CHANGE_COMPLETE event the PnP manager calls kernel-mode callback routines and then calls user-mode callback routines. In response to such an event, a driver's callback routine might refresh its hardware-profile-specific settings.
For a GUID_HWPROFILE_CHANGE_CANCELLED event the PnP manager calls kernel-mode callback routines and then user-mode routines. In response to such an event, a driver's callback routine typically just returns STATUS_SUCCESS. If the driver performed any operations in response to the GUID_HWPROFILE_QUERY_CHANGE event, the driver would undo those operations in response to the cancellation event.