Sie sind auf Seite 1von 8

When a Driver application gets installed on to a machine, it installs driver information like PNF,

INF, CAT files in the location "C:\Windows\inf". By default, these files will be named as
oemXX.pnf or oemXX.inf where XX stands for the number. Ex: oem1.INF, oem1.PNF and so
on. So when we do a capture of such applications, these XX values will be hard coded which
does affect many other device driver applications which are pre-existent in the machine. Hence,
in this case we used to customize the package by writing few Custom actions using "setupapi.dll"
in such a way that it checks for the max XX value which is present in the machine and install the
PNF or INF file of the package.
This approach takes a lot time in creating multiple custom actions for copying oem/pnf files. In
this article, we discuss on a executable "DPInst.exe" which makes your life easy in dealing with
driver based packages.
Introduction to DPInst
DPInst is a component of the Microsoft Windows Driver Install Frameworks (DIFx) that
simplifies and customizes the installation of driver packages for devices that are not yet installed
on 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.
How Packages Install using DPInst
By default, when the Microsoft Windows Driver Package Installer (DPInst) runs, it runs in a
wizard-install mode that displays a sequence of wizard pages. In wizard-install mode, DPInst
first displays a welcome page, and then displays an end-user license agreement (EULA) page.
After the user accepts the licensing agreement on the EULA page, DPInst displays an installation
page, and then performs the following steps to install Plug and Play (PnP) function drivers:
1. Locates the INF files. DPInst searches the directory where the DPInst executable
(DPInst.exe) is located. DPInst also searches vendor-specified subdirectories under the
directory where DPInst.exe is located. A vendor specifies the subdirectories by using the
search and subDirectory XML elements in an optional DPInst descriptor file
(DPInst.xml)
2. Authenticates the driver packages.
3. Preinstalls driver packages in the driver store.
4. Adds an Add or Remove Program entry in Control Panel that represents a driver package.
(DPInst does not support this feature on Windows Longhorn.)
5. Installs the driver packages on matching devices that are connected to a computer.

After DPInst completes the installation of a driver package, DPInst displays a finish page that
informs the user of the status of the installation.
DPInst supports a suppress-wizard mode that suppresses the display of wizard pages and other
user messages that DPInst generates. It also supports command-line options that control the
display of its wizard pages and other DPInst operations.
For general information about INF files and driver packages, see "Providing a Driver Package"
in the Microsoft Windows Driver Development Kit (WDK).
Steps to Follow in MSI package
We need to follow these below steps to achieve efficient driver installation.
Step 1: Search for "*.inf" files in the captured folder.
Step 2: Cross check the contents of this file (step 1) with the contents of "*.inf" files under
"[WindowsFolder]INF" folder.
Step 3: Delete the file "oemXX.inf" from "[WindowsFolder]INF" folder from your package.
Step 4: Copy DPInst.exe under the location where you get the ".inf" file.
Step 5: Write a custom action as shown below.

Repeat the above steps from 1 to 5 for each oemXX.inf files.


Now the MSI package created will be able to install the driver files without affecting the preexistant application's functionality as well as the operating system.
Features of DPInst:

Localization. There are two versions of DPInst: an English-only version and a multilanguage version that supports many of the commonly used languages that Windows
supports.

Driver installation customization. You can localize and customize the text, icon, and
bitmaps that are displayed on wizard pages. You can include branding, an optional
EULA, and 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) where a user can
remove the driver package from their computer. If the 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 devices that were previously supported by the package
are updated with the next best available driver.

Installation error logs. DPInst logs 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.

DPInst Switches
DPInst supports the following command-line switches that set the DPInst configuration flags that
are described in Setting DPInst Configuration Flags and additional switches that further modify DPInst
operation:
/a
Sets the installAllOrNone flag to ON, which configures DPInst to install drivers in a driver
package only if all of the drivers in the installation package can be installed.
/c
Configures DPInst, if DPInst is called at a command prompt, to display the text of log
messages in the Command Prompt window.
/d
Sets the deleteBinaries flag to ON, which configures DPInst to delete the binary files
that were copied to a system when a driver package was installed.
Note Starting with Windows 7, the /d switch is ignored by the operating system. Binary
files, which were copied to a system when a driver package was installed, can no longer
be deleted by using DPInst.
/el
Sets the enableNotListedLanguages flag to ON, which configures DPInst to enable all
of the supported languages that are not explicitly enabled by language XML elements
in a DPInst descriptor file.
/f
Sets the forceIfDriverIsNotBetter flag to ON, which configures DPInst to install a driver
on a device even if the driver that is currently installed on the device is a better match
than the new driver.
/h, /?, or /help
Configures DPInst to display help information about DPInst command-line options. If
DPInst was called at a command prompt, DPInst displays the help text in the Command
Prompt window; otherwise, DPInst displays the help text in a message box.
/l language-ID

Configures DPInst to display the text, bitmaps, and icon for the language that is specified
by a language-ID value. The language-ID value can be specified in either hexadecimal or
decimal format. For a list of the languages and corresponding language identifiers, see
DPInst Localization Support.
If DPInst supports the specified language and runs on a Windows operating system in
which the language is installed, DPInst will use the specified language. For more
information about how to use the /L switch, see Testing Language Customization.
/lm
Sets the legacyMode flag to ON. In legacy mode, DPInst accepts unsigned driver
packages without performing signature verification. However, be aware that Windows
driver signing requirements apply to the installation of a driver package from the DIFx
driver store. These requirements depend on the Windows version, the signature type, the
driver package type, and the driver signing options that are set for a computer.
/q or /s
Sets the quietInstall flag to ON, which suppresses the display of wizard pages, user
dialog boxes, and other user messages that DPInst and Windows generate. The
quietInstall flag works with the presence of an end-user license agreement (EULA) page and the
suppressEulaPage flag.
/p
Sets the promptIfDriverIsNotBetter flag to ON, which configures DPInst to display a
user dialog box if a new driver is not a better match to a device than a driver that is
currently installed on the device. The user dialog box informs a user of this situation and
provides an option to replace the driver that is currently installed on the device with the
new driver.
/path DPInst-working-directory
Sets the DPInst working directory to DPInst-working-directory. DPInst searches for driver
packages in the DPInst working directory and in subdirectories under the working
directory that are specified by subDirectory XML elements in a DPInst descriptor file. For
more information about how to set the DPInst working directory and specifying
subdirectories under the working directory, see Specifying the Location of a Driver Package.
/sa
Sets the suppressAddRemovePrograms flag to ON, which configures DPInst to
suppress the addition of entries to Programs and Features in Control Panel. These
entries represent the driver packages and driver package groups that DPInst installs.
Note In versions of Windows earlier than Windows Vista, DPInst added the entry for the
driver package or driver package group to Add or Remove Programs in Control Panel.
/se
Sets the suppressEulaPage flag to ON, which configures DPinst to suppress the display
of a EULA page. The suppressEulaPage flag works with the quietInstall flag and the
suppressWizard flag.

/sh
Sets the scanHardware flag to ON, which configures DPInst to install a driver package
for a Plug and Play (PnP) function driver only if the driver package matches a device that
is currently configured in a computer and if the driver package is a better match for the
device than the driver package that is currently installed on the device.
/sw
Sets the suppressWizard flag to ON, which suppresses the display of wizard pages and
other user messages that DPInst generates. The suppressWizard flag works with the
presence of a EULA page and the suppressEulaPage flag.
/u inf-file-path
Configures DPInst to uninstall a driver package whose INF file is specified by inf-file-path.
The path that is specified by inf-file-path is relative to the directory that contains
DPInst.exe.
Examples
The following command includes the /q and /se command-line switches, which configure DPInst
to operate in quiet-install mode, whether a eula XML element is included in a DPInst descriptor
file. This command suppresses all of the wizard pages, user dialog boxes, and other user
messages that DPInst and Windows generate.

Copy
dpinst.exe /q /se

The following command includes the /q command-line switch, which configure DPInst to operate
in quiet-install mode. However, DPInst will operate in quiet-install mode only if a eula XML
element is not included in a DPInst descriptor file. If a eula element is included, DPInst does not
operate in quiet-install mode.

Copy
dpinst.exe /q

The following command includes a /se command-line switch, which suppresses the display of
only the EULA page.

Copy
dpinst.exe /se

The following command includes the /q and /se command-line switches, which configure DPInst
to operate in quiet-install mode, including suppressing the EULA page. The command also
includes the /f command-line switch, which forces the installation of a new driver package for a
device that is configured in a computer, even if the driver package that is currently installed on
the device is a better match for the device than the new driver package.

Copy
dpinst.exe /q /se /f

The following command includes the /sh command-line switch, which configures DPInst to install
a driver package on a device that is configured in a computer only if the new driver package is a
better match for the device than the driver package that is currently installed on the device. This
command facilitates using an installation package to batch install driver packages for devices
that are configured in a computer. Although the installation package might contain a large
number of driver packages, DPInst will install only driver packages that are better matches for
the devices than the driver packages that are currently installed on the devices.

Copy
dpinst.exe /sh

The following command includes the /u command-line switch, followed by the Abc.inf INF file, and
the /d command-line switch. The /u command-line switch uninstalls the driver package that is
associated with the Abc.inf INF file from all of the devices on which the package is installed.
The /d command-line switch deletes the binaries that were copied to the system when the
package was installed and deletes the package from the DIFx driver store. If the driver package is
signed, the corresponding catalog file must be present in the same directory in which Abc.inf is
located.

Copy
dpinst.exe /u abc.inf /d