Windows 7 Driver Repack 7z SFX install silent

Jump to navigation Jump to search

In this example will repack the Zebra printer drivers, for Win7 x64, in Ubuntu 12.04, using 7zip SFX and an auto installer.

Extract the files

Starting with DZ8CG.

The easiest way to get the drivers out is simply installing it in a windows VM, the drivers get put in C:\Program Files (x86)\Zebra ZMotif along with some other guff like 'ZXPToolBox' and the 'i386' folder (am interested only in x64).

By looking at the .inf files [SourceDisksFiles] section you can see what files are needed and what are not. In this example the main Zebra drivers are in the root of above, see ZMotif.inf and the contactless smart card bits in a sub folder \smart\, s331di2k.inf and s331dicl.inf. I removed the network port monitor ZMotifPortMon.inf as it has no .cat file and also appears to be 32bit only.

  • If you remove/replace/resize/change a file that the .inf references, you will break the driver signing, so be careful. Don't think it would be good to shrink the .bmp's for example or replace with 1 pixel files!
  • It is ok to remove the i386 folder without breaking the signing as I am only pre installing the x64 drivers.
  • It may be easier to preinstall the drivers with all the guff present, then take the used bits from C:\Windows\System32\DriverStore\FileRepository\xxxx

This is what you should end up with, with the guff removed, and the 32x bit drivers also. I moved everything left into a new folder called 'drivers'.

├── bc_128_C.bmp
├── Front_Hologram_Inhibit.bmp
├── Front_Hologram_Inhibit_Portrait.bmp
├── Mag_Signature_Inhibit.bmp
├── Mag_Signature_Inhibit_Portrait.bmp
├── magstripe.bmp
├── magstripe_portrait.bmp
├── smart
│   ├── CMTCT32.SYS
│   ├── CMTCT64.SYS
│   ├── DICLx64.sys
│   ├── DISCx64.sys
│   ├── ePass2K.SYS
│   ├── EPCLx64.SYS
│   ├── EPSCx64.SYS
│   ├── S331DI2K.CAT
│   ├── S331DI2K.INF
│   ├── S331DI2K.sys
│   ├── S331DICL.CAT
│   ├── S331DICL.INF
│   ├── S331DICL.sys
│   ├── SDI0102K.sys
│   ├── SDICLx64.SYS
│   └── SDISCx64.SYS
├── smartcard_4428.bmp
├── smartcard_4428_portrait.bmp
├── smartcard_4442.bmp
├── smartcard_4442_portrait.bmp
├── x64
│   ├── AreaManager.dll
│   ├── dbghelp.dll
│   ├── ZMotifDDM.dll
│   ├── ZMotifDrv.dll
│   ├── ZMotifLM.dll
│   ├── ZMotifPM.dll
│   ├── ZMotifPMUI.dll
│   ├── ZMotifRes.dll
│   ├── ZMotifUI.dll
│   ├── ZMotifZMJ.dll
│   ├── ZSATAuthenEncDec.dll
│   ├── ZXPNotify.dll
│   └── ZXPNotify.exe
├── ZMotifDDM.xml
├── ZMotif.inf
├── ZXP Landscape Back.bmp
├── ZXP Portrait test card Back.bmp
├── zxp_series8.chm
├── ZXP Series 8 Test Card Landscape Front.bmp
└── ZXP Series 8 Test Card Portrait Front.bmp

Get the SFX installer stubs


We need Ubuntu p7zip package AND the Windows installer SFX stubs.

sudo apt-get install p7zip-full
wget -P /tmp/

Extract the 4 x 7zS* files from 7z920_extra.7z to /usr/lib/p7zip (needs sudo for write). You can rename them if you wish to whatever in this folder.

7z x /tmp/7z920_extra.7z 7zS*
sudo cp /tmp/7zS* /usr/lib/p7zip

Ending up with this,

  • Note the 7zCon.sfx will be ELF unix binaries and the copied in ones like 7zS2con.sfx will be win x32 binaries
drwxr-xr-x   2 root root    4096 Jul 31 16:10 .
drwxr-xr-x 201 root root   36864 Jul 31 15:00 ..
-rwxr-xr-x   1 root root  446664 Feb 17 20:08 7z
-rwxr-xr-x   1 root root 1188120 Feb 17 20:08 7za
-rwxr-xr-x   1 root root  396976 Feb 17 20:08 7zCon.sfx
-rwxr-xr-x   1 root root  788760 Feb 17 20:08 7zr
-rw-r--r--   1 root root   27648 Jul 31 16:10 7zS2con.sfx
-rw-r--r--   1 root root   27648 Jul 31 16:10 7zS2.sfx
-rw-r--r--   1 root root  105472 Jul 31 16:10 7zSD.sfx
-rw-r--r--   1 root root 1743568 Feb 17 20:08
-rw-r--r--   1 root root  140288 Jul 31 16:10 7zS.sfx


Alternatively if in Win7

Get the main 7zip

Get the addons and extract to the folder 7zip went into (C:\Program Files (x86)\7-Zip)

DPInst Files

Create the "Installer" file dpinst.txt

This just needs to be in the archive somewhere, 7-zip DOCS are here

RunProgram runs from wherever the archive extracted to (%tmp%\dpinst64.exe in this example). As the dpinst.xml is there too no further switches are needed.



See for more info

<?xml version="1.0"?>


This is just the renamed 64bit version of dpinst.exe

Create the .exe

In this info from the readme, "installers" = for using an installer text file to do something after extracting from the SFX.

module function
7zS.sfx SFX module for installers
7zSD.sfx SFX module for installers (uses msvcrt.dll)
7zS2.sfx small SFX module (GUI version) (uses msvcrt.dll)
7zS2con.sfx small SFX module (Console version) (uses msvcrt.dll)

This will create drivers.exe in the current directory, packing everything in /drivers and dpinst.txt and dpinst64.exe and dpinst.xml. (The drivers folder will remain a sub directory and the dpinst* files will be in the root of the archive)

Prefix -sfx with the name of the file you want to add as the executable stub, in this case the small console based stub 7zS2con.sfx, (which should exists in /usr/lib/7zS2con.sfx in Ubuntu)

$ 7z a -sfx7zS2con.sfx drivers.exe dpinst* drivers/
7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

Creating archive drivers.exe

Compressing  drivers/zxp_series8.chm      
Compressing  drivers/bc_128_C.bmp      
Compressing  drivers/Front_Hologram_Inhibit.bmp      
Compressing  drivers/Front_Hologram_Inhibit_Portrait.bmp      
Compressing  drivers/magstripe.bmp      
Compressing  drivers/magstripe_portrait.bmp      
Compressing  drivers/Mag_Signature_Inhibit.bmp      
Compressing  drivers/Mag_Signature_Inhibit_Portrait.bmp      
Compressing  drivers/smartcard_4428.bmp      
Compressing  drivers/smartcard_4428_portrait.bmp      
Compressing  drivers/smartcard_4442.bmp      
Compressing  drivers/smartcard_4442_portrait.bmp      
Compressing  drivers/ZXP Landscape Back.bmp      
Compressing  drivers/ZXP Portrait test card Back.bmp      
Compressing  drivers/ZXP Series 8 Test Card Landscape Front.bmp      
Compressing  drivers/ZXP Series 8 Test Card Portrait Front.bmp      
Compressing  dpinst.xml      
Compressing  drivers/ZMotifDDM.xml      
Compressing  dpinst.txt      
Compressing  drivers/x64/ZXPNotify.exe      
Compressing  drivers/x64/AreaManager.dll      
Compressing  drivers/x64/dbghelp.dll      
Compressing  drivers/x64/ZMotifDDM.dll      
Compressing  drivers/x64/ZMotifDrv.dll      
Compressing  drivers/x64/ZMotifLM.dll      
Compressing  drivers/x64/ZMotifPM.dll      
Compressing  drivers/x64/ZMotifPMUI.dll      
Compressing  drivers/x64/ZMotifRes.dll      
Compressing  drivers/x64/ZMotifUI.dll      
Compressing  drivers/x64/ZMotifZMJ.dll      
Compressing  drivers/x64/ZSATAuthenEncDec.dll      
Compressing  drivers/x64/ZXPNotify.dll      
Compressing  drivers/smart/CMTCT32.SYS      
Compressing  drivers/smart/CMTCT64.SYS      
Compressing  drivers/smart/DICLx64.sys      
Compressing  drivers/smart/DISCx64.sys      
Compressing  drivers/smart/ePass2K.SYS      
Compressing  drivers/smart/EPCLx64.SYS      
Compressing  drivers/smart/EPSCx64.SYS      
Compressing  drivers/smart/S331DI2K.sys      
Compressing  drivers/smart/S331DICL.sys      
Compressing  drivers/smart/SDI0102K.sys      
Compressing  drivers/smart/SDICLx64.SYS      
Compressing  drivers/smart/SDISCx64.SYS      
Compressing  drivers/smart/S331DI2K.CAT      
Compressing  drivers/smart/S331DICL.CAT      
Compressing  drivers/      
Compressing  drivers/smart/S331DI2K.INF      
Compressing  drivers/smart/S331DICL.INF      
Compressing  drivers/ZMotif.inf      
Compressing  dpinst64.exe      

Everything is Ok

$ file drivers.exe
drivers.exe: PE32 executable (console) Intel 80386, for MS Windows

  • Note, this has created a Windows executable as the executable stub used was a windows one.


Running drivers.exe on a Win7 machine should automatically extract files to user temp folder, run dpinst64.exe that reads the dpinst.xml and preinstall all the drivers, (as you can see in DPINST.LOG)

  • Check c:\windows\DPINST.LOG
INFO:   ****************************************
INFO:   07/31/2012 15:47:14
INFO:   Product Version
INFO:   Version: 6.0.6000 
INFO:   Platform ID: 2 (NT)
INFO:   Service Pack: 0.0
INFO:   Suite: 0x0100, Product Type: 1
INFO:   Architecture: AMD64.
INFO:   Interactive Windows Station
INFO:   Command Line: 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC\dpinst64.exe '
INFO:   DPInst is not multi-lingual.
INFO:   ****************************************
INFO:   Current working directory: 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC'
INFO:   Running on path 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC'
INFO:   DPInst.xml does not list the current UI language.
INFO:   User UI Language is 0x409.
INFO:   Install option set: Suppressing Wizard but no OS popups.
INFO:   Install option set: Running in quiet mode. Suppressing Wizard and OS popups.
INFO:   Install option set: legacy mode on.
INFO:   Found driver package: 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC\drivers\ZMotif.inf'.
INFO:   Found driver package: 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC\drivers\smart\S331DI2K.INF'.
INFO:   Found driver package: 'C:\Users\ADMINI~1\AppData\Local\Temp\7zD29857AC\drivers\smart\S331DICL.INF'.
INFO:   Preinstalling 'c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\zmotif.inf' ...
INFO:   ENTER:  DriverPackagePreinstallW
SUCCESS:c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\zmotif.inf is preinstalled.
INFO:   RETURN: DriverPackagePreinstallW  (0x0)
INFO:   ENTER:  DriverPackageGetPathW
INFO:   RETURN: DriverPackageGetPathW  (0x0)
INFO:   Preinstalling 'c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\smart\s331di2k.inf' ...
INFO:   ENTER:  DriverPackagePreinstallW
SUCCESS:c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\smart\s331di2k.inf is preinstalled.
INFO:   RETURN: DriverPackagePreinstallW  (0x0)
INFO:   ENTER:  DriverPackageGetPathW
INFO:   RETURN: DriverPackageGetPathW  (0x0)
INFO:   Preinstalling 'c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\smart\s331dicl.inf' ...
INFO:   ENTER:  DriverPackagePreinstallW
SUCCESS:c:\users\admini~1\appdata\local\temp\7zd29857ac\drivers\smart\s331dicl.inf is preinstalled.
  • Check C:\Windows\System32\DriverStore\FileRepository for preinstalled folders containing the drivers for each hardware item
C:\Windows\System32\DriverStore\FileRepository>dir /b /o:-d

Silent install

Can easily run the drivers.exe locally with no prompts to pre-install the drivers or run it with psexec on a remote machine;

psexec -c \\remotemachine drivers.exe


blog comments powered by Disqus