Wednesday, March 15, 2006

Alex Fedotov.com - Creating Self-Installing Packages

Alex Fedotov.com - Creating Self-Installing Packages

Self-installing packages usually consist of a small launcher application and an archive that contains the main installer and application components to be installed. The launcher extracts the archive into a temporary directory, runs the main installer, waits for its completion and then deletes temporary files. The launcher must be small and it has to run on any version of Windows.

This article focuses on creating of the self-installing package launcher. It does not explain how to create the main installer. You can use one of commertial packages such as InstallShield for that purpose, or you can write your own installer. This is entirely up to you.

Composing a Self-Installing Package

The first thing we have to decide is which compression algorithm to use. Another question is how to combine the launcher and the archive into a single piece. Remember, we want the launcher to be as small as possible, so an ideal solution would be to use a compression scheme which is already built into the operating system. Windows cabinet files provide reasonably good compression and can be easily expanded using the SetupIterateCabinet function, which we will describe later in this article.

To create a cabinet file you can use the cabarc utility, which is shipped with the Platform SDK. Using this utility is pretty straightforward, just run it without arguments to see the list of available options: