Add Registry

The Add Registry section adds subkeys or value names to the registry, optionally setting the value. The add-registry-section name must appear in an AddReg item in an Install section.

[add-registry-section]
reg-root-string, [subkey], [value-name], [flags], [value]
[reg-root-string, [subkey], [value-name], [flags], [value]]
.
.
.
 
reg-root-string
Registry root name. This parameter can be one of the following values.
HKCR Same as HKEY_CLASSES_ROOT.
HKCU Same as HKEY_CURRENT_USER.
HKLM Same as HKEY_LOCAL_MACHINE.
HKU Same as HKEY_USERS.
HKR Relative to the key passed into SetupInstallFromInfSection.

subkey
Optional. Identifies the subkey to set. Has the form key1\key2\key3....
value-name
Optional. Identifies the value name for the subkey. For string type, if the value-name parameter is left empty, the value of the subkey is set to the default value for that registry entry.
flags
Optional. Establishes the value data type and the AddReg item action. The flag value is a bitmap where the low word contains basic flags that define the general data type and AddReg item action. The high word contains values that more specifically identify the data type of the registry value. The high word is ignored by the 16-bit Windows 95 setup functions in SETUPX.DLL. The flags are defined as follows:
Value Meaning
FLG_ADDREG_BINVALUETYPE The value is "raw" data.
FLG_ADDREG_NOCLOBBER Do not overwrite the registry key if it already exists.
FLG_ADDREG_DELVAL Delete the value from the registry.
FLG_ADDREG_APPEND Append a value to an existing value. This flag is currently supported only for REG_MULTI_SZ values.
FLG_ADDREG_TYPE_MASK Mask.
FLG_ADDREG_TYPE_SZ Registry data type REG_SZ.
FLG_ADDREG_TYPE_MULTI_SZ Registry data type REG_MULTI_SZ.
FLG_ADDREG_TYPE_EXPAND_SZ Registry data type REG_EXPAND_SZ.
FLG_ADDREG_TYPE_BINARY Registry data type REG_BINARY.
FLG_ADDREG_TYPE_DWORD Registry data type REG_DWORD.
FLG_ADDREG_TYPE_NONE Registry data type REG_NONE.

Bit 0 of the flag distinguishes between character and binary data as it does in the Windows 95 setup functions, thus a Windows 95 installation program will see the extended data types as REG_SZ or REG_BINARY. To allow REG_DWORD entries to be compatible with both operating systems, the following formats are supported.

To represent a number with a data type other than the predefined REG_* types, you can specify the type number in the flag's high word and specify binary type in its low word. You must enter the data in binary format, one byte per field. For example, to store 16 bytes of data with a new data type of 0x38, you would have an AddReg item as follows:

HKR,,MYValue,0x00380001,0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
 

You can use this technique for any data type except REG_EXPAND_SZ, REG_MULTI_SZ, REG_NONE, and REG_SZ.

value
Optional. Value to set. This parameter can be either a string or a number in hexadecimal notation. At least two fields are required; however, one can be null. Therefore, at least one comma is required when using this form.

The two items in the following example Add Registry section, which is named sermouse_EventLog_AddReg, add two value names to the registry, EventMessageFile and TypesSupported, and set the value of these names.

[sermouse_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%%SystemRoot%%\System32\IoLogMsg.dll;%%SystemRoot%%\System32\drivers\sermouse.sys"
HKR,,TypesSupported,0x00010001,7
 

See Also

Overview, INF File Format Reference