The SetupDiSelectBestCompatDrv function is the default handler for the DIF_SELECTBESTCOMPATDRV installation request.
WINSETUPAPI BOOL SetupDiSelectBestCompatDrv( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData );
A handle to a device information set that contains a device information element that represents the device for which to select the best compatible driver.
A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet. SetupDiSelectBestCompatDrv selects the best driver for a device information element from the compatible driver list for the specified device.
If the operation succeeds, SetupDiSelectBestCompatDrv returns TRUE. Otherwise, the function returns FALSE and the logged error can be retrieved by a call to GetLastError.
If the caller of SetupDiSelectBestCompatDrv is a member of the Administrators group and the class of the device is different that the class of the selected driver, SetupDiSelectBestCompatDrv sets the class of the device to the class of the driver. If this behavior is not desired, call this function at a lower privilege level.
For information about how the best driver is selected, see How Windows Selects Drivers.
To get the selected driver for a device, call SetupDiGetSelectedDriver.
|Windows version||Available in Windows 2000 and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|