You can specify that certain values or keys in the Software and Default template hives, and in the "Current Control Set" key of the System template hive, always be copied to an existing Registry (even if it means overwriting existing values) by specifying them in the [KeysToAdd] section of the TXTSETUP.SIF file.
In addition, you can use the [KeysToAdd] section together with the [Values.section] section to create new keys or values, or to change values, without editing the template hives directly.
The choice of whether to add a key or value by editing a hive or by adding to the TXTSETUP.SIF file depends on the extent of the changes you want to make, whether you want existing values to be overwritten, and often on personal preference. However, you should be comfortable with editing the Registry before you use either method. In either case, you are using Setup to change the Registry; both the Registry and the Setup files are unforgiving of errors. The Registry Editor does not understand or recognize errors in syntax or semantics.
The sections in the TXTSETUP.SIF file that you are most likely to change in order to have Setup change registry values are listed in the following table:
Section | Used to |
[KeysToAdd] | Add or change keys, or add or change values under keys. |
[Values.section] | Specify values for specific keys listed in the [KeysToAdd] section. |
The lines in the [KeysToAdd] section specify that a key, or one or more values in a key, be written to an existing Registry. If the key or value already exists, it will be overwritten. The keys and/or values can be read from a template hive, or from a [values.section] section in the TXTSETUP.SIF file if one is specified. The format for lines in this section is as follows:
hive, "key"[, values.section]
where hive is the template hive from which the key should be copied. Key specifies the key in the specified hive. (It is enclosed in double-quotes.) Values.Section points to the section in the TXTSETUP.SIF file that lists the values to be added to this key. If you use this parameter, the information is taken from the TXTSETUP.SIF file rather than from the template hive. If you omit this parameter, Setup looks for the information in the template hive.
The following line specifies that everything in the PBrush32 key under Classes in the Software template hive be added to the registry:
Software, "Classes\PBrush32"
Normally, since this key is in the Software hive, it would be copied to an existing Registry only if the key did not already exist. By specifying it here, you ensure that the entire key and any subkeys will be written to the Registry, even if it involves overwriting an existing key by that name.
The following line, with the associated [Values.section] section, specifies a value (no wallpaper) for the Control Panel\Desktop key in the Default hive:
Default, "Control Panel\Desktop", Values.Desktop
[Values.Desktop]
Wallpaper, REG_SZ, (None)
No other values in this key will be affected.
This section specifies the values assigned to a key that was specified in the [KeysToAdd] section. You can list as many values as you want. The format is as follows:
name[, type, value]
where name is the name of the key to which you want to add the value. If the key does not already exist in the Registry, it will be created. (The hive in which the key is placed is specified in the line in the [KeysToAdd] section that points to this [Value.section] section.) If only name is entered, that entire key, including any subkeys, will be copied to the existing Registry. If a key by that name already exists it will be overwritten. Type is the value type, and can be any of the following:
Value is the value you want to assign to this entry. For types REG_SZ, REG_EXPAND_SZ, and REG_MULTI_SZ, the value is a string and must be enclosed in double quote marks.