Platform SDK: Hardware

SetupDiEnumDeviceInterfaces

The SetupDiEnumDeviceInterfaces function retrieves a context structure for a device interface of a device information set. Each call returns information about one device interface. The function can be called repeatedly to get information about several interfaces exposed by one or more devices.

BOOL SetupDiEnumDeviceInterfaces(
  HDEVINFO DeviceInfoSet,
  PSP_DEVINFO_DATA DeviceInfoData, 
  CONST LPGUID InterfaceClassGuid,
  DWORD MemberIndex,
  PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
);

Parameters

DeviceInfoSet
[in] Pointer to a device information set containing the devices for which to return interface information. This handle is typically returned by the SetupDiGetClassDevs or SetupDiGetClassDevsEx function.
DeviceInfoData
[in] An optional pointer to an SP_DEVINFO_DATA structure that constrains the search for interfaces to those of just one device in the device information set.
InterfaceClassGuid
[in] Pointer to a GUID that specifies the device interface class for the requested interface.
MemberIndex
[in] Specifies a zero-based index to the list of interfaces in the device information set. You should first call this function with the MemberIndex parameter 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 the DeviceInfoData parameter specifies a particular device, MemberIndex applies only to the interfaces exposed by that device.

DeviceInterfaceData
[out] Pointer to a buffer that contains, on successful return, a completed SP_DEVICE_INTERFACE_DATA structure that identifies an interface that meets the search parameters. You must set the cbSize member to sizeof(SP_DEVICE_INTERFACE_DATA) before calling this function.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The DeviceInterfaceData member is a pointer to a structure that identifies a requested device interface. To get detailed information about an interface, call the SetupDiGetDeviceInterfaceDetail function. The detailed information includes the name of the device interface that can be passed to a function (such as CreateFile) to get a handle to the interface.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Setupapi.h.
  Library: Use Setupapi.lib.

See Also

Device Management Overview, Device Management Functions, SetupDiGetClassDevs, SetupDiGetClassDevsEx, SetupDiGetDeviceInterfaceDetail, SP_DEVICE_INTERFACE_DATA, SP_DEVINFO_DATA