Yes. You are looking to disable a device driver, not a service.
The particular APIs needed do this are located in DEVMGR.DLL, probably one of DeviceProperties(A|W), or DevicePropertiesEx(A|W) or DeviceAdvancedProperties(A|W). However, these APIs are officially undocumented, so working out what the parameters are would be extremely difficult.
There are various hardware and DD developer kits available that provide (indirect but documented) access to these APIs, (Windows Device Testing Framework (WDTF); Device Driver Kits (DDKs); WDK etc. ), but which one you would need and whether it would cost money depends upon the version and age of the OS etc. I assume this is not the route you are looking to take.
BTW. The description you give of how to do this manually indicates that you are working with a fairly old version of Windows? On XP (and I think on 2000/2003), the interface changed. You now do this manually via:
Administrative tools->Computer management->Device Manager
That means that it may be possible to adjust these settings programmatically via the Windows Management Interface (WMI) on these later systems--but that probably doesn't help if you're working with NT or earlier.
It's also possible to disable them by adjusting the values of the appropriate registry entries (Win32API::Registry), but I think that you then need a re-boot for it to take affect.
Ultimately, I'm guessing that what you are trying to do is disable the use of USB thumb drives and similar "security risk" devices for corporate desktops? If so, the best way is to do this through the application of appropriate group policies and articles of this nature may be more appropriate to your needs.
In reply to Re^3: How do you enable/disable a driver in Windows?
by BrowserUk
in thread How do you enable/disable a driver in Windows?
by DrWhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |