Share via


AddReg (Windows Embedded CE 6.0)

1/6/2010

The AddReg key, under the [DefaultInstall] section, is required and describes the keys and values that the .cab file adds to the target device registry.

Note

It is recommended that installed applications use the HKCU\Software\ branch of the registry to store information.

Note

If you install multiple applications to the same HKCU\Software branch of the registry, such as HKEY_Computer_User\Software\MyCompany, be aware of the following: when the first application that created the branch is uninstalled, the entire branch will be deleted. This means any settings created by the second application will be lost. This is by design. To avoid this, install applications to different branches of HKEY_Computer_User \Software</STRONG>, or create the registry keys on first-run or in the Setup dll functions instead of using AddReg.

The following code example shows the format that the AddReg key uses.

[add_registry_section]
registry_root_string, subkey,[value_name], flags, value[,value]
[registry_root_string, subkey,[value_name], flags, value[,value]]

Parameters

  • registry_root_string
    String that specifies the registry root location.

    The following table shows the supported values:

    Root string Description

    HKCR

    The same as HKEY_CLASSES_ROOT

    HKCU

    The same as HKEY_CURRENT_USER

    HKLM

    The same as HKEY_LOCAL_MACHINE

  • value_name
    Registry value name. If empty, the "(default)" registry value name is used.

    Note

    Use only Unicode characters that can be converted into ANSI characters without data loss. This enables backward compatibility with earlier device versions. For more information, see CAB Wizard.

  • flags
    Contains a numeric value that specifies information about the registry key.

    The following table shows the supported values.

    Flag Value Description

    FLG_ADDREG_NOCLOBBER

    0x00000002

    If the registry key exists, do not overwrite it.

    This flag can be used with all other flags in this table.

    FLG_ADDREG_TYPE_SZ

    0x00000000

    The REG_SZ registry data type.

    FLG_ADDREG_TYPE_MULTI_SZ

    0x00010000

    The REG_MULTI_SZ registry data type.

    The value field that follows can be a list of strings separated by commas.

    FLG_ADDREG_TYPE_BINARY

    0x00000001

    The REG_BINARY registry data type.

    The value field that follows must be a list of numeric values separated by commas, one byte per field, and must not use the 0x hexadecimal prefix.

    FLG_ADDREG_TYPE_DWORD

    0x00010001

    The REG_DWORD data type.

    Only the noncompatible format in the Win32 Setup .inf documentation is supported.

The following code example sets a sample application version number, using "alpha" as the "(default)" registry value. It also sets test equal to 3, and new and another equal to 6.

[DefaultInstall]
AddReg = RegSettings
[Strings]
reg_path = Software\Company\AppName

[RegSettings]
HKLM,%reg_path%,,0x00000000,alpha
HKLM,%reg_path%,test,0x00010001,3
HKLM,%reg_path%\new,another,0x00010001,6

See Also

Concepts

Information File
CAB Wizard