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 ?
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?
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
.
来源:https://stackoverflow.com/questions/9965030/drivers-uninstall-button-is-disabled