Windows Driver Kit: Device Installation
Authoring a Windows Installer Installation Package By Using DIFxApp.wixlib
You can use the Windows Installer XML (WiX) toolset version 2 or later to create a Windows Installer installation package that uses DIFxApp to install driver packages. You must know how to create a Windows Installer installation package and how to use the WiX toolset. The WiX toolset is a Microsoft-sponsored community development project that has been released as part of the Microsoft Shared Source Initiative. For more information about the WiX toolset, see the
Windows Installer XML Shared Source Licensing Program Web site. For information about creating Windows Installer installation packages, see “Windows Installer” in the Microsfot Windows SDK documentation.
To author a Windows Installer installation package by using DIFxApp.wixlib and the DIFxApp DLLs, perform the following steps:
- Create a WiX XML source file (for example AbcApp.wxs) that describes the application and associated driver packages. To add a driver package to AbcApp.wxs, include a Component XML element to describe the driver package and set the driver-specific attributes of the Component element that are described in the following list. The presence of at least one of these attributes for a Component element implicitly identifies the component as a DIFxApp-installable driver package. If there is one DIFxApp-installable driver package defined in a WiX XML source file, the link operation that is described in step 3 of this procedure automatically adds the DIFxApp custom actions to the Windows Installer installation file.
- DriverDeleteFiles
- If DriverDeleteFiles is set to "yes", DIFxApp deletes binary files that were copied to the system from the driver store when a driver package was installed. If this attribute is set to "no" or is not present, DIFxApp does not remove these files from the system.
Note that configuring DIFxApp to delete these files is controlled by a corresponding bit in the Flags entry of the component that represents the driver package in the MsiDriverPackages custom table. Setting DriverDeleteFiles to "yes" sets the corresponding bit in the Flags entry and setting DriverDeleteFiles to "no" clears the corresponding bit in the Flags entry. If DriverDeleteFiles is not present, DIFxApp uses a default value of "no".
- DriverForceInstall
- If DriverForceInstall is set to "yes", DIFxApp forces the installation of a Plug and Play (PnP) function driver on a device, even if the driver that is currently installed on the device is a better match than the new driver. If this attribute is set to "no" or is not present, DIFxApp installs a new PnP function driver on a device only if the new driver is a better match than the currently installed driver.
Note that configuring DIFxApp to force an installation of a driver package is controlled by a corresponding bit of the Flags entry for the component that represents the driver package in the MsiDriverPackages custom table. Setting DriverForceInstall to "yes" sets the corresponding bit in the Flags entry and setting DriverForceInstall to "no" clears the corresponding bit in the Flags entry. If this attribute is not present, DIFxApp uses a default value of "no".
- DriverLegacy
- If DriverLegacy is set to "yes", DIFxApp installs unsigned driver packages and driver packages with missing files. For more information about how DIFxApp installs such driver packages, see Installing Unsigned Driver Packages in Legacy Mode. If this attribute is set to "no" or is not present, DIFxApp will install only signed driver packages.
Note that configuring DIFxApp to install unsigned drivers is controlled by a corresponding bit in the Flags entry of the component that represents the driver package in the MsiDriverPackages custom table. Setting DriverLegacy to "yes" sets the corresponding bit in the Flags entry and setting DriverLegacy to "no" clears the bit in the Flags entry. If this attribute is not present, DIFxApp uses a default value of "no".
- DriverPlugAndPlayPrompt
- If DriverPlugAndPlayPrompt is set to "yes", DIFxApp prompts the user to connect a PnP device to a computer if a device that matches a PnP function driver that is being installed is not connected to a computer. If this attribute is set to "no", DIFxApp does not display this message.
Note that displaying this message is controlled by a corresponding bit of the Flags entry for the component that represents the driver package in the MsiDriverPackages custom table. Setting DriverPlugAndPlayPrompt to "yes" clears the corresponding bit in the Flags entry and setting DriverPlugAndPlayPrompt to "no" sets the corresponding bit in the Flags entry. If this attribute is not present, DIFxApp uses a default value of "yes".
- DriverAddRemovePrograms
- If DriverAddRemovePrograms is set to "yes", DIFxApp adds an Add or Remove Programs entry that represents the driver package. If this attribute is set to "no", DIFxApp does not add an Add or Remove Programs entry that represents the driver package.
Note that adding an Add or Remove Programs entry is controlled by a corresponding bit of the Flags entry for the component that represents the driver package in the MsiDriverPackages custom table. Setting DriverAddRemovePrograms to "yes" clears the corresponding bit in the Flags entry and setting DriverAddRemovePrograms to "no" sets the corresponding bit in the Flags entry. If this attribute is not present, DIFxApp uses a default value of "yes".
- DriverSequence
- DriverSequence sets the Sequence entry for the component that represents the driver package in the MsiDriverPackages custom table. If this attribute is not present, DIFxApp uses a default value of zero.
The following code example demonstrates a Component element that sets DriverForceInstall to "no" and DriverSequence to zero. Because DriverPlugAndPlayPrompt and DriverAddRemovePrograms are not present, these attributes are set to "yes" by default.
<Component Id="C__70708CBF27634C5FB5295CDE6954A1BB" Guid="953D30C9-5CCC-D5AE-3AF3-6CF9823200B0" DriverForceInstall="no" DriverSequence="0">
- Use the WiX candle tool to create the AbcApp.wixobj file from the AbcApp.wxs file, the application files, and the driver package files. The following code example demonstrates how to use the WiX candle tool.
candle AbcApp.wxs
- Use the WiX light tool to link AbcApp.wixobj, DIFxApp.wixlib, DIFxApp.dll, and DIFxAppA.dll. The output of the WIX light tool is the Windows Installer installation file for the Abc application. The DIFxApp.wixlib, DIFxApp.dll, and DIFxAppA.dll files must be located in the same directory. The following code example demonstrates how to use the WiX light tool.
light <path>\AbcApp.wixobj <path>\difxapp.wixlib -out <path>\AbcApp.msi
The linking step (step 3) adds the DIFxApp custom actions to the Windows Installer installation file. The DIFxApp.dll and DIFxAppA.dll files are added to the binary table and the custom actions that the two DLLs provide are added to the custom action table. In addition, the MsiProcessDrivers and MsiCleanupOnSuccess custom actions are added to the InstallExecuteSequence table in the correct sequence.