I'm looking through the references at http://msdn.microsoft.com/en-us/library/aa376947(v=vs.85).aspx (Setup API reference) and http://msdn.microsoft.com/en-us/library/windows/hardware/ff549791(v=vs.85).aspx (driver Setup API reference) and I don't see a function that would let me register a function that would get called when a particular device/hardwareID/driver key/ or whatever appears.
Anyone know how I would go about this? Ideally I'd like to do this detection in user-space, but if necessary I could work things around detecting this in kernel-space.
For notifications that are commonly of interest (e.g. a new disk volume has been plugged-in) Windows automatically broadcasts the WM_DEVICECHANGE
message to all top-level Windows. You do not need to register for it.
For notifications that are not delivered automatically you can use RegisterDeviceNotification
to request them.