SetupDiEnumDeviceInterfaces function (setupapi.h)

The SetupDiEnumDeviceInterfaces function enumerates the device interfaces that are contained in a device information set.

Syntax

WINSETUPAPI BOOL SetupDiEnumDeviceInterfaces(
  [in]           HDEVINFO                  DeviceInfoSet,
  [in, optional] PSP_DEVINFO_DATA          DeviceInfoData,
  [in]           const GUID                *InterfaceClassGuid,
  [in]           DWORD                     MemberIndex,
  [out]          PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
);

Parameters

[in] DeviceInfoSet

A pointer to a device information set that contains the device interfaces for which to return information. This handle is typically returned by SetupDiGetClassDevs.

[in, optional] DeviceInfoData

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, SetupDiEnumDeviceInterfaces constrains the enumeration to the interfaces that are supported by the specified device. If this parameter is NULL, repeated calls to SetupDiEnumDeviceInterfaces return information about the interfaces that are associated with all the device information elements in DeviceInfoSet. This pointer is typically returned by SetupDiEnumDeviceInfo.

[in] InterfaceClassGuid

A pointer to a GUID that specifies the device interface class for the requested interface.

[in] MemberIndex

A zero-based index into the list of interfaces in the device information set. The caller should call this function first with MemberIndex set to zero to obtain the first interface. Then, repeatedly increment MemberIndex and retrieve an interface until this function fails and GetLastError returns ERROR_NO_MORE_ITEMS.

If DeviceInfoData specifies a particular device, the MemberIndex is relative to only the interfaces exposed by that device.

[out] DeviceInterfaceData

A pointer to a caller-allocated buffer that contains, on successful return, a completed SP_DEVICE_INTERFACE_DATA structure that identifies an interface that meets the search parameters. The caller must set DeviceInterfaceData.cbSize to sizeof(SP_DEVICE_INTERFACE_DATA) before calling this function.

Return value

SetupDiEnumDeviceInterfaces returns TRUE if the function completed without error. If the function completed with an error, FALSE is returned and the error code for the failure can be retrieved by calling GetLastError.

Remarks

Repeated calls to this function return an SP_DEVICE_INTERFACE_DATA structure for a different device interface. This function can be called repeatedly to get information about interfaces in a device information set that are associated with a particular device information element or that are associated with all device information elements.

DeviceInterfaceData points to a structure that identifies a requested device interface. To get detailed information about an interface, call SetupDiGetDeviceInterfaceDetail. The detailed information includes the name of the device interface that can be passed to a Win32 function such as CreateFile (described in Microsoft Windows SDK documentation) to get a handle to the interface.

See Overview of Device Interface Classes for more info.

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
DLL Setupapi.dll
API set ext-ms-win-setupapi-classinstallers-l1-1-2 (introduced in Windows 10, version 10.0.14393)

See also

SetupDiEnumDeviceInfo

SetupDiGetClassDevs

SetupDiGetDeviceInterfaceDetail