We have a custom NDIS protocol and miniport drivers for Windows Mobile 6.5. We'd like to allow the user to uninstall these drivers cleanly, however uninstall currently gives the error: " was not completely removed. Do you want to remove it from the list of installed programs?" This is probably happening because the drivers are still in use (as reported by Remote Process Viewer). Unfortunately, I cannot figure out how to unload the drivers (assuming that is the problem). The drivers are for hardware that is built-in to the device, so it is not possible to simply remove the device and have the drivers unloaded
[edit] I should have probably mentioned the whole problem when I wrote this. I really care about updating the driver. I don't necessarily have to uninstall the old driver to do that.
You can probably call DeactivateDevice, though you need to have the driver's handle (from whomever called ActivateDevice). For CE 5.0 and earlier, at least for stream drivers, the device manager actually put this in the registry under HKLM/Drivers/Active
.
I've not looked for NDIS as I've never wanted to unload one. For that you might need to call DeviceIoControl to the NDIS driver with IOCTL_NDIS_UNBIND_ADAPTER and/or IOCTL_NDIS_DEREGISTER_ADAPTER