SetupDiSetSelectedDriver

BOOLEAN
SetupDiSetSelectedDriver(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData, /* optional */
IN OUT PSP_DRVINFO_DATA DriverInfoData /* optional */
);

SetupDiSetSelectedDriver sets the specified member of a driver list as the currently-selected driver. It can also be used to reset the driver list so that there is no currently-selected driver.

Parameters

DeviceInfoSet

Supplies a handle to the device information set containing information about the device instance for which to set a selected driver.

DeviceInfoData

Supplies a pointer to an SP_DEVINFO_DATA structure that contains the device information element for which to select a driver. If this parameter is NULL, a class driver for the global class driver list is selected.

DriverInfoData

If this parameter is specified, it supplies a pointer to a driver information structure that indicates the driver to be selected. If this parameter is NULL, the driver list is reset (that is, no driver is selected).

If the Reserved field of the SP_DEVINFO_DATA structure is 0, the caller is requesting a search for a driver node with the specified parameters (DriverType, Description, and ProviderName). If a match is found, that driver node is selected. The Reserved field is updated on output to reflect the actual driver node where the match was found. If a match is not found, the function fails and a call to GetLastError returns ERROR_INVALID_PARAMETER.

Return Value

The function returns TRUE if it is successful. Otherwise it returns FALSE and the logged error can be retrieved with a call to GetLastError.

See Also

SetupDiGetSelectedDriver