This article details the way to package drivers.
1. Repackaging Method
Generally, a driver contains:
- INF files
- PNF files
- DLL files
- Registry entries in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
It’s possible to make a capture of the installation, but take care of excluded elements after snapshot.
By default, Wise Package Studio excludes registry entries in: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
Those registry entries allow linking INF, PNF and DLL files, so they must be included in the package.
2. Driver Package Installer
Driver Package Installer (DPInst) is a tool provided by Microsoft.
That tool allows installing drivers within a wizard, but accepts silent switch too. At the end of installation, an entry is created in Add/ Remove Programs.
To be installed with DPInst, driver package must contain:
- INF file: the driver installer
- CAT file: the catalog file
To install the driver silently:
- First copy DPInst in the same folder than Driver Package
- Then use the following command: DPInst.exe /S
/c to display the text of log message in the Command Prompt Window
/d to delete binary files that were copied to a system when a Driver Package was installed
/f to install a driver on a device even if the driver is already installed
/? To display help
/lm to accept unsigned driver packages without performing signature verification
/s to install the driver package silently
/sa to suppress Add / Remove Programs entry
/u to uninstall file path
To be installed with DPInst, the driver package publisher must be trusted by Microsoft
3. Adding Publisher Certificate in Trusted Publisher Store
When we launch DPInst.exe to install a driver, the following window may appear:
If the publisher of the driver is not trusted by Microsoft, the driver cannot be installed silently and DPInst.exe command will fail.
In that case, publisher certificate must be first added in trusted publishers’ store before to launch driver installation.
The certificate must be extracted from the catalog file, then added in the trusted publishers’ store using certmgr.exe
Extract the certificate from the cat file
Right-click the cat file then Properties > Digital Signatures
Click View Certificate
On Details tab:
Click Copy to File…
File name: C:\Temp\My Driver.cer
MyDriver.cer is created in C:\Temp
Add certificate and certmgr.exe in Package folder
- Copy MyDriver.cer in the package folder
- Copy certmgr.exe in package folder.
Certmgr.exe is a tool provided by Microsoft to install certificates.
That tool can be downloaded from Microsoft Web site.
Use the following command line to add certificate in trusted publishers’ store:
Certmgr.exe -add PayPen.cer -c -s -r localMachine TrustedPublisher