The SetupDiEnumDriverInfo function enumerates the members of a driver list.
WINSETUPAPI BOOL SetupDiEnumDriverInfoA( HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_A DriverInfoData );
A handle to the device information set that contains the driver list to enumerate.
A pointer to an SP_DEVINFO_DATA structure that specifies a device information element in DeviceInfoSet. This parameter is optional and can be NULL. If this parameter is specified, SetupDiEnumDriverInfo enumerates a driver list for the specified device. If this parameter is NULL, SetupDiEnumDriverInfo enumerates the global class driver list that is associated with DeviceInfoSet (this list is of type SPDIT_CLASSDRIVER).
The type of driver list to enumerate, which must be one of the following values:
Enumerate a class driver list. This driver list type must be specified if DeviceInfoData is not specified.
Enumerate a list of compatible drivers for the specified device. This driver list type can be specified only if DeviceInfoData is also specified.
The zero-based index of the driver information member to retrieve.
A pointer to a caller-initialized SP_DRVINFO_DATA structure that receives information about the enumerated driver. The caller must set DriverInfoData.cbSize to sizeof(SP_DRVINFO_DATA) before calling SetupDiEnumDriverInfo. If the cbSize member is not properly set, SetupDiEnumDriverInfo will return FALSE.
The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.
To enumerate driver information set members, an installer should first call SetupDiEnumDriverInfo with the MemberIndex parameter set to 0. It should then increment MemberIndex and call SetupDiEnumDriverInfo until there are no more values. When there are no more values, the function fails and a call to GetLastError returns ERROR_NO_MORE_ITEMS.
If you do not properly initialize the cbSize member of the SP_DRVINFO_DATA structure that is supplied by the pointer DriverInfoData, the function will fail and log the error ERROR_INVALID_USER_BUFFER.
To build a list of drivers associated with a specific device or with the global class driver list for a device information set first use SetupDiBuildDriverInfoList then pass that list to SetupDiEnumDriverInfo.
|Windows version||Available in Microsoft Windows 2000 and later versions of Windows.|
|Header||setupapi.h (include Setupapi.h)|