ContactEZ.net D. G. Schneider Lions Club Volunteer Project

ContactEZ.net

Create CAB files on-the-fly using DDF files

How to create DDF files to output all the necessary CAB for a MSI?
It is pretty simple and straight forward. I do not think I need need to go in details on how to create a text file with VB. But the novice packagers can search for the FileSystemObject in Microsoft help.

Use the Microsoft free MAKECAB.EXE cabinet creation tool to compress the source files into a cabinet file.
The cabinet file(s) can either be in a data stream inside the .msi file or in a separate cabinet file(s) located at the root of the source tree specified in the Directory Table.

If you decide to have the cabinet file(s) in a data stream inside the .msi you will need to use Microsoft tool Msidb.exe.
To add the cabinet file AllFiles.cab to the installation package the command line is:
Msidb.exe -d MyProduct.msi -a AllFiles.cab

Related topics: MSI Automation, MSI Tables Overview, MSI Command Line, Create MSI Tables, MSI UAC VISTA, MSI Error Table, BootStrapper VISTA, MSP VISTA, Install MSI SDK Tools V3.1.4, Create CAB File, Build MSPs, VB Script to Update PCP / MSI

For example lets say you want to create a program.ddf with the goal to create in turn a program.cab file:

Dim TextStreamBatOut
Set TextStreamCABOut = fso.CreateTextFile("Program.ddf")
bla.. bla.. bla..
TextStreamCABOut .Close

Once you know how to create a text file, you can create all the DDF files.
For example lets use the Program.cab built using Program.ddf. The content of the program.DDF should look like:

.Option EXPLICIT
.Set Cabinet = off
.Set Compress = off
.Set MaxDiskSize = CDROM
.Set ReservePerCabinetSize = 6144
.Set DiskDirectoryTemplate = "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\Disk1"
.Set CompressionType = MSZIP
.Set CompressionLevel = 7
.Set CompressionMemory = 21
.Set CabinetNameTemplate = "INSTAL~1.CAB"
.Set Cabinet=on
.Set Compress=on
"C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\SETUP\DSCAN\English\Install\Asrt.DEP" "F1_Asrt.DEP"
"C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\SETUP\DSCAN\English\Install\ASRTPro.exe" "F2_ASRTPro.exe"
"C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\SETUP\DSCAN\English\Install\DSCAN.chm" "F3_DSCAN.chm"
"C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\SETUP\DSCAN\English\Install\Dscan.DEP" "F4_Dscan.DEP"
"C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\SETUP\DSCAN\English\Install\DSCAN.exe" "F5_DSCAN.exe"
.....
....
...keep listing here the files you want to include in the program.cab
..
.

Once all your DDF files are created, create your batch file to output all the necessary CAB files.
Here is an example of a BuildAllCABs.bat

@echo off
ECHO Use this GeoMedia batch file to make new cab files.
ECHO DDF file names are not limited in length.
ECHO CAB file names must not be over 8 characters
ECHO Press CTRL-C to cancel.
Pause
del "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\Disk1\*.CAB"
"MAKECAB.EXE" /f "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\DDF\BIN_1.ddf"
"MAKECAB.EXE" /f "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\DDF\DATABASES_2.ddf"
"MAKECAB.EXE" /f "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\DDF\Install_0.ddf"
"MAKECAB.EXE" /f "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\DDF\NUCLEUS_3.ddf"
"MAKECAB.EXE" /f "C:\dgschnei\Portfolio\Development\dscan_code\Installation\MSI\DSCAN\English\DDF\SYSTEM.DDF"
....
...keep listing here the DDF files you want to use to build all the necessary CAB files
..
.

That it is. You are now creating CAB files on the fly...

Note:
If the separate cabinet files are located at the root of the source tree the media table of the MSI in question will look like:

DiskId LastSequence DiskPrompt Cabinet VolumeLabel Source
i2 i2 L64 S255 S32 S32
Media DiskId 1   DISK1  
1 20 1 INSTAL~1.CAB DISK1  
2 21 1  BIN_1.CAB DISK1  
3 23 1 DATABA~1.CAB DISK1  
4 75 1 NUCLEU~1.CAB DISK1  
5 78 1 SYSTEM.CAB DISK1  

If the cabinet files are located in a data stream inside the .msi the media table of the MSI in question will look like:

DiskId LastSequence DiskPrompt Cabinet VolumeLabel Source
i2 i2 L64 S255 S32 S32
Media DiskId 1   DISK1  
1 78 1 #AllFiles.CAB DISK1  

Notice the before # sign the name of the CAB file indicating that it is inside the .msi not at the root of the source tree.

About Dominique Gérard Schneider since 1995 - Developing solutions that really help!
Participation on Google
ContactEZ.net on YouTube

Tek-Tips Forums dgschnei
Listed since 1996 ixquick
Community Services

platform sdk dgschnei
Cooperation
About Me

Return Home - Index