KnownRegEntries directive provides explicit control over whether to improve or degrade the ranking of a driver. The change in driver ranking is conditional and takes effect only if the registry contains one or more known entries. This directive is supported only by Windows Me/98 and is specific to the installation of media-class device drivers.
This directive conditionally modifies the ranking of a driver relative to the driver that is currently installed. (See How Setup Selects Drivers for a discussion about driver ranking.) The directive is conditional and takes effect only if the registry contains entries matching a set of known registry entries that are listed in the INF file. All the entries in the list must match; a single mismatch prevents the directive from taking effect. A known registry entry is specified by its registry path, entry name, and value. If the registry contains matches for all the entries in the list, the media-class installer either boosts or reduces the driver's ranking, depending on which option is selected.
KnownRegEntries directive appears in the DDInstall section of an INF file, but because Windows 2000 and later do not support this directive, it is not listed in the INF DDInstall Section reference page.
The directive has the following format:
The directive specifies the name of a known-regentries-section, which contains one or more directives that specify how the driver's ranking is to be modified in the event that the registry contains matches for a particular list of entries. The format for a known-regentries-section is as follows:
- known-regvalues-section=force | keep | safe
- known-regvalues-section2=force | keep | safe
The known-regvalues-section that is named in each of the preceding directives contains a list of registry entries. The keyword force, keep, or safe specifies how the media-class installer should modify the driver's ranking in the event that the registry contains all the entries that are listed in the known-regvalues-section. See the KnownFiles reference page for a detailed discussion about the effect of the force, keep, and safe keywords on driver ranking.
The general format for a known-regvalues-section is shown in the following:
- 1 = reg-root,subkey,value-entry-name,flags,value
- 1 = reg-root2,subkey2,value-entry-name2,flags2,value2
Each of the preceding directives specifies the path, entry name, data type, and data value of a registry entry. The literal character "1" to the left of the equal sign (=) is required by the syntax, but has no other significance. The preceding reg-root, subkey, value-entry-name, flags, and value parameters are the same as the parameters in an entry in the add-registry-section that is named in an INF AddReg directive. In this case, however, the flags parameter is restricted to one of two values: 0 (FLG_ADDREG_TYPE_SZ) or 1 (FLG_ADDREG_BINVALUETYPE).
The change in driver ranking (force, keep, or safe) occurs only if the installer succeeds in finding a matching registry entry for each of the directives in the known-regvalues-section. For each entry, a match is successful only if the registry contains an entry with the same path, entry name, data type, and data value.
The following example is a part of an INF file that conditionally forces an existing driver to be updated and replaced by the new driver:
KnownRegEntries = XYZ.KnownRegEntries ... [XYZ.KnownRegEntries] IsABCProcessor = force ... [IsABCProcessor] 1 = HKLM,Hardware\Description\System\CentralProcessor\0,Identifier,0,"ABC Processor 123"
KnownRegEntries directive in the first line of the preceding example specifies that the name of the known-regentries-section is XYZ.KnownRegEntries. The directive in the XYZ.KnownRegEntries section declares the name of a known-regvalues-section, IsABCProcessor. The force keyword in this directive indicates that if the all the values in the known-regvalues-section match those in the registry, the installer program should "force" the driver to be installed. In the known-regvalues-section, IsABCProcessor, the directive specifies a registry key that is named Identifier and whose value is a string. If the registry contains an entry with string value "ABC Processor 123" at the specified path, the force keyword is enabled, which improves the driver's ranking and increases the likelihood that it will be installed.
For more information, see Registry Keys for Drivers.