Skip to content

Defines

alexmitev81 edited this page Feb 27, 2017 · 2 revisions

All defines can be defined before or after (recommended) NsisMultiUser.nsh is included, but before the MULTIUSER_PAGE_INSTALLMODE macro is inserted.

Required Defines

PRODUCT_NAME

Name of the application, without version information. Used to initialize default install directory, default uninstall registry key, default name in Windows Uninstall dialog and for message boxes.

Usage:

!define PRODUCT_NAME "NsisMultiUser MUI2 Full Demo"

VERSION

Version of the application displayed to the user in Windows Uninstall dialog. When there is installed version, used to render proper texts on page.

Usage:

!define VERSION "1.0"

PROGEXE

File name of the main application installed, used to display application icon in Windows Uninstall dialog.

Usage:

!define PROGEXE "calc.exe"

Optional Defines

COMPANY_NAME

Company (publisher) of the application displayed to the user in Windows Uninstall dialog.

Usage:

!define COMPANY_NAME "My Company"

Default value:

(none)

MULTIUSER_INSTALLMODE_ALLOW_BOTH_INSTALLATIONS

Installer only. 0 or 1, determines whether user is allowed to have BOTH per-user and per-machine installations. This only affects the texts and the required elevation on the page - if user selects per-user installation, but there is already per-machine installation, he still needs elevation in order to remove the per-user installation and the information for the per-machine installation is displayed on the page. In this case the elevated instance sets the shell var context to current, although it has admin rights. The actual uninstall of the previous version has to be implemented by script. Note that even if you define MULTIUSER_INSTALLMODE_ALLOW_BOTH_INSTALLATIONS as 0, there still might be two installations if per-user installation is made first and then per-user installation is made from another account, which has no way to see the first installation.

Usage:

!define MULTIUSER_INSTALLMODE_ALLOW_BOTH_INSTALLATIONS 0

Default value:

1

MULTIUSER_INSTALLMODE_ALLOW_ELEVATION

0 or 1, determines whether to allow UAC screens in the (un)installer. If set to 0 and user is not admin, per-machine radio button will be disabled in the installer. If elevation is always required (both installer and uninstaller), setup will display error message in non-silent mode and exit with an error code. In old versions, it was possible just to define MULTIUSER_INSTALLMODE_ALLOW_ELEVATION with no value, which is now equivalent to setting it to 1.

Usage:

!define MULTIUSER_INSTALLMODE_ALLOW_ELEVATION 1

Default value:

1

MULTIUSER_INSTALLMODE_ALLOW_ELEVATION_IF_SILENT

0 or 1, determines whether to allow UAC screens in the (un)installer in silent mode. If set to 0 and user is not admin and elevation is always required, (un)installer will exit with an error code. Generally it is not recommended to set this flag to 1, because a silent (un)installer shouldn't display any dialogs. Also, if you are performing silent remote (un)installs, there might be no user on the remote machine to close the UAC screen. Can be set to 1 only if MULTIUSER_INSTALLMODE_ALLOW_ELEVATION is defined as 1, or script won't compile.

Usage:

!define MULTIUSER_INSTALLMODE_ALLOW_ELEVATION_IF_SILENT 0

Default value:

0

MULTIUSER_INSTALLMODE_DEFAULT_ALLUSERS

0 or 1, determines whether per-machine option is pre-selected by default when not running as admin (when set to 0, per-user option will be selected by default in this mode). Only available if MULTIUSER_INSTALLMODE_ALLOW_ELEVATION is 1. If there's only one installation and it's per-user, it will always be pre-selected. In old versions, it was possible just to define MULTIUSER_INSTALLMODE_DEFAULT_ALLUSERS with no value, which is now equivalent to setting it to 1.

Usage:

!define MULTIUSER_INSTALLMODE_DEFAULT_ALLUSERS 1

Default value:

0

MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER

0 or 1, determines whether per-user option is pre-selected by default when running as admin (when set to 0, per-machine option will be selected by default in this mode). If there's only one installation and it's per-machine, it will always be pre-selected. In old versions, it was possible just to define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER with no value, which is now equivalent to setting it to 1.

Usage:

!define MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER 1

Default value:

0

MULTIUSER_INSTALLMODE_64_BIT

0 or 1, set to 0 for 64-bit installations. This affects the value of $INSTDIR - $PROGRAMFILES32 or $PROGRAMFILES64 and also sets SetRegView to 32 or 64.

Usage:

!define MULTIUSER_INSTALLMODE_64_BIT 1

Default value:

0

MULTIUSER_INSTALLMODE_INSTDIR

Installer only. Installation directory to use when there is no installation present. For per-machine installations, this directory is placed under $PROGRAMFILES32 or $PROGRAMFILES64 and for per-user installations, it's placed under $LOCALAPPDATA or $PROGRAMFILES32 (prior to Windows 2000).

Usage:

!define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCT_NAME} ${VERSION}"

Default value:

${PRODUCT_NAME}

MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY

Registry key name, in which uninstall information is stored, placed under [HKLM|HKCU]\Software\Microsoft\Windows\CurrentVersion\Uninstall.

Usage:

!define MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY "${PRODUCT_NAME} ${VERSION}"

Default value:

${PRODUCT_NAME}

MULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY

Registry key name, in which install information is stored (currently only MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME), placed under [HKLM|HKCU]\Software. If you don't use this define, install information is stored under the uninstall key.

Usage:

!define MULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY "${PRODUCT_NAME}"

Default value:

"Microsoft\Windows\CurrentVersion\Uninstall\${MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY}"

UNINSTALL_FILENAME

File name of the uninstaller that you use in the call to WriteUninstaller. Used to store uninstall information in registry.

Usage:

!define UNINSTALL_FILENAME "${PRODUCT_NAME}_uninstall.exe"

Default value:

"uninstall.exe"

MULTIUSER_INSTALLMODE_DISPLAYNAME

Display name of the application in Windows Uninstall dialog. The plugin adds the text (current user) to the name of per-user installation in Windows Uninstall dialog.

Usage:

!define MULTIUSER_INSTALLMODE_DISPLAYNAME "${PRODUCT_NAME} ${VERSION} ${BUILD}"

Default value:

"${PRODUCT_NAME} ${VERSION}"

MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME

Name of the registry value containing install directory. Placed under MULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY.

Usage:

!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallDir"

Default value:

"InstallLocation"

MULTIUSER_INSTALLMODE_NO_HELP_DIALOG

Define this to remove the default dialog that is displayed when the /? command-line parameter is specified. Use this when you process additional command-line parameters or return new return codes in your script and want to display your own help dialog.