KnownFiles

The KnownFiles 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 existing driver installation contains one or more known driver files. This directive is supported only by Windows Me/98 and is specific to the installation of media-class device drivers.

The KnownFiles 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:

KnownFiles=known-files-section

The directive specifies the name of a known-files-section, which contains a list of known driver files and specifies whether the driver's ranking should be raised or lowered if any of those files are already installed. The general format for a known-files-section is shown in the following:

[known-files-section]

known-filename**=force** | keep | safe

known-filename2**=force** | keep | safe

...

Each of the directives in the section specifies the name of a known file and one of the following keywords: force, keep, or safe. The keyword takes effect only if the media-class installer finds the named file among the system's existing (previously installed) drivers. The three keywords and their meanings are shown in the following table.

Keyword Meaning

force

Improve the driver's ranking. This is likely to force installation of the driver, in which case it replaces the previously installed driver.

keep

Degrade the driver's ranking. This increases the likelihood that the system will keep the previously installed driver.

safe

The driver is safe to install. This keyword does not directly modify the driver's ranking, but it does lessen the negative impact of any warnings on the driver's ranking.

 

The effect of the force and keep keywords is to modify the driver's ranking. The Setup API assigns an initial ranking number to each driver and sorts the drivers into several ranges of ranking numbers (see How Setup Selects Drivers):

  • Range 0 to 0x0FFF (hardware ID matches)

  • Range 0x1000 to 0x1FFF (compatible ID matches)

  • Range 0x2000 to 0x2FFF (and so on)

The media-class installer can then modify the initial rankings, based on factors such as directives in a known-files-section. The change in ranking number due to the force or keep keyword is a small fraction of a range, and the initial driver ranking is biased toward the center of the range.

A driver with a smaller ranking number is preferable to a driver with a larger ranking number. For example, the Setup API chooses a driver in the top range (0 to 0xFFF) over one in the second range (0x1000 to 0x1FFF). Note that the force, keep, and safe keywords have no effect over this choice when the two drivers fall into different ranges.

Example

The following example is a part of an INF file that checks the system for known driver files aaa.sys and bbb.sys during installation:

  KnownFiles = XYZ.KnownFiles
  ...
  [XYZ.KnownFiles]
  aaa.sys = keep
  bbb.sys = force

If the system already contains a file named aaa.sys from a previous installation, the installer will keep the existing version of that file instead of replacing it with a new version of the file. However, if the system already contains a file named bbb.sys from a previous installation, the installer will do one of the following:

  • Replace the existing version of bbb.sys with a new version of bbb.sys if one is available.

  • Simply delete the existing version of bbb.sys if the INF file does not provide a new version of the file.

 

 

Send comments about this topic to Microsoft