Jump to content


Photo

How to install Windows device driver


  • Please log in to reply
2 replies to this topic

#1 danielxu22

danielxu22
  • Full Members
  • 27 posts

Posted 18 December 2006 - 05:21

Summary
We found some issues in our drivers’ installation under Microsoft Windows. There are 5 to 6 ways to setup/remove device driver. Let’s see each one’s performance and why we choose the right one to deal with.
The following string will demonstrate each method usage, Advantage and Disadvantage.
Compare with all different instance and potential problems. Finally, we choose Basic MSI Project & DPInst tools to setup our device driver.

Compile platform:
InstallShield 12 – Premier Edition

Target OS:
Vista, Vista x64, WinXP, WinXP x64 Windows.


Device Driver Setup method Overviews
1. Devcon.exe & Pnputil.exe (InstallScript MSI Project)
Usage:
devcon.exe update driver.inf HWID
devcon.exe remove HWID
devcon.exe dp_delete oem.inf
pnputil.exe –i –a driver.inf
pnputil.exe –f –d oem*.inf

Use LaunchAppAndWait to run the command.

Advantage:
You can setup or remove our driver freely, without any error.

Disadvantage:
devcon.exe can not be distributed. This utility could only use for driver setup testing.
This method will display black command dialog. Custom may not want this.


2. DriverPackage*** API (InstallScript Project Only)
Usage:
Call DIFxDriverPackageInstall function to install device driver.
DIFxDriverPackageUninstall remove device driver.


Advantage:
Call these functions in Install Script in the right position. It is very easy to install or uninstall device driver.

Disadvantage:
Call DIFxDriverPackageInstall will return error code. (Vista x64)
ERROR_BAD_ENVIRONMENT -- The Windows version on which this call was made does not support this operation.


3. Use C to build some utilities to setup or remove drivers. (Old model – InstallScript MSI Project)
Usage:
Build utilities to setup or remove device driver. WINDDK\6000\src\setup\devcon is the source code for reference.
Build DLL (Dynamic-Link Library) or EXE files; contain the functions of FindExistingDevice, RemoveDevice and InstallDevice to do the drivers’ operation.
Call these functions in script code, UseDLL, LaunchAppAndWait or launch the EXE file in Custom Action.
Note: The new version of WDK is different from DDK, including driver setup program. So the original utilities do not work under Vista OS.

Advantage:
This driver setup method is more compatible. You could setup the entire device by one utility; just use the different parameters to setup different device.

Disadvantage:
This must be careful in the path of utilities and the input parameters. And this method is very complex to control all the conditions and environments. It depends more time to build the right utility and to test this utility is correct for all the OS environments.

4. Device Driver Package component in InstallShield (InstallScript MSI or Basic MSI Project)
Usage:
The Device Driver Wizard simplifies the process of installing device drivers from a Windows Installer–based installation using the Driver Installation Frameworks for Applications (DIFxApp) from Microsoft. The wizard creates the necessary table and entries, custom actions, feature, and components.
Create a component in IS contains the SYS, CAT, INF files.
To open the Device Driver Wizard, do one of the following:
In the Setup Design view, right-click a feature and then click Device Driver Wizard. The feature that the wizard creates will be a subfeature of the selected feature.
On the Project menu, click Device Driver Wizard. The feature that the wizard creates will be a root-level feature.

Advantage:
If you followed the Device Driver Wizard step by step, then finish the wizard. This component will setup or remove device driver easily, without any other operation.

Disadvantage:
This method could setup only one device driver. There is an error happened when you install two drivers in one project. (Test OS: IS v10.5, Vista Beta 1)

5. DPInst.exe & DIFxAPI.dll (Basic MSI Project)
Usage:
Driver Package Installer (DPInst) version 2.1 is a component of Driver Install Frameworks (DIFx) version 2.1 that simplifies and customizes the installation of driver packages for devices that are not yet installed in a computer (commonly known as a software-first installation). DPInst also automatically updates the drivers for any installed devices that are supported by the newly installed driver packages.

dpinst.exe /S /SA ---- setup driver
dpinst.exe /U "[INSTALLDIR]driver.INF" /S ---- remove driver

Advantage:
Enhance the user experience of a driver package by eliminating most of the manual steps that would otherwise be required to install driver packages. When a user runs DPInst, a wizard notifies the user of the installation progress and provides an optional end-user license agreement (EULA) page that gives the user the option to cancel installation.
Avoid writing a custom installation program to install driver packages and update the installed drivers for supported devices. You do not have to change your driver packages to use DPInst. You only need to create an installation package that includes DPInst and one or more driver packages.

DPInst enables:
• Localization. There are two versions of DPInst: an English-only version and a multi-language version that supports many of the commonly used languages that the Windows operating system supports.
• Driver installation customization. You can localize and customize the text, icons, and bitmaps that are displayed on wizard pages. You can include an optional EULA and can control whether wizard pages are displayed.
• Automatic driver package removal. For each driver package that is installed by DPInst, DPInst adds an entry to Add or Remove Programs (in Control Panel) that users can use to remove the driver package from their computers. If a user removes a driver package, the package is removed from the driver store, the corresponding INF file is removed from the system INF file directory, and all of the devices that were previously supported by the package are updated with the next best available driver.
• Installation error logs. DPInst records high-level messages in the DPInst log file (%windir%\DPINST.LOG). The log file is a plain-text file that contains information and error messages and identifies the driver package that was being installed when an error occurred. For more information about the DPInst log file, see Testing and Debugging a DPInst Installation Package.

Disadvantage:
Not yet.


Other issue
1. Find relate install package (by UpgradeCode), and remove previous version quietly.
Use MsiGetProperty gets the ACTIONPROPERTY value for an installer property.
nResult = MsiGetProperty(ISMSI_HANDLE, "ACTIONPROPERTY", szActionProperty, nSize);

ActionProperty
When the FindRelatedProducts action detects a related product installed on the system, it appends the product code to the property specified in this field. The property specified in this column must be a public property and the package author must add the property to the SecureCustomProperties property. Each row in the Upgrade table must have a unique ActionProperty value. After FindRelatedProducts, the value of this property is a list product codes, separated by semicolons (wink.gif, detected on the system.

Silent uninstall InstallShield package
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[InstallShiels_]{YOUR_GUID}Get the Value of the "UninstallString" (....\IDriver.exe /M{YOUR_GUID})
append to that Value /uninst --> \IDriver.exe /M{YOUR_GUID} /uninst 2. Support silent install. (setup.exe /S /v/qn)

2. Support silent install.
setup.exe:
setup.exe /S /v/qn
setup.msi:
msiexec.exe /qn

3. Support multi-languages. (All items in the InstallShield project languages list)

4. Vista x64 Windows\System32 folder
Our utilities do not work under Windows\System32 folder. Include:

Narrow Sense (Windows Utilities)
pnputil.exe
silentcall.exe (this utility use for hide the command’s dialog, call CreateProcess API function)
cmd.exe

Broad Sense (Windows API)
ShellExecute
LaunchAppAndWait
CreateProcess
CreateProcessAsUser

On the contrary, devcon.exe runs success.

5. be careful of parameter’s full path
In Vista x64 system, the ProgramFileFolder is “Program File (x64)”. Be careful of parameter’s path must add quotation mark in Custom Action and Script Code. Make sure the full path is right.



#2 Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 12,864 posts

Posted 19 December 2006 - 10:18

Moving post to the appropriate forum.

#3 zoulingling

zoulingling
  • Full Members
  • 2 posts

Posted 18 June 2008 - 07:24

I think this is very usful for me.
I want to know whether the InstallScript MSI project can handle mutiply device driver at once by use the device wizard in IS2008 Primer Editon.
Thanks in advance.

Edited by zoulingling, 18 June 2008 - 07:25.

user posted image