How to Extract and Modify Inno Setup Installers

Tips & Tricks, , , With 2 comments

Many applications use Inno Setup as their installer format. Extracting and modifying these kind of installers if fairly easy if you know a few things.

I will show you how to extract, modify and recompile an application that uses Inno as its installer.

In this case, I’m going to customize Freemake Video Converter to delete some shortcuts and to avoid the installation of Firefox and Google Chrome extensions. This is being made to suit my personal needs. You may want to keep shortcuts or preserve the extensions. It’s up to you.

Extracting the files

The first thing to do in order to edit the installation files is to extract the files. For this, I use Universal Extractor, which can be downloaded in the Custom Installers downloads page. My installer always includes the latest version of Innounp, which needs to be updated from time to time when new versions of Inno Setup are used in the installer you want to modify.

Extracting the files

Open Universal Extractor and select the installer you want to extract and the folder you want to use. After that, you will have a hierarchy like this in Windows Explorer:

Folder hierarchy

Editing the ISS script

The .iss file is the Inno Setup script. To edit this file you need to install Inno Setup, which comes with its own script editor. This same editor will be used to compile the new installer at the end of the tutorial. I prefer to edit the scripts in Notepad++, my favorite text editor. Download my custom installer here.

Open the .iss file in either Inno Setup or any other text editor.

ISS script

The first thing I do is to set an Icon file for the new setup instead of the default one. To define a new icon file, you need the SetupIconFile command and the path to the .ico file you want to use. This command needs to be placed in the [Setup] section. Freemake uses their own icon, and it’s located inside the Uninstall folder. You can use another one, just make sure to use a fully qualified path to it.

This is how it should look after an icon is set to be used by the compiler:

[Setup]
AppName=Freemake Video Converter
AppVersion=4.0.2
DefaultDirName={pf}\Freemake
DefaultGroupName=Freemake
UninstallDisplayIcon={app}\Freemake Video Converter\Uninstall\icon.ico
; Using an icon for the setup file
SetupIconFile={app}\Freemake Video Converter\Uninstall\icon.ico
UninstallFilesDir={app}\Freemake Video Converter\Uninstall
OutputBaseFilename=Freemake Video Converter 4.0.2.9
Compression=lzma2
DisableProgramGroupPage=yes
WizardImageFile=embedded\WizardImage.bmp
WizardSmallImageFile=embedded\WizardSmallImage.bmp

You can read how to modify other things and learn about variables here. I’m editing this application to remove shortcuts and browser extensions only, but feel free to customize anything else if you want.

The next step is to edit the MinVersion variable. As this variable is set for every file in the installer, I will use Find & Replace in Notepad++ to quickly edit all the lines.

Replacing text

Make sure you replace MinVersion: 0.0,5.01.2600 Service Pack 2 with MinVersion: 0.0,5.1.2600 or the compiler will throw an error when compiling your installer.

This particular application uses a variable to set its interface language. As I want it to be shown in Spanish regardless of the language of the computer is it being installed on, I will edit the GetLang function in the [Registry] section. After poking around in the Windows registry, I found that Freemake uses en-US, es-ES and strings like this to set its language. If you don’t modify this entry in the .iss file, you will need to make a script to set it, which is something I will not cover here, or you will see an error while compiling because a script is needed.

Replace this function with the language you want.

[Registry]
Root: HKCU; Subkey: "Software\Freemake\FreemakeVideoConverter"; ValueName: "Culture"; ValueType: String; ValueData: "es-ES"; MinVersion: 0.0,5.1.2600;

To prevent the browser extensions from being installed you need to delete the following lines.

[Registry]
Root: HKLM; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "fmconverter@gmail.com"; ValueType: String; ValueData: "{app}\Freemake Video Converter\BrowserPlugin\Firefox\"; Check: "isInstallBrowserPluginsCheckboxChecked"; MinVersion: 0.0,5.01.2600 Service Pack 2; Flags: uninsdeletevalue
Root: HKLM; Subkey: "Software\Google\Chrome\Extensions\jbolfgndggfhhpbnkgnpjkfhinclbigj"; ValueName: "path"; ValueType: String; ValueData: "{app}\Freemake Video Converter\BrowserPlugin\Chrome\Freemake.Plugin.Chrome.crx"; Check: "isInstallBrowserPluginsCheckboxChecked"; MinVersion: 0.0,5.01.2600 Service Pack 2; Flags: uninsdeletevalue
Root: HKLM; Subkey: "Software\Google\Chrome\Extensions\jbolfgndggfhhpbnkgnpjkfhinclbigj"; ValueName: "version"; ValueType: String; ValueData: "1.0.0"; Check: "isInstallBrowserPluginsCheckboxChecked"; MinVersion: 0.0,5.01.2600 Service Pack 2; Flags: uninsdeletevalue

I don’t need a shortcut on the desktop or one to uninstall the application. I will just leave one inside a Freemake folder under All programs in the Start Menu. Delete all the shortcuts you don’t want. This is how my [Icons] section looks like.

[Icons]
Name: "{group}\{cm:YTP}"; Filename: "{app}\Freemake Video Converter\FreemakeVideoConverter.exe"; WorkingDir: "{app}\Freemake Video Converter"; MinVersion: 0.0,5.1.2600;

Many installers show checkboxes to perform different actions like running the installed application, placing a desktop shortcut etc. In this case, I will remove two checkboxes to prevent an error in the compiler. This needs to be done because I would need to define functions for these checkboxes to work but as I’m running it with silent switches, I don’t need them.

Search for the Check variable and delete all the entries found. In this case, there are only two. Delete the Check: “isStatCheckBoxChecked”; and Check: “not isStatCheckBoxChecked”; entries.

Compiling a new installer

To make a new installer, you need to compile it using the edited script file. To do this, open the file in Inno Setup editor (if you used another editor, like me) and click the Compile button in the main toolbar. This command is also located in the Build menu.

Compiling the script

The new installer will be saved inside the Output folder. You can run it with /silent /norestart switches or by double clicking the setup file.

If you have any doubts, read the Inno Setup Help referenced earlier or post a comment and I will do my best to answer any questions you may have.