未连接硬件时卸载 Windows 驱动程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8765417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:05:19  来源:igfitidea点击:

Uninstall a Windows driver when the hardware is not connected

windowshardwareuninstalldrivers

提问by Julien M

I am developing a Windows C++ application that drives a motor controller that is plugged on USB. This controller relies on Ftdibus drivers and it works fine on my PC. However, on a test computer it used to work but since I messed up with the Ftdi drivers as soon as I plug the controller, I get a BSoD (mentioning Ftdibus). I would like to cleanup the drivers, but:

我正在开发一个 Windows C++ 应用程序,它驱动一个插入 USB 的电机控制器。该控制器依赖于 Ftdibus 驱动程序,它在我的 PC 上运行良好。然而,在测试计算机上它曾经可以工作,但是因为我一插入控制器就搞砸了 Ftdi 驱动程序,我得到了一个 BSoD(提到 Ftdibus)。我想清理驱动程序,但是:

  • they do not appear in Windows "uninstall programs"
  • I can't right click on the controller in the device manager and chose "uninstall" because I can't plug the controller (BSoD)
  • I tried nirsoft toolthat has an option to uninstall devices but it won't work
  • 它们不会出现在 Windows“卸载程序”中
  • 我无法在设备管理器中右键单击控制器并选择“卸载”,因为我无法插入控制器 (BSoD)
  • 我尝试了 nirsoft工具,该工具可以选择卸载设备,但无法正常工作

I'm clueless, how could I clean up that mess?

我一无所知,我怎么能清理那烂摊子?

PS: if anyone has documentation regarding how drivers are bound to an USB port number, I would enjoy reading on the subject

PS:如果有人有关于驱动程序如何绑定到 USB 端口号的文档,我很乐意阅读该主题

回答by snoone

If this is Vista and later, the supported method for deleting a driver package is with pnputil:

如果是 Vista 及更高版本,则支持删除驱动程序包的方法是使用 pnputil:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff550428(v=vs.85).aspx#deleting_a_driver_package_from_the_driver_store

http://msdn.microsoft.com/en-us/library/windows/hardware/ff550428(v=vs.85).aspx#deleting_a_driver_package_from_the_driver_store

Just deleting the service is sort of a bad idea, that's not the only thing that installing a driver puts in the registry.

只是删除该服务是一个坏主意,这不是安装驱动程序放入注册表的唯一内容。

I missed the second part of your post about how Windows binds drivers to USB devices. There's a nice description of it here:

我错过了您关于 Windows 如何将驱动程序绑定到 USB 设备的帖子的第二部分。这里有一个很好的描述:

http://blogs.msdn.com/b/oldnewthing/archive/2004/11/10/255047.aspx

http://blogs.msdn.com/b/oldnewthing/archive/2004/11/10/255047.aspx

If you need more details feel free to contact me (I specialize in Windows drivers for a living :))

如果您需要更多详细信息,请随时与我联系(我以 Windows 驱动程序为生:))

回答by Shane Powell

How I do it is one of three ways:

我的做法是以下三种方式之一:

  1. Go into Device Manager, select 'view' menu and select the 'Show hidden devices'. Find your device description and select the 'uninstall' menu option. [easy]

  2. You can use the Service Control Manager command line 'SC' to delete the device driver from the registry. You will need to know the installed driver name. [medium]

  3. Manually delete the driver setup in the registry. Using regedit, you can delete the registry entries for the driver. Drivers registry setup lives under 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services'. Find the driver name key and delete it. [hard]

  1. 进入设备管理器,选择“查看”菜单并选择“显示隐藏的设备”。找到您的设备描述并选择“卸载”菜单选项。[简单]

  2. 您可以使用服务控制管理器命令行“ SC”从注册表中删除设备驱动程序。您需要知道已安装的驱动程序名称。[中等的]

  3. 手动删除注册表中的驱动程序设置。使用 regedit,您可以删除驱动程序的注册表项。驱动程序注册表设置位于“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services”下。找到驱动程序名称键并将其删除。[难的]