开发者

Install usb device without manager prompt

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开发者_StackOverflow the wizard (passively, so the user doesn't need to do anything). Does anyone know how this can be achieved?


You added the "installer" tag, so I'm assuming you're talking about some kind of installation package, like Windows Installer, InstallShield InstallScript, etc.

If that's the case, you should probably use Microsoft's DIFx framework.

DIFx makes it easier for you to create high-quality driver packages, customize the installation of driver packages, allow the installation of driver packages in combination with application software, and use the standard Windows APIs and installation tools. DIFx also makes it easier for end users to diagnose device and driver problems. End users can be confident that, if necessary, drivers can be uninstalled or rolled back.

I've used DIFx from both Windows Installer-based installs and InstallScript installs. Very user-friendly, easy to debug, and effective.


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.

So here is the relevant excerpt from the whole document:

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. 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. The Orca installation is included in the Windows SDK in the ‘C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin’ directory. (The Windows SDK can be downloaded from Microsoft)
    2. Run Orca and select the MSI package that needs to be modified.
      • Read part 5 for automation.
    3. In the ‘File’ table, locate the INF file of the driver package you would like to install and copy the Component value.
    4. 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 - 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.
    5. Save the MSI. In order to automate the process, the editing of the MSI database can be recorded to a Transform and then the Transform can be applied in a post build process.
      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

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. EDIT: 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜