InstallSite Documentation for InstallShield 6

Avoid Maintenance Mode in IS6

Note: InstallShield Professional 7 has built in support for multiple instances, so the description below does not apply to the new version.

InstallShield enters maintenance mode if an uninstall entry exists in registry at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{...GUID ...}

There are situations where you don't want your setup to display the Modify/Repair/Remove dialog, e.g. to install an update. Depending on your requirements, there are some options to handle this situation:

Update or Maintenance Mode Depending on Version Number

Take a look at the Update/Maintenance Pack samples that are available at http://support.installshield.com/download/is6samples.asp. If setup starts in maintenance mode, they compare the version that is currently being installed against the existing version. If they are identical, they show the maintenance GUI. If the version currently being installed is newer, they don't display a setup type or component selection dialog, but simply reinstall.

Remove from Control Panel, Reinstall from Setup.exe

If setup.exe is started by itself, all components are re-installed (repair or update), but if called from the Add/Remove control panel, your application will be uninstalled instead. Uninstallation is handled by passing the UNINSTALL parameter to the setup.exe command line along with the -s for silent execution as shown below:
"\\computer name\share name\folder name\Setup.exe" UNINSTALL -s
A single response file will now handle both installation and uninstallation.

Note that the modifications described here assume that the script was created with InstallShield's Project Wizard.

1. Modify the uninstall string by adding the code shown below at the end of the OnBegin event handler. The code to insert depends on your InstallShield version.

For IS 6.0x, 6.1x and 6.20:

if ( !MAINTENANCE ) then
    UNINSTALL_STRING = UNINSTALL_STRING + "UNINSTALL";
endif;

For IS 6.21 and above:

UNINSTALL_STRING = UNINSTALL_STRING + "UNINSTALL";

2. Overwrite the OnMaintUIBefore function entirely with the code below:

    function OnMaintUIBefore()
    begin
        SetStatusWindow(0, "");
        Enable(STATUSEX);
        StatusUpdate(ON, 100);
        if (CMDLINE % "UNINSTALL") then
            ComponentRemoveAll();
        else
            ComponentReinstall();
        endif;
    end;

3. Overwrite the OnMaintUIAfter function entirely with the code below:

    function OnMaintUIAfter()
    begin 
        OnFirstUIAfter();
        return 0;
    end;

4. In the OnFirstUIAfter function replace the line
    szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
   with this code:

    if ((MAINTENANCE) && (CMDLINE % "UNINSTALL")) then
        szMsg1 = "Setup has finished uninstalling %P.";
    else
        szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
    endif;

Written by Jim Harding, modified by Stefan Krueger and Betsy Walker
Last update: 2001-02-08

Create Unique Uninstall Entries on the Fly

This extension allows for multiple installations of one product (with identical GUID) onto the same machine. This extension handles the renaming of the GUID directories back and forth between the actual PRODUCT_GUID and the instance GUID. This can't be done from within your setup script, because the uninstall enty can't be renamed while setup is running. Therefore this wrapper was created to perform the renaming.

Usage instructions are included in the package.

ZIP guid.zip   Written by EONS, Inc.
File size: 35.906 bytes   Last update: 2001-10-03

WWW Documentation about the GUID tool can be found on the EONS homepage

Don't Create an Uninstall Registry

You can abandon maintenance mode at all by deleting or not installing InstallShield's support files and the uninstall registry entry. There will be no entry in the Add/Remove Programs control panel applet. To do this, add the following line to your OnMoving event handler:

    ComponentSelectItem(MEDIA, "Disk<1>", FALSE);

Disk<1> is a invisible component that is automatically added to your media by IS6. This component encapsulate all files that are copied to InstallShield Installation Information\{GUID} folder as well as registry entries associated with uninstallation. You must be aware however that if this component is not installed you won't be able to uninstall the files that setup will transfer. Also if your setup requires a reboot, setup will not resume after the reboot, which means that no self registration will be performed if BATCH_INSTALL=TRUE and the OnRebooted event handler will not be called.

As an alternative, you can add these lines to the OnEnd() event handler:

    if ( !BATCH_INSTALL ) then
        RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
        RegDBDeleteKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + PRODUCT_GUID);
        DeleteDir( DISK1TARGET, ALLCONTENTS );
    endif;

This will delete the uninstall entry at the end of the first time install. If a reboot is required, the support uninstall key and support file will not be deleted, because they are required for post-boot self-registration.

Remove Uninstall Registry Entry When Your Update Installer is Launched

With this method, users can still enter maintenance mode from the Add/Remove control panel, e.g. to uninstall your application. Before your setup runs a second time, use a stub program to delete the uninstall registry entry. To download such a stub program, see: Setup Launcher to Suppress Maintenance Mode in IS6.

Use New GUID for Update Installer

Finally, you can assign a new GUID to your project so that it is seen as a different product by IS6. A new GUID is created if you use the File | New dialog in IDE, go to the Projects tab and select the project you want to use as template. If you copied your project directory with Explorer instead, you can generate a new GUID on your project's properties dialog (requires IS 6.1). To change the GUID from command line, see: Change Project GUID in IS6.

 Adding Components During the Update

If an updated installation has newer components, they will not be added automatically. When reinstallation has been attempted with ComponentReinstall(), any new components would not be installed. To fix this problem, I modified the event handler, OnMaintUIBefore, and added a new function just before the call to ComponentReinstall(). That function is called SelectNewComponents. In that function, the list of top-level components is traversed. Every component is examined to see if it is selected. If it is not, then it is selected, so it will be added to the installation. This solution will probably need to be modified if new subcomponents have been added to the installation. I have never made an installation with subcomponents, so some additional coding will have to be performed to make this solution more robust.
The attached file contains the modified code.

ZIP kulkarni.zip   Written by Raj Kulkarni
File size: 814 bytes   Last update: 2005-03-26

Additional information: