0

I am using a Teensy 3.5 that I am programming as a joystick. It works great until I use a different Teensy based joystick on the same computer. Windows will not recognize it properly. This is a know issue and there is a fix. It is explained here:

https://forum.pjrc.com/threads/23566-Teensyduino-USB-Joystick-no-data-driver-problem-workaround

In short, I need to search the whole registry and delete all keys containing "VID_16c0". After this is done, the new joystick based Teensy will work no problem.

Its a bit cumbersome so I would like to be able to write a small executable that will do this for me.

I am using Delphi XE2.

I already know how to delete a the key if I know the full path: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Registry_TRegistry_DeleteKey.html

But I can't find a method that allows me to search the registry for a key containing "VID_16c0" in its name.

Examples of key names:

VID_16C0&PID_0488
##?#HID#VID_16C0&PID_0482&MI_01&Col01#7&30828b33&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
##?#USB#VID_16C0&PID_0478#00084F1E#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

Any pointers would be greatly appreciated.

Many thanks, E.

E Demers
  • 103
  • 1
  • 8
  • 1
    There is no such api. You need to enumerate the registry keys and check each one for your target text. Start here https://stackoverflow.com/a/9005138/505088 and extend it using recursion. – David Heffernan Jun 16 '20 at 07:17
  • 2
    I would not recommend using the mentioned "fix" from the linked forum. Deleting all registry entries containing `VID_16c0` could cause many problems as it would cause all drivers for any device that is using hardware from specific vendor to stop working properly. I have experienced similar problems by installing wrong drivers for certain hardware before. Sometimes it helps by removing drivers for such hardware from Windows Safe Mode. So I would recommend trying such approach before messing with system registry. Or maybe searching a way for removing drivers for specific drivers programmatically – SilverWarior Jun 16 '20 at 12:30
  • If you check this manually, isn't it clear *which* keys (can) contain the subkeys to delete? That drastically limits what you have to search and reduces the risk SilverWarrior warns you for. – Jan Doggen Jun 16 '20 at 15:25
  • @JanDoggen The problem with this windows "bug" is that it isn't only registry values that can cause it to appear. For instance when you are installing drivers that didn't ship with Windows by default windows copies *.inf file from those drivers to one of its folders (I forgot which one it is). So if you managed to install wrong drivers in the first place for as long as windows will have that *.inf file from those wrong drivers it will try to installing those wrong drivers again and again. ... – SilverWarior Jun 16 '20 at 20:54
  • ... The worst thing is that if you remove those wrong drivers in normal mode windows WILL NOT remove that *inf file belonging to those drivers. Based on my expirience Windows will remove that *inf file only if the drivers are removed from safe mode. And even this isn't always true. In short convincing Windows to not install wrong drivers can sometimes be real pain in the ass. And don't get me started on difficulties of Windows 8.1 automatically downloading unstable drivers for Lexmark MS410DN Laser printer we use at work. ... – SilverWarior Jun 16 '20 at 21:02
  • .. I had to literally disconnect computer from network and then install official downloadable drivers for that printer in order to be successful. if connected to network Windows would go and download wrong drivers even if I started driver installation through official downloadable driver package for that printer. – SilverWarior Jun 16 '20 at 21:05
  • This uses windows generic "USB Composite Device". When I delete manually, whether on my computer or another everything that contains "VID_16C0" has to do with the Teensy MCU and nothing else. I was wondering maybe with a windows API? Since Regedit has a find function, hopefully it can be done the same way? – E Demers Jun 18 '20 at 03:27

0 Answers0