[Registry] section

This optional section defines any registry keys/values you would like Setup to create, modify, or delete on the user's system.

By default, registry keys and values created by Setup are not deleted at uninstall time. If you want the uninstaller to delete keys or values, you must include one of the uninsdelete* flags described below.

The following is an example of a [Registry] section.

[Registry]
Root: HKCU; Subkey: "Software\My Company"; Flags: uninsdeletekeyifempty
Root: HKCU; Subkey: "Software\My Company\My Program"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\My Company"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\My Company\My Program"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\My Company\My Program\Settings"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

The following is a list of the supported parameters:

Root  (Required)

The root key. This must be one of the following values:

HKCR(HKEY_CLASSES_ROOT)
HKCU(HKEY_CURRENT_USER)
HKLM(HKEY_LOCAL_MACHINE)
HKU(HKEY_USERS)
HKCC(HKEY_CURRENT_CONFIG)

The values may have a suffix of 32 or 64. Root key values with a suffix of 32 (for example, HKLM32) map to the 32-bit view of the registry; root key values with a suffix of 64 (for example, HKLM64) map to the 64-bit view of the registry.

Root key values with a suffix of 64 can only be used when Setup is running on 64-bit Windows, otherwise an error will occur. On an installation supporting both 32- and 64-bit architectures, it is possible to avoid the error by adding a Check: IsWin64 parameter, which will cause the entry to be silently skipped when running on 32-bit Windows.

A root key value without a suffix (for example, HKLM) is equivalent to the value with a suffix of 32 (for example, HKLM32) unless the install is running in 64-bit mode, in which case it is equivalent to the value with a suffix of 64 (for example, HKLM64).

Example:
Root: HKCU
Subkey  (Required)

The subkey name, which can include constants.

Example:
Subkey: "Software\My Company\My Program"
ValueType

The data type of the value. This must be one of the following:

none
string
expandsz
multisz
dword
qword
binary

If none (the default setting) is specified, Setup will create the key but not a value. In this case the ValueName and ValueData parameters are ignored.
If string is specified, Setup will create a string (REG_SZ) value.
If expandsz is specified, Setup will create an expand-string (REG_EXPAND_SZ) value.
If multisz is specified, Setup will create an multi-string (REG_MULTI_SZ) value.
If dword is specified, Setup will create a 32-bit integer (REG_DWORD) value.
If qword is specified, Setup will create a 64-bit integer (REG_QWORD) value.
If binary is specified, Setup will create a binary (REG_BINARY) value.

Example:
ValueType: string
ValueName

The name of the value to create, which can include constants. If this is blank, it will write to the "Default" value. If the ValueType parameter is set to none, this parameter is ignored.

Example:
ValueName: "Version"
ValueData

The data for the value. If the ValueType parameter is string, expandsz, or multisz, this is a string that can include constants. If the data type is dword or qword, this can be a decimal integer (e.g. "123"), a hexadecimal integer (e.g. "$7B"), or a constant which resolves to an integer. If the data type is binary, this is a sequence of hexadecimal bytes in the form: "00 ff 12 34". If the data type is none, this is ignored.

On a string, expandsz, or multisz type value, you may use a special constant called {olddata} in this parameter. {olddata} is replaced with the previous data of the registry value. The {olddata} constant can be useful if you need to append a string to an existing value, for example, {olddata};{app}. If the value does not exist or the existing value isn't a string type, the {olddata} constant is silently removed. {olddata} will also be silently removed if the value being created is a multisz type but the existing value is not a multi-string type (i.e. it's REG_SZ or REG_EXPAND_SZ), and vice versa.

On a multisz type value, you may use a special constant called {break} in this parameter to embed line breaks (nulls).

Example:
ValueData: "1.0"
Permissions

Specifies additional permissions to grant in the registry key's ACL (access control list). It is not recommended that you use this parameter if you aren't familiar with ACLs or why you would need to change them, because misusing it could negatively impact system security.

For this parameter to have an effect the current user must be able to change the permissions on the registry key. In the event these conditions are not met, no error message will be displayed, and the permissions will not be set.

This parameter should only be used on registry keys private to your application. Never change the ACLs on a top-level key like HKEY_LOCAL_MACHINE\SOFTWARE, otherwise you can open up security holes on your users' systems.

The specified permissions are set regardless of whether the registry key existed prior to installation. The permissions are not set if ValueType is none and the deletekey flag or deletevalue flag is used.

On Itanium editions of Windows, this parameter is only effectual on 32-bit registry keys. (There is no such limitation on x64 editions of Windows.)

This parameter can include one or more space separated values in the format:

The following access types are supported for the [Registry] section:

full

Grants "Full Control" permission, which is the same as modify (see below), but additionally allows the specified user/group to take ownership of the registry key and change its permissions. Use sparingly; generally, modify is sufficient.

modify

Grants "Modify" permission, which allows the specified user/group to read, create, modify, and delete values and subkeys.

read

Grants "Read" permission, which allows the specified user/group to read values and subkeys.

Example:
Permissions: users-modify
Flags

This parameter is a set of extra options. Multiple options may be used by separating them by spaces. The following options are supported:

createvalueifdoesntexist

When this flag is specified, Setup will create the value only if a value of the same name doesn't already exist. This flag has no effect if the data type is none, or if you specify the deletevalue flag.

deletekey

When this flag is specified, Setup will first try deleting the entire key if it exists, including all values and subkeys in it. If ValueType is not none, it will then create a new key and value.

To prevent disasters, this flag is ignored during installation if Subkey is blank or contains only backslashes.

deletevalue

When this flag is specified, Setup will first try deleting the value if it exists. If ValueType is not none, it will then create the key if it didn't already exist, and the new value.

dontcreatekey

When this flag is specified, Setup will not attempt to create the key or any value if the key did not already exist on the user's system. No error message is displayed if the key does not exist.

Typically this flag is used in combination with the uninsdeletekey flag, for deleting keys during uninstallation but not creating them during installation.

noerror

Don't display an error message if Setup fails to create the key or value for any reason.

preservestringtype

This is only applicable when the ValueType parameter is string or expandsz. When this flag is specified and the value did not already exist or the existing value isn't a string type (REG_SZ or REG_EXPAND_SZ), it will be created with the type specified by ValueType. If the value did exist and is a string type, it will be replaced with the same value type as the pre-existing value.

uninsclearvalue

When the program is uninstalled, set the value's data to a null string (type REG_SZ). This flag cannot be combined with the uninsdeletekey flag.

uninsdeletekey

When the program is uninstalled, delete the entire key, including all values and subkeys in it. It obviously wouldn't be a good idea to use this on a key that is used by Windows itself. You should only use this on keys private to your application.

To prevent disasters, this flag is ignored during installation if Subkey is blank or contains only backslashes.

uninsdeletekeyifempty

When the program is uninstalled, delete the key if it has no values or subkeys left in it. This flag can be combined with uninsdeletevalue.

To prevent disasters, this flag is ignored during installation if Subkey is blank or contains only backslashes.

uninsdeletevalue

Delete the value when the program is uninstalled. This flag can be combined with uninsdeletekeyifempty.

NOTE: In Inno Setup versions prior to 1.1, you could use this flag along with the data type none and it would function as a "delete key if empty" flag. This technique is no longer supported. You must now use the uninsdeletekeyifempty flag to accomplish this.

Example:
Flags: uninsdeletevalue

Components and Tasks Parameters

Common Parameters