Your program already deals with devices, so it should be quite simple to add the ability to remove non-present devices.
Just showing them in a list, where you can click a device and say "never remove", or tick the devices you want to uninstall and clear out all the junk at once!
This is a problem experienced by all windows users.
Windows continuously installs drivers every time you connect a device to your PC, whether its USB or a CDRom, SATA device, etc.
When plugging in the same USB drive in different ports, theres a separate installation for each port it can be plugged in, this is multiplied if you use hubs.
If you add the environment variable
DEVMGR_SHOW_NONPRESENT_DEVICES = 1
to your system and then open the device manager with 'show hidden devices', you will see hundreds of non-present devices.
This really slows down your PC.
Try removing all of them (yes its a nightmare, because windows only lets you remove one at a time). PC boots and runs a lot faster, because its not spending all its time looking for stuff thats not there.