Inno Setup Source Code

repository·main·Indexed 26 days ago

https://github.com/jrsoftware/issrc

Source code for the Inno Setup professional installer creation scripting system. Includes the compiler (ISCmplr), IDE (ISIDE), command-line front-end (ISCC), setup engine (Setup), preprocessor (ISPP), and the UniPs component based on RemObjects Pascal Script. Provides documentation on building the ecosystem using Delphi 12.3 Athens, configuring compiler defines for the Pascal Script environment, and debugging the setup and uninstaller projects.

Tokens
2.5K
Snippets
4
Records
13
Agent score
91%

What's inside issrc

  1. Overview of Inno Setup Projects

    main

    Inno Setup is composed of several key projects:

    • ISIDE: The GUI front-end (Compiler IDE). It acts as a text editor and delegates compilation to ISCmplr.dll.
    • ISCC: The command-line front-end to the compiler.
    • ISCmplr: A DLL loaded by ISIDE and ISCC to perform the actual script compilation. The core logic resides in Compiler.SetupCompiler.pas.
    • ISPP: A DLL implementing the Inno Setup preprocessor interface.
    • Setup: The main program that displays the installation wizard and performs installation/uninstallation tasks.
    • SetupCustomStyle: A version of Setup that includes support for VCL Styles.
    • SetupLdr: The setup loader that self-extracts the Setup program into the TEMP directory.
    • ISSigTool: A command-line utility for signing and verifying files (used by ISIDE, ISCC, and ISCmplr to verify authenticity).
    • ISTestTool: An internal command-line utility for running unit tests.
  2. Understand the RemObjects Pascal Script environment in Inno Setup

    main

    The UniPs component is a copy of the RemObjects Pascal Script repository, stripped of unused files and optimized for Inno Setup. When working with this component, be aware that many compiler directives found in the original source are either always true or always false due to Inno Setup's specific build environment (Delphi 10.4+ on Windows).

    Key Environment Characteristics

    • Compiler: Uses Delphi (not FPC).
    • Platform: Windows only.
    • Architecture: Supports both 32-bit (CPU32) and 64-bit (CPU64) builds.
    • Unicode: Always enabled.
    • Endianness: Always little-endian.
  3. Build Inno Setup Projects

    main

    Build methods depend on whether you are using the Delphi Community Edition (which lacks command-line compilation support) or a full version of Delphi.

    For Delphi Community Edition

    To build all files in Release mode, run:

    build-ce.bat

    Note: Batch files cannot be used with the Community Edition; instead, open Projects\Projects.groupproj in the Delphi IDE.

    For Full Delphi Versions

    To build all files in Release mode, run:

    build.bat

    Specific Compilation Tasks

    • 64-bit Inno Setup (Release mode): compile.bat x64
    • 32-bit Inno Setup (Release mode): compile.bat x86
    • Specific Project (e.g., ISCC): compile.bat x64 ISCC
    • Help Files (64-bit): compile.bat x64 ISHelpGen and ISHelp\compile.bat

    Note: Batch files are not compatible with the Community Edition; use Projects\Projects.groupproj for that version.

    build-ce.bat
    # or
    build.bat
    # or
    compile.bat x64 ISCC
  4. Debug the Setup and SetupLdr Projects

    main

    Debugging the Setup Project

    1. Build the Debug64 build group.
    2. Run the ISIDE project and compile the Debug.iss script (which should open automatically).
    3. Open and run the Setup project. Note: Ensure the SetupArchitecture setting in the test script matches the target of the Setup project.

    Debugging the SetupLdr Project

    1. Build the Debug64 build group.
    2. Compile the Debug.iss script with UseSetupLdr=yes (instead of no).
    3. Open and run the SetupLdr project with a 32-bit or 64-bit target. Note: It will automatically use the /SELFFILENAME=Setup.exe parameter to load the Setup.exe you compiled via ISIDE.
  5. Install Inno Setup Component Units

    main

    If you intend to view or modify the forms for specific projects, you must install the required component units found in the [Components] directory using the Components.dpk file.

    For the Setup project forms:

    • BitmapButton
    • BitmapImage
    • FolderTreeView
    • NewCheckListBox
    • NewCtrls
    • NewNotebookReg
    • NewProgressBar
    • NewStaticText
    • PasswordEdit
    • RichEditViewer

    For the ISIDE project forms (additional):

    • DropListBox
    • NewGroupBox
    • NewTabSet

    If you are only editing code, you can skip this installation step.

  6. Get Started with Inno Setup Source Code

    main

    To begin working with the Inno Setup source code, follow these steps:

    1. Obtain sources: Clone the repository from GitHub.
      git clone https://github.com/jrsoftware/issrc.git issrc
      cd issrc
    2. Install Embarcadero Delphi: The projects are compiled using Delphi 12.3 Athens with the May Patch. You can use the free Community Edition. After installing Delphi, you must install GetIt dependencies by running getit.bat and following the instructions.
    3. Install Microsoft HTML Help Workshop: This is required only if you need to compile the help files.
    git clone https://github.com/jrsoftware/issrc.git issrc
    cd issrc
  7. Debug the Uninstaller

    main

    To debug the uninstaller, follow these steps:

    1. Run Setup.exe to completion using the /DETACHEDMSG command-line parameter.
    2. Copy uninst000.dat and uninst000.msg to the [Projects\Bin] directory in your issrc path, renaming them to setup.dat and setup.msg respectively.
    3. Open the Setup project.
    4. Set the command-line parameters to: /UNINSTMODE /KEEPEXEDATMSG "/SECONDPHASE=<your issrc path\Projects\Bin\Setup.exe"
    5. Start debugging.
    /UNINSTMODE /KEEPEXEDATMSG "/SECONDPHASE=<your issrc path\Projects\Bin\Setup.exe"
  8. Reference compiler defines set by Inno Setup

    main

    When compiling units within the UniPs component, Inno Setup defines the following symbols to configure the Pascal Script behavior:

    DefineMeaning
    PS_MINIVCLMinimal VCL mode: excludes large VCL registration blocks
    PS_NOGRAPHCONSTExcludes graphics color constants, computes them instead
    PS_PANSICHARMaps PChar parameters to PAnsiChar in script declarations
    PS_NOINTERFACEGUIDBRACKETSInterface GUIDs are not enclosed in brackets
  9. Reference x64-specific compiler symbols

    main

    In 64-bit builds, when uPSRuntime.pas includes x64.inc, the following symbols are defined (these are specific to x64 and are not x86 symbols):

    SymbolWhy defined in x64 builds
    PS_RESBEFOREPARAMETERSDefined inside {$IFDEF DELPHI} in x64.inc
    x64_string_result_as_varparameterDefined inside {$IFDEF DELPHI} in x64.inc
    REG_STACK_PTR_OFFSET0Defined inside {$IFDEF DELPHI} + {$IFDEF WINDOWS} in x64.inc
  10. Identify varying compiler symbols in UniPs

    main

    While many symbols are fixed due to the Inno Setup environment, the following symbols vary depending on the build configuration or compiler version:

    SymbolWhy it varies
    CPU64 / CPU32Both 32-bit and 64-bit builds are supported
    CPUX64 / Win32 / Win64Same
    DELPHI28UP and aboveDepends on the Delphi version used to compile
  11. Reference compiler defines set by PascalScript.inc

    main

    The PascalScript.inc file (included in every unit) normalizes symbols based on the compiler version. The following are always true in Inno Setup:

    DefineConditionAlways true in IS?
    PS_HAVEVARIANTDELPHI4UPYes
    PS_DYNARRAYDELPHI4UPYes
    DEBUGExplicitly {$UNDEF}'dAlways false
  12. Reference compiler defines NOT set by Inno Setup

    main

    The following symbols are not defined in the Inno Setup environment. Consequently, {$IFDEF X} blocks for these symbols are dead code, and {$IFNDEF X} blocks are active:

    DefineWhat it would enable
    PS_USESSUPPORTUses-clause tracking in the compiler
    PS_DELPHIDIVAlternative integer division behavior
    PS_NOINT64Disables Int64 support
    PS_NOWIDESTRINGDisables WideString support
    PS_NOINTERFACESDisables COM interface support
    PS_NOIDISPATCHDisables IDispatch support
    PS_NOSMARTLISTDisables smart list optimization
    PS_NOSTANDARDTYPESDisables standard type registration
    PS_STACKALIGNStack alignment (FPC only)
    PS_ARRAY_ON_STACKArray-on-stack passing (FPC only)
    PS_FPCSTRINGWORKAROUNDFPC string workaround