更新 Windows 移动驱动程序

发布于 2024-10-01 12:37:40 字数 347 浏览 8 评论 0原文

我们有适用于 Windows Mobile 6.5 的自定义 NDIS 协议和微型端口驱动程序。我们希望允许用户彻底卸载这些驱动程序,但是卸载当前会出现错误:“未完全删除。您想将其从已安装程序列表中删除吗?”发生这种情况可能是因为驱动程序仍在使用中(如远程进程查看器所报告)。不幸的是,我无法弄清楚如何卸载驱动程序(假设这是问题所在)。驱动程序适用于设备内置的硬件,因此不可能简单地删除设备并卸载驱动程序

  1. 是否有卸载驱动程序的编程方法?
  2. 卸载时我还应该做些什么来彻底卸载驱动程序吗?

[编辑] 当我写这篇文章时,我可能应该提到整个问题。我真的很关心更新驱动程序。我不一定要卸载旧驱动程序才能做到这一点。

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

  1. Is there a programmatic method of unloading a driver?
  2. Is there anything else I should be doing at uninstall to cleanly uninstall the drivers?

[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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海夕 2024-10-08 12:37:40

您也许可以调用 DeactivateDevice,但您需要拥有驱动程序的句柄(来自调用 ActivateDevice 的人)。对于 CE 5.0 及更早版本,至少对于流驱动程序,设备管理器实际上将其放在 HKLM/Drivers/Active 下的注册表中。

我没有寻找 NDIS,因为我从来没有想过放弃一项。为此,您可能需要使用 IOCTL_NDIS_UNBIND_ADAPTER 和/或 IOCTL_NDIS_DEREGISTER_ADAPTER< 调用 NDIS 驱动程序的 DeviceIoControl /a>

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

水中月 2024-10-08 12:37:40

一种可能是在 Windows Mobile 启动时启动一个程序,该程序将删除旧驱动程序并将新驱动程序复制到位。

这可以使用 HKEY_LOCAL_MACHINE\Init 来完成,如下所述:

这是一个示例程序:

#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
   // delete the old driver
   BOOL result = DeleteFile(L"\\Windows\\MyDriver.dll");
   if (result)
   {
      // put the new driver in place
      result = MoveFile(L"\\My Documents\\MyDriver_NEW.dll",
         L"\\Windows\\MyDriver.dll");
   }

   // Delete us from the registry
   HKEY regKey = 0;
   LONG regResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"init", 0, KEY_SET_VALUE, ®Key);
   result = regResult == ERROR_SUCCESS;
   if (result)
   {
      regResult = RegDeleteValue(regKey, L"Depend19");
      result = regResult == ERROR_SUCCESS;
      if (result)
      {
         regResult = RegDeleteValue(regKey, L"Launch18");
         result = regResult == ERROR_SUCCESS;
      }
      RegCloseKey(regKey);
   }

   // we need to tell WinCE we started properly
   SignalStarted(_ttoi(argv[1]));

   return 0;
}

'Launch18' 和 'Depend19 的值' 在您的平台上可能会有所不同。只需确保该程序在 device.exe 之前运行即可。

注意:在许多平台上,该程序必须签名,并且您的证书需要安装在设备上。如果不是,那么它不会运行。

One possibility is to launch a program at Windows Mobile startup that will delete the old driver and copy the new one in to place.

This can be accomplished using HKEY_LOCAL_MACHINE\Init as documented here:

Here is a sample program:

#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
   // delete the old driver
   BOOL result = DeleteFile(L"\\Windows\\MyDriver.dll");
   if (result)
   {
      // put the new driver in place
      result = MoveFile(L"\\My Documents\\MyDriver_NEW.dll",
         L"\\Windows\\MyDriver.dll");
   }

   // Delete us from the registry
   HKEY regKey = 0;
   LONG regResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"init", 0, KEY_SET_VALUE, ®Key);
   result = regResult == ERROR_SUCCESS;
   if (result)
   {
      regResult = RegDeleteValue(regKey, L"Depend19");
      result = regResult == ERROR_SUCCESS;
      if (result)
      {
         regResult = RegDeleteValue(regKey, L"Launch18");
         result = regResult == ERROR_SUCCESS;
      }
      RegCloseKey(regKey);
   }

   // we need to tell WinCE we started properly
   SignalStarted(_ttoi(argv[1]));

   return 0;
}

The values of 'Launch18' and 'Depend19' will probably be different on your platform. Just make sure this program is run before device.exe.

Note: On many platforms this program will have to be signed and your certs need to be installed on the device. If it isn't then it won't run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文