SetupDiEnumDeviceInfo function

The SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set.

Syntax

WINSETUPAPI BOOL SetupDiEnumDeviceInfo(
  HDEVINFO         DeviceInfoSet,
  DWORD            MemberIndex,
  PSP_DEVINFO_DATA DeviceInfoData
);

Parameters

DeviceInfoSet

A handle to the device information set for which to return an SP_DEVINFO_DATA structure that represents a device information element.

MemberIndex

A zero-based index of the device information element to retrieve.

DeviceInfoData

A pointer to an SP_DEVINFO_DATA structure to receive information about an enumerated device information element. The caller must set DeviceInfoData.cbSize to sizeof(SP_DEVINFO_DATA).

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.

Remarks

Repeated calls to this function return a device information element for a different device. This function can be called repeatedly to get information about all devices in the device information set.

To enumerate device information elements, an installer should initially call SetupDiEnumDeviceInfo with the MemberIndex parameter set to 0. The installer should then increment MemberIndex and call SetupDiEnumDeviceInfo until there are no more values (the function fails and a call to GetLastError returns ERROR_NO_MORE_ITEMS).

Call SetupDiEnumDeviceInterfaces to get a context structure for a device interface element (versus a device information element).

Requirements

   
Windows version Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib
DLL Setupapi.dll

See Also

SP_DEVINFO_DATA

SetupDiCreateDeviceInfo

SetupDiDeleteDeviceInfo

SetupDiEnumDeviceInterfaces

SetupDiOpenDeviceInfo