Driver's uninstall button is disabled

时间秒杀一切 提交于 2019-12-01 08:46:48

问题


I've written my fairly simple first driver for a virtual device. It also has a .inf and I install the driver using devcon.exe.

It install fine and functions properly but my problem is when I try to uninstall it: devcon.exe can't uninstall it and in Device Manager, the Uninstall, Roll Back and Disable buttons for the driver are disabled. My main concern for now is the Uninstall button.

My driver implements the DriverObject->DriverUnload. I've look in the msdn docs, and for now I can't find any DDUninstall INF section for drivers.

When I look in the %WinDir%\inf\setupapi.app.log I see the following error for when I try to remove it with devcon.exe:

>>>  [DIF_REMOVE - ROOT\HIDCLASS\0000]
>>>  Section start 2012/04/01 20:52:22.237
      cmd: devcon.exe  remove HID\MyDriver
!!!  dvi: Default installer: failed!
!!!  dvi: Error 0xe0000231: The device cannot be disabled.
<<<  Section end 2012/04/01 20:52:22.252
<<<  [Exit status: FAILURE(0xe0000231)]

Is there anything I'm missing in the code or in the .inf file so that my driver can be uninstalled ?


回答1:


Im not sure that this is a inf-related problem. Error 0xe0000231 means ERROR_NOT_DISABLEABLE.

You cannot desinstall while it is being used. So the problem should be the disable.

Do you have defined any close/cleanup callbacks?




回答2:


Windows won't allow you disable the device while it has child devices on the fly. The simplest way to uninstall the root device is using DiUninstallDevice.

Reference: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/using-setupapi-to-uninstall-devices-and-driver-packages



来源:https://stackoverflow.com/questions/9965030/drivers-uninstall-button-is-disabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!