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]]
.
.
.
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. |
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.
HKLM,"Software\Microsoft\Windows NT\CurrentVersion\FontDPI","LogPixels",0x10001,120
HKLM,"Software\Microsoft\Windows NT\CurrentVersion\FontDPI","LogPixels", 65537,78,0,0,0
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.
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
Overview, INF File Format Reference