SetRegValue function

Create a new registry value or update an existing one. This is not recommended in general; the preferred method to install registry values is by adding the appropriate Registry Value item to your InstallMate project.

The SetRegValue function is a predefined extension DLL function that is distributed with InstallMate. You can use this function by adding a Run DLL action to the action sequence in which you want to run the action. Set the Run DLL action attributes as follows:


The SetRegValue function expects the following arguments. All arguments may contain symbolic references; these will be resolved before the function is called. Note that you must "quote" an argument if it contains spaces, or if it could contain spaces after expansion of symbolic references.

The fully qualified registry path for the value that needs to be set, for example HKEY_LOCAL_MACHINE\Software\<Publisher>\<ProductName>\MyName. The final (rightmost) portion of this path must be the name for the value; the preceding parts form the registry key path. To set the value of the unnamed (default) value, end the path with a backslash '\' character.
The value to be set. This may be a text string or a number in decimal or hexadecimal notation; if you use hexadecimal notation, the number must start with 0x or 0X
Optional registry value type name. It must be one of the following: REG_DWORD, REG_SZ, or REG_EXPAND_SZ. If not given, then REG_SZ is assumed.

Return value

Returns ERROR_SUCCESS (zero) if successful, else a nonzero error code. This error code is available in the LastExitCode variable.


To use this function, you must add the extension DLL to your InstallMate project. The easiest way to do so is as follows:

  1. Open your InstallMate project.
  2. Choose File > Import > Project Items... from the main menu bar.
  3. Browse for and select the file Insert Extension DLL.imq, then click Open.

Alternatively, you can go to the Installer options page in your InstallMate project, click on the Advanced... button, then click on the Extension DLL tab and enter the paths to the extension DLL versions there.