Installing multiple CAB files with the same setup application

Alexandru Balut (delsyne.ro!aleb), February 28, 2003.

Introduction

This articles describes how to create desktop installation program that installs multiple CAB files to Pocket PC using freeware NSIS.

Once you have the CAB file generated by cabwiz, and it's ini file, it is easy to make a setup application that displays a readme text and a licence, and installs it on the pocketpc; for example using EzSetup 2.0.

What You Need

Using NSIS

If you need to install, with only one setup application, two or more CAB files (for example a CAB file containing your Java application and a CAB containing the JVM), or if you need a setup application with extended functionality, you can use Nullsoft Install System - NSIS http://www.nullsoft.com/free/nsis/. Both EzSetup and NSIS are freeware.

To use NSIS for making a setup application, you need a .nsi file. The nsi file included in the provided sample allows you to make a setup that installs two CAB files. It first displays a eula.txt; after the user agrees with it, it allows the user to deselect the installation of the second app. Then it copies the files and installs the CABs using CeAppMgr. At the end, it asks the user to open readme.html, using the default browser.

To install a CAB file on the pocketpc, for example YourApp.cab, the setup application has to start CeAppMgr.exe, passing as parameter the absolute path to the YourApp.ini file that is required by CeAppMgr.

To accomplish this, the setup application has to read the location of CeAppMgr.exe, from the registry:

ReadRegStr $1 HKEY_LOCAL_MACHINE "software\Microsoft\Windows\CurrentVersion\App Paths\CEAppMgr.exe" ""

Installing the CAB becomes as simple as:

StrCpy $0 "$INSTDIR\YourApp.ini" Call InstallCAB

where InstallCAB is:

Function InstallCAB ExecWait '"$1" "$0"' FunctionEnd

Sample

You can download a sample NSIS project for multiple CAB installation here - MultiCabInstallation.zip (200 Kb). To build the sample setup application, install NSIS, right-click on test.nsi, click Compile NSI.

Related resources: