SetupDiGetSelectedDriverA function (setupapi.h)

The SetupDiGetSelectedDriver function retrieves the selected driver for a device information set or a particular device information element.

Syntax

WINSETUPAPI BOOL SetupDiGetSelectedDriverA(
  [in]           HDEVINFO           DeviceInfoSet,
  [in, optional] PSP_DEVINFO_DATA   DeviceInfoData,
  [out]          PSP_DRVINFO_DATA_A DriverInfoData
);

Parameters

[in] DeviceInfoSet

A handle to the device information set for which to retrieve a selected driver.

[in, optional] DeviceInfoData

A pointer to an SP_DEVINFO_DATA structure that specifies a device information element that represents the device in DeviceInfoSet for which to retrieve the selected driver. This parameter is optional and can be NULL. If this parameter is specified, SetupDiGetSelectedDriver retrieves the selected driver for the specified device. If this parameter is NULL, SetupDiGetSelectedDriver retrieves the selected class driver in the global class driver list that is associated with DeviceInfoSet.

[out] DriverInfoData

A pointer to an SP_DRVINFO_DATA structure that receives information about the selected driver.

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. If a driver has not been selected for the specified device instance, the logged error is ERROR_NO_DRIVER_SELECTED.

Remarks

Note

The setupapi.h header defines SetupDiGetSelectedDriver as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib

See also

SetupDiSetSelectedDriver