Driver Selection and Ranking by Class Installers and Co-installers
Class installers and co-installers can participate in driver selection by handling the DIF_SELECTBESTCOMPATDRV request (or the DIF_SELECTDEVICE request for a manually installed device). Windows sends these DIF codes after it builds its list of potential drivers but before it selects the best driver. When handling these DIF codes, a class installer or co-installer can set the DNF_BAD_DRIVER flag on a potential driver node if the installer is able to determine whether the driver does not support the device. If DNF_BAD_DRIVER is set on a potential driver node, Windows ignores the driver when making its selection.
An installer can also participate in driver selection by changing the rank of a potential driver when the installer handles the DIF_SELECTBESTCOMPATDRV (or DIF_SELECTDEVICE) request. However, the only way an installer should modify a driver rank is to set the rank to 0xFFFFFFFF. This rank value indicates that the driver can be used for the device, but only as a last choice option. In general, installers should not dynamically change the rank of a driver based on class-specific criteria. If an installer dynamically changes a driver rank, the installer overrides the system-supplied ranking mechanism that is based on the information about a driver in the driver INF file. If an installer overrides the system-supplied ranking mechanism, Windows and Windows Update cannot reliably determine which driver in a list of matching drivers is actually the preferred driver.
In Windows Vista and later versions of Windows, using the feature score is the recommended method to rank drivers according to class-specific criteria. The feature score of a driver is set by an INF FeatureScore directive in the INF DDinstall section that installs a driver.
Instead of modifying the driver selection process, a class installer or co-installer can override the operating system's entire selection process and directly select the driver for a device. (For more information, see DIF_SELECTBESTCOMPATDRV and DIF_SELECTDEVICE.) However, we do not recommend this because the operating system's selection algorithms might be enhanced in a future release. When an installer directly selects a driver, the operating system's selection operations are terminated.
For more information about driver ranking, see How Windows Ranks Drivers.