Discussion:
Deleting USB Hardware Keys From The Registry
(too old to reply)
Alfie Noakes
2009-04-16 05:30:21 UTC
Permalink
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx

...when I reconnect the device it is identified and reinstalled OK.

I presume this is because it still has a driver key node under the
class key, e.g.


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031

As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).


Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.

Thanks.
Pavel A.
2009-04-16 11:13:24 UTC
Permalink
It's not recommended to tamper with the registry data you've named.
Instead we are supposed to use the normal SetupAPI functions
to uninstall drivers, it works on both present and not present devices.

Don Burn posted directions how to cleanup driver data
from registry and filesystem some time ago; but this is meant
only for development.
Googling the archive of this NG should find it.

Regards,
-- pa
Post by Alfie Noakes
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
...when I reconnect the device it is identified and reinstalled OK.
I presume this is because it still has a driver key node under the
class key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031
As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).
Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.
Thanks.
Alfie Noakes
2009-04-16 12:15:26 UTC
Permalink
Thanks Pavel.


On Thu, 16 Apr 2009 14:13:24 +0300, "Pavel A."
Post by Pavel A.
It's not recommended to tamper with the registry data you've named.
Instead we are supposed to use the normal SetupAPI functions
to uninstall drivers, it works on both present and not present devices.
Don Burn posted directions how to cleanup driver data
from registry and filesystem some time ago; but this is meant
only for development.
Googling the archive of this NG should find it.
Regards,
-- pa
Post by Alfie Noakes
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
...when I reconnect the device it is identified and reinstalled OK.
I presume this is because it still has a driver key node under the
class key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031
As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).
Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.
Thanks.
Kerem Gümrükcü
2009-04-16 14:45:44 UTC
Permalink
Hi Alfie,

did you find the Don Burn posting? If yes, could
you or someone please send the google groups
link or NG Link to that, because i did not found it,....


Regards

Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by Alfie Noakes
Thanks Pavel.
On Thu, 16 Apr 2009 14:13:24 +0300, "Pavel A."
Post by Pavel A.
It's not recommended to tamper with the registry data you've named.
Instead we are supposed to use the normal SetupAPI functions
to uninstall drivers, it works on both present and not present devices.
Don Burn posted directions how to cleanup driver data
from registry and filesystem some time ago; but this is meant
only for development.
Googling the archive of this NG should find it.
Regards,
-- pa
Post by Alfie Noakes
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
...when I reconnect the device it is identified and reinstalled OK.
I presume this is because it still has a driver key node under the
class key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031
As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).
Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.
Thanks.
Don Burn
2009-04-16 14:51:07 UTC
Permalink
Here it is again. The following is my stock approach for removing drivers.


Removing all traces of a driver from a system

When testing a device install developers want to cleanup the system so
they can try reinstalling the device, unfortunately this is something
Microsoft hasn't provided an easy way to do. The steps needed are:

1. Delete the files copied by the INF from the system.

2. Delete the INF and corresponding PNF files for the device, from the
inf directory off of the system root. Note, this file is named OEM*.INF and
OEM*.PNF if your driver is not signed. Searching the OEM*.INF files for
your device identifier will determine the OEM* name of your inf file.

3. If your device has a unique class, delete the registry entry in
HLKM\System\CurrentControlSet\Control\Class corresponding to the device
class you created for device. Note the key is named for the GUID of the
class.

4. If your device has a CoInstaller, delete the registry entry in
HLKM\System\CurrentControlSet\Control\CoDeviceInstallers corresponding to
the device class you created for device. Note the key is named for the GUID
of the class.

5. Delete the registry entries in HLKM\System\CurrentControlSet\Enum
corresponding to the device you specified in the inf file. For PCI devices
this is under the PCI key, for legacy devices this is under the Root key.
Note: if you specify more than one device in the inf, you will have an entry
for each device type the system has seen. DELETING THIS KEY REQUIRES
CHANGING ITS SECURITY FIRST.

6. Delete the registry entry in
HLKM\System\CurrentControlSet\Services corresponding to the driver you
specified in the inf file. Note this is the standard cleanup one would have
done in the pre-PNP days.

7. Reboot the system, now that was easy and intuitive wasn't it.
--
Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
Post by Kerem Gümrükcü
Hi Alfie,
did you find the Don Burn posting? If yes, could
you or someone please send the google groups
link or NG Link to that, because i did not found it,....
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by Alfie Noakes
Thanks Pavel.
On Thu, 16 Apr 2009 14:13:24 +0300, "Pavel A."
Post by Pavel A.
It's not recommended to tamper with the registry data you've named.
Instead we are supposed to use the normal SetupAPI functions
to uninstall drivers, it works on both present and not present devices.
Don Burn posted directions how to cleanup driver data
from registry and filesystem some time ago; but this is meant
only for development.
Googling the archive of this NG should find it.
Regards,
-- pa
Post by Alfie Noakes
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
...when I reconnect the device it is identified and reinstalled OK.
I presume this is because it still has a driver key node under the
class key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031
As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).
Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.
Thanks.
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4013 (20090416) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4013 (20090416) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Maxim S. Shatskih
2009-04-16 17:00:51 UTC
Permalink
Post by Don Burn
7. Reboot the system, now that was easy and intuitive wasn't it.
What about deleting HKLM\SYSTEM\CurrentControlSet\Control\Class\{guid}\%04d?
--
Maxim S. Shatskih
Windows DDK MVP
***@storagecraft.com
http://www.storagecraft.com
Doron Holan [MSFT]
2009-04-16 18:16:21 UTC
Permalink
maybe you want to blog this so you can just point to a URL :)

d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Don Burn
Here it is again. The following is my stock approach for removing drivers.
Removing all traces of a driver from a system
When testing a device install developers want to cleanup the system so
they can try reinstalling the device, unfortunately this is something
1. Delete the files copied by the INF from the system.
2. Delete the INF and corresponding PNF files for the device, from the
inf directory off of the system root. Note, this file is named OEM*.INF and
OEM*.PNF if your driver is not signed. Searching the OEM*.INF files for
your device identifier will determine the OEM* name of your inf file.
3. If your device has a unique class, delete the registry entry in
HLKM\System\CurrentControlSet\Control\Class corresponding to the device
class you created for device. Note the key is named for the GUID of the
class.
4. If your device has a CoInstaller, delete the registry entry in
HLKM\System\CurrentControlSet\Control\CoDeviceInstallers corresponding to
the device class you created for device. Note the key is named for the GUID
of the class.
5. Delete the registry entries in
HLKM\System\CurrentControlSet\Enum
corresponding to the device you specified in the inf file. For PCI devices
this is under the PCI key, for legacy devices this is under the Root key.
Note: if you specify more than one device in the inf, you will have an entry
for each device type the system has seen. DELETING THIS KEY REQUIRES
CHANGING ITS SECURITY FIRST.
6. Delete the registry entry in
HLKM\System\CurrentControlSet\Services corresponding to the driver you
specified in the inf file. Note this is the standard cleanup one would have
done in the pre-PNP days.
7. Reboot the system, now that was easy and intuitive wasn't it.
--
Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
Post by Kerem Gümrükcü
Hi Alfie,
did you find the Don Burn posting? If yes, could
you or someone please send the google groups
link or NG Link to that, because i did not found it,....
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by Alfie Noakes
Thanks Pavel.
On Thu, 16 Apr 2009 14:13:24 +0300, "Pavel A."
Post by Pavel A.
It's not recommended to tamper with the registry data you've named.
Instead we are supposed to use the normal SetupAPI functions
to uninstall drivers, it works on both present and not present devices.
Don Burn posted directions how to cleanup driver data
from registry and filesystem some time ago; but this is meant
only for development.
Googling the archive of this NG should find it.
Regards,
-- pa
Post by Alfie Noakes
I want to remove all traces of a USB device from the registry so XP
prompts for a driver next time I connect. If I just delete the delete
only the hardware key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_xxxx&Pid_xxxx
...when I reconnect the device it is identified and reinstalled OK.
I presume this is because it still has a driver key node under the
class key, e.g.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0031
As this contains the name of the INF file the system is happy to
install it. (I haven't actually deleted any driver files yet).
Since the driver keys under a class key are numnbered sequentially
(0000 0001 0002 etc), is it safe to just delete the relevant key for
the driver I want to "unregister", or is there a safe way of doing
this using the API that wont leave a hole in the numbering sequence.
Thanks.
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4013 (20090416) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4013 (20090416) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Kerem Gümrükcü
2009-04-16 23:36:24 UTC
Permalink
Thanks for posting this Mr. Burn,... :-)


Regards

Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Continue reading on narkive:
Loading...