在驱动程序安装期间重新扫描设备树以进行硬件更改 [英] Rescan device tree for hardware changes during Driver installation

查看:147
本文介绍了在驱动程序安装期间重新扫描设备树以进行硬件更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 InstallShield 来安装我的应用程序,驱动程序和服务。
仅当在设备管理器中找到其即插即用驱动程序时,才需要安装该驱动程序。使用DPInst.exe完成驱动程序安装。
我的问题是用户有时可以手动卸载驱动程序(安装后甚至卸载其他设备 下的未知驱动程序 )然后即使设备已插入,我也无法在设备树中找到硬件ID。
如果在安装过程中使用 CM_Reenumerate_DevNode_Ex (与扫描新硬件 等效的代码)重新扫描设备树,则可以找到硬件ID,但这会弹出找到新的硬件向导

I'm using InstallShield to install my application, a driver and a service. I need to install the plug-N-play driver only if it's hardware ID was found in the device manager. The driver installation is done using DPInst.exe. My problem, is that a user can sometimes manually uninstall the driver (After it was installed or even uninstall the "Unknown driver" under "Other devices") and then I can't find the hardware ID in the device tree, although the device is plugged. If I rescan the device tree during installation using CM_Reenumerate_DevNode_Ex (The code equivalent of "Scan for new hardware"), I can find the hardware ID but this brings up the "Found new hardware wizard".

是否仍然可以重新扫描设备树,但可以抑制找到新的硬件向导 还是要避免重新扫描但仍要确保系统中存在我的设备硬件ID?

Is there anyway to rescan the device tree but suppress the "Found new hardware wizard" or to avoid rescanning but still making sure my device hardware ID is present in the system?

推荐答案

我正在写一个新的答案,因为我们已经对我的较旧的评论太多了,其内容是基于对情况的一小部分误解。

I'm writing a new answer since we already have too many comments on my older one, and its content was based on a small misunderstanding of the situation.

据我所了解,实际的问题是安装之前,在重新扫描设备时弹出的添加新硬件向导。不幸的是,每当找不到合适的驱动程序来处理系统中的新设备时,该向导都会弹出,因此要克服该问题,唯一的选择是确保系统中存在这样的驱动程序。这导致了两种可能的解决方案,我可以看到:

The actual problem, as I understand it now, is the "Add new hardware" wizard that pops-up when rescanning for devices, before installing your driver. Unfortunately, this wizard pops-up whenever no suitable driver is found to handle a new device in the system, so in order to overcome it, the only option is to make sure that such a driver exists in the system. This leads to two possible solutions that I can see:


  1. 首先进行软件安装,并确保您的驱动程序适合设备(INF格式正确,并且您具有WHQL签名)。据我了解,这不是一个选择,因为您不想在未连接设备的机器上安装驱动程序(我很想听听为什么)。

  2. 确保系统中的其他驱动程序适合处理它。在这种情况下,您需要选择一个内置驱动程序(如果将其用作设备的功能驱动程序,则不会造成严重破坏),并为您的设备提供一个匹配的兼容ID-一个会导致内置驱动程序适合。这样,您无需在重新扫描设备后就等待用户,但是根据您的设备,可能找不到合适的内置驱动程序。

这篇关于在驱动程序安装期间重新扫描设备树以进行硬件更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆