Previous Next

INF DelReg Directive

[DDInstall] |
[DDInstall.HW] |
[DDInstall.CoInstallers] |
[ClassInstall32] |
[ClassInstall32.ntx86] |
[ClassInstall32.ntia64]

 
DelReg=del-registry-section[, del-registry-section] ...
 
 

A DelReg directive references one or more INF-writer-defined sections describing keys and/or value entries to be removed from the registry.

A DelReg directive can be specified under any of the sections shown in the formal syntax statement above. This directive also can be specified under any of the following INF-writer-defined sections:

Comments

In general, an INF should never attempt to delete subkeys or value entries within existing subkeys that were set up by system components or by the INF files for other devices. The purpose of a delete-registry section is to clean stale registry information from a previous installation using a new INF file supplied by the same provider.

Each del-registry-section name must be unique to the INF file, but it can be referenced by DelReg directives in other sections of the same INF. Each section name must follow the general rules for defining section names described in General Syntax Rules for INF Files. For information about how to use the system-defined .nt, .ntx86, and .ntia64 extensions, see Creating INF Files for Multiple Platforms and Operating Systems.

Each named section referenced by a DelReg directive has the following form:

[del-registry-section]
reg-root-string, subkey[, value-entry-name][, flags][, value]
reg-root-string, subkey[, value-entry-name][, flags][, value]
...

A del-registry-section can have any number of entries, each on a separate line.

DelReg-Referenced Section Entries

reg-root-string
Identifies the root of the registry tree for other values supplied in this entry. The value can be one of the following:
HKCR
Abbreviation for HKEY_CLASSES_ROOT.
HKCU
Abbreviation for HKEY_CURRENT_USER.
HKLM
Abbreviation for HKEY_LOCAL_MACHINE.
HKU
Abbreviation for HKEY_USERS.
HKR
Relative root – that is, keys specified using this abbreviation are relative to the registry key associated with the INF section in which this DelReg directive appears, as indicated in the following table.
INF Section Containing DelReg Directive Registry Key Referenced by HKR
INF DDInstall section The device's software key
INF DDInstall.HW section The device's hardware key
INF DDInstall.Services section The Services key

Note that HKR cannot be used in an del-registry-section referenced from an INF DefaultInstall section.

For more information about driver information stored under the HKEY_LOCAL_MACHINE root, see Driver Information in the Registry.

subkey
This value, formed either as a %strkey% token defined in a Strings section of the INF or as a registry path under the given reg-root (key1\key2\key3...), specifies one of the following:
value-entry-name
This value identifies a named value entry to be removed from the given subkey. This value and its preceding comma should be omitted if the subkey itself is being removed from the registry. (See additional information below.)
flags
(Windows XP and later.) This optional hexadecimal value, expressed as an ORed bitmask of system-defined low word and high word flag values, defines the data type for a value entry, or controls the delete-registry operation. If flags is not specified, the value-entry-name (if specified) or subkey will be deleted. Bitmask values for each of these flags are as follows:
0x00002000 (FLG_DELREG_KEYONLY_COMMON)
Delete the entire subkey.
0x00004000 (FLG_DELREG_32BITKEY)
Make the specified change in the 32-bit registry. If not specified, the change is made to the native registry.
0x00018002 (FLG_DELREG_MULTI_SZ_DELSTRING)
Within a multistring registry entry, delete all strings matching a string value specified by value. Case is ignored.
value
(Windows XP and later.) Specifies a registry value, if flags indicates a registry value is required. For Windows XP, only the FLG_DELREG_MULTI_SZ_DELSTRING flag requires a value. Otherwise this value is omitted.

With operating system versions prior to Windows XP, the only way to delete a key is by specifying:

reg-root-string, subkey

For Windows XP and later, the following is also permitted (to specify the 32-bit registry):

reg-root-string, subkey,,0x4000

Example

This example shows how the system-supplied COM/LPT ports class installer's INF removes stale NT-specific registry information about COM ports from the registry.

[ComPort.NT]
CopyFiles=ComPort.NT.Copy
AddReg=ComPort.AddReg, ComPort.NT.AddReg
 ... ; more directives omitted here
 
[ComPort.NT.HW]
DelReg=ComPort.NT.HW.DelReg
 
[ComPort.NT.Copy]
serial.sys
serenum.sys
 
[Comport.NT.AddReg]
HKR,,EnumPropPages32,,"MSPorts.dll,SerialPortPropPageProvider"
 
[ComPort.NT.HW.DelReg]
HKR,,UpperFilters

See Also

AddReg, AddInterface, AddService, BitReg, ClassInstall32, DDInstall, DDInstall.CoInstallers, DDInstall.HW, DDInstall.Services, InterfaceInstall32, Strings