在没有管理员提示的情况下安装USB设备 [英] Install usb device without manager prompt

查看:114
本文介绍了在没有管理员提示的情况下安装USB设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个USB设备和驱动程序(.inf,libusb.dll,libusb.sys),可以使用Windows的设备安装向导(指向.inf文件)进行安装。但是,我们需要在不使用向导的情况下安装驱动程序(被动地,因此用户不需要执行任何操作)。有人知道如何实现吗?

We have a usb device and the drivers (.inf, libusb.dll, libusb.sys) and can install it using Windows' Device Installation Wizard (by pointing to the .inf file). However, we need to install the drivers without using the wizard (passively, so the user doesn't need to do anything). Does anyone know how this can be achieved?

推荐答案

我的同事提出了一个非常有效的答案。看来,除非您的硬件/驱动程序组合经过WHQL签名,否则添加新硬件向导将始终出现在Win XP中。但是,使用以下方法,可以使向导中的搜索按钮自动找到您的驱动程序。在Windows 7中,没有提示,并且设备安装正常。但是,您需要注意64位计算机,因为它们执行更严格的签名。

My colleague came up with an answer that is working very well. It appears that, unless you hardware/driver combination is WHQL signed, the Add New Hardware Wizard will always appear in Win XP. However, with the following method it is possible to have the "Search" button in the wizard find your driver automatically. In Windows 7, there is no prompt and the device installs just fine. You'll need to watch out on 64-bit machines, though, as they have much stricter signing enforcement.

因此,这是整个文档

使用DIFxAPi合并模块。 (阅读优质的 Windows驱动程序简介,INF文件的使用和DIFxAPP 。)DIFxAPI合并模块包含在WDK的 WDDK // redistredDIFx\DIFxApp\MergeModule\中。 ' 目录。合并模块可以包含在MSI软件包中,并且可以设置为安装多个设备驱动程序。以下是使用DIFxAPP合并模块创建MSI的步骤:

Use the DIFxAPi merge module. (Read a good introduction to drivers in Windows, the use of INF files, and DIFxAPP.) The DIFxAPI merge module is included in the WDK in the ‘WDDK//redist\DIFx\DIFxApp\MergeModule\’ directory. The merge module can be included in an MSI package and can be set to install multiple device drivers. Here are the steps to create an MSI with the DIFxAPP merge module:


  1. 在setup文件夹中,为Application文件夹创建一个单独的目录,用于驱动程序包并将驱动程序文件添加到文件夹中。

  2. 将DIFxApp.msm添加到安装项目中。

  3. 构建安装程序

  4. 使用Orca编辑MSI数据库表,并将INF组件添加到DIFxAPP合并模块表中。

  1. In the setup folder, create a separate directory in the Application Folder for the driver package and add the driver files to the folder.
  2. Add the DIFxApp.msm to the setup project.
  3. Build the setup
  4. Use Orca to edit the MSI database table and add the INF component to the DIFxAPP merge modules table.


  1. Orca安装包含在Windows SDK的 C:\Program Files\Microsoft SDKs\Windows\v7中.0\bin'目录。 (Windows SDK可以为从Microsoft下载

  2. 运行Orca并选择需要修改的MSI软件包。


    • 阅读第5部分,了解自动化。

在MsiDriverPackages表中创建新行。将组件值添加到组件字段中。可以使用以下标志(尽管Windows 7会忽略某些标志) ):

Create a new row in the MsiDriverPackages table. Add the Component value into Component field. The following flags can be used (although some are ignored by Windows 7):


  • 0-未设置(默认)

  • 1 –强制安装驱动程序,甚至如果当前安装的驱动程序比正在安装的驱动程序更适合
    a

  • 2 –禁止显示消息框,告诉用户在安装驱动程序
    后插入设备

  • 4 –禁止在添加/删除程序中添加驱动程序项。

    卸载主应用程序时,将卸载驱动程序。

  • 8 –安装未签名的驱动程序包

  • 16 –卸载期间删除驱动程序二进制文件。

  • 0 - Not set (default)
  • 1 – Force installation of driver, even if it the currently installed drivers is a better match than the driver being installed
  • 2 – Suppress message box telling user to plug in devices after the driver has been installed.
  • 4 – Suppress adding an entry in Add/Remove Programs for driver.
    Driver will be uninstalled when main application is uninstalled.
  • 8 – Install unsigned driver packages
  • 16 – Remove driver binaries during uninstall.

  1. 在Orca中打开MSI。

  2. 选择转换->新建转换

  3. 按照上述方向完成第3步和第4步。

  4. 选择 Tranform->生成转换并保存转换。

  5. 将以下行添加到安装项目的后期版本
    MsiDb.exe -t transform.mst -d $(TargetDir)\DriverInstall.msi
    注意:MsiDB.exe随Microsoft SDK一起提供,位于$ b中$ b C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin

  1. Open the MSI in Orca.
  2. Select Transform->New Transform
  3. Complete steps 3 and 4 in the above directions.
  4. Select Tranform->Generate transform and save the transform.
  5. Add the following line to the post build of the Setup Project MsiDb.exe -t transform.mst -d $(TargetDir)\DriverInstall.msi Note: MsiDB.exe comes with the Microsoft SDK and is located in C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin


>

如果从MSI安装时遇到错误(例如,我收到错误代码2356,最终由于无效的标记值),使用Orca的 Validate 函数查看是否存在任何错误。编辑:修复这些错误仍然没有摆脱错误。我记得读过inf文件应该位于它们自己的子目录中,但这也不能解决我的问题。

If you get an error installing from the MSI (e.g. I got error code 2356 which ended up being due to an invalid Flag value), use Orca's Validate function to see if there are any errors. Fixing these errors still has not gotten rid of the error. I remember reading that inf files should be in their own sub-directory, but that didn't fix my problem either.

这篇关于在没有管理员提示的情况下安装USB设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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