Much of this information is in pulled directly from the Inno Setup Installation Order page on the web. I wanted to add a bit of additional information regarding when Inno calls pre-defined Pascal scripts. My comments are in yellow and I have added function/procedure definitions where applicable.
Installation Order
Once the actual installation process begins, this is the order in which the various installation tasks are performed.
- Calls optional
[Code]
functionInitializeSetup()
where user can cancel installation.- Called during Setup’s initialization. Return False to abort Setup, True otherwise.
- Variable
{app}
is not available yet.
- Calls optional
[Code]
procedureInitializeWizard()
.- Use this event function to make changes to the wizard or wizard pages at startup. You can’t use the
InitializeSetup()
event function for this since at the time it is triggered, the wizard form does not yet exist. - Variable
{app}
is not available yet.
- Use this event function to make changes to the wizard or wizard pages at startup. You can’t use the
- If
CloseApplications
was set to yes, Setup closes applications using files that need to be updated.- Calls optional
[Code]
functionPrepareToInstall()
. This function is called before Setup checks for files being in-use if CloseApplications is set to yes.
- Calls optional
[InstallDelete]
is processed.- The entries in
[UninstallDelete]
are stored in the uninstall log (which, at this stage, is stored in memory). - The application directory is created, if necessary.
- Presumably, variable {app} is variable is defined here.
[Dirs]
is processed.- A filename for the uninstall log is reserved, if necessary.
[Files]
is processed. (File registration does not happen yet.)- Calls optional
[Code]
functions specified byBeforeInstall
andAfterInstall
for each item.
- Calls optional
[Icons]
is processed.[INI]
is processed.[Registry]
is processed.- Files that needed to be registered are now registered, unless the system needs to be restarted, in which case no files are registered until the system is restarted.
- The
Add/Remove Programs
entry for the program is created, if necessary. - The entries in
[UninstallRun]
are stored in the uninstall log. - The uninstaller EXE and log are finalized and saved to disk. After this is done, the user is forbidden from cancelling the install, and any subsequent errors will not cause what was installed before to be rolled back.
[Run]
is processed, except for entries with the postinstall flag, which get processed after the Setup Completed wizard page is shown.- Calls optional
[Code]
functions specified byBeforeInstall
andAfterInstall
for each item.
- Calls optional
- If
RestartApplications
was set to yes, Setup restarts closed applications which support being restarted. - If
ChangesAssociations
was set to yes or to a boolean expression evaluating to True, file associations are refreshed now. - If
ChangesEnvironment
was set to yes or to a boolean expression evaluating to True, other applications are notified at this point.
All entries are processed by the installer in the order they appear in a section.
Changes are undone by the uninstaller in the opposite order in which the installer made them. This is because the uninstall log is parsed from end to beginning.
BeforeInstall and AfterInstall Parameters
During the processing of many of the sections, Inno allows you to add custom code. It can either be custom Pascal code in the [Code] section or a support function (such as Log(‘some message’). According to site documentation, the parameters “are supported by all sections whose entries are separated into parameters except for [Languages], [Types], [Components] and [Tasks].” I have not annotated all the locations where you can use BeforeInstall/AfterInstall in the prior section.