RegDBSetDefaultRoot

InstallShield 2020 » InstallScript Language Reference

Project:For InstallScript MSI and Basic MSI projects, it is recommended that you use the Registry view in InstallShield instead of creating registry keys and values through InstallScript code. Handling all of your registry changes in this way allows for a clean uninstallation through the Windows Installer service.

The RegDBSetDefaultRoot function sets the root key that is used by the general registry-related functions. Most InstallScript registry functions work on the HKEY_CLASSES_ROOT as the default registry hive. Using this function, you can specify another key, such as HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, or HKEY_USERS, as the root key.

You cannot use RegDBSetDefaultRoot to change the root key of keys created or handled using the special registry-related functions. For more information, see Special Registry-Related Functions.

Note:This function supports the 64-bit parts of the registry by using the REGDB_OPTION_WOW64_64KEY option. For more information, see REGDB_OPTIONS.

Syntax

RegDBSetDefaultRoot ( nRootKey );

Parameters

RegDBSetDefaultRoot Parameters

Parameter

Description

nRootKey

Specify one of the following constants for the root key:

HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA
HKEY_USER_SELECTABLE

If you pass HKEY_USER_SELECTABLE as the argument, a subsequent registry function call uses HKEY_LOCAL_MACHINE as the root key if the ALLUSERS system variable is non-zero when the function is called, or uses HKEY_CURRENT_USER as the root key if ALLUSERS is FALSE when the function is called.

Note:Windows does not allow the creation of a key directly under HKEY_LOCAL_MACHINE or HKEY_USERS.

Return Values

RegDBSetDefaultRoot Return Values

Return Value

Description

0

Indicates that the function successfully set the key.

< 0

Indicates that the function was unable to set the key.

See Also