Some information can be found in this old Microsoft article (XP time)
How Windows determines the most suitable device driver to install during Setup :
When you run Windows Setup, you may have more than one set of device drivers or .inf files that work with a particular device. Both Setup and Plug and Play attempt to resolve these conflicts by selecting the device driver that is the most suitable match for the device that is being installed.
Plug and Play can search all the .inf files for the most suitable device driver to install for a particular device. Plug and Play does not stop its search on the first match that Plug and Play finds. Plug and Play continues to search all the .inf files that are listed in the search path of Plug and Play, as defined in the following registry entry:
HKEY-LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
DevicePath:Reg_Expand_SZ:%Systemroot%\Inf
Setup builds a list of compatible device drivers that contained a match in an .inf file and assigns a "rank" for each one that had been located. The rank can range from "0" to "0xFFFF" with 0 being the most suitable possible match and 0xFFFF the worst possible match. The device driver with the lowest rank is considered the most suitable possible match and is the device driver installed.
However, if two device drivers have the same lowest rank, Setup uses the device driver with the most recent date. If one of the device drivers is signed and the other device driver is unsigned, the unsigned device driver date is assigned a value of 0xFFFFFFFF, and the signed device driver is selected and installed.
It should be noted that by default a 64-bit Windows version will not accept unsigned drivers as candidates. This is only possible in 32-bits Windows.
The following article contains the latest algorithm : How Windows Ranks Drivers
Windows assigns a rank to a driver that matches a device. The rank indicates how well the driver matches the device. A driver rank is represented by an integer that is equal to or greater than zero. The lower the rank, the better a match the driver is for the device.
The rank of a driver is a composite value that depends on how a driver is signed, the features that are supported by the driver, and the type of match between the device identification strings that are reported by a device and the device identification strings that are specified in the entries of an INF Models section of a driver INF file.
A rank is represented by a value of type DWORD. A rank is sum of a signature score, a feature score, and an identifier score. A rank is formatted as 0xSSGGTHHH, where S, G, T, and H are four-bitfields and the SS, GG, and THHH fields represent the three ranking scores, as follows:
- The signature score ranks a driver according to how a driver is signed. The signature score depends only on the value of the SS field. An unspecified signature score is represented as 0xSS0000000.
For an overview on how Windows Vista and later versions of Windows use a driver's signature to determine how the driver is installed, see Signature Categories and Driver Installation.
Basically, digital signatures by a Windows signing authority score the highest.
- The feature score ranks a driver based on the features that the driver supports. The feature score depends only on the value of the GG field. An unspecified feature score is represented as 0x00GG0000.
This information is specified inside the .inf file, so a manufacturer can order his own drivers.
- The identifier score ranks a driver based on the type of match between a device identification string that is reported by a device and a device identification string that is listed in an entry of an INF Models section of a driver INF file. The identifier score depends only on the value of the THHH field. An unspecified identifier score is represented as 0x0000THHH.
This text is quite confused and confusing. See the link for a much better description for identifier score.