Expand Minimize

SetupDiEnumDeviceInterfaces function

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

Syntax


BOOL SetupDiEnumDeviceInterfaces(
  _In_      HDEVINFO DeviceInfoSet,
  _In_opt_  PSP_DEVINFO_DATA DeviceInfoData,
  _In_      const GUID *InterfaceClassGuid,
  _In_      DWORD MemberIndex,
  _Out_     PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
);

Parameters

DeviceInfoSet [in]

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

DeviceInfoData [in, optional]

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.

InterfaceClassGuid [in]

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

MemberIndex [in]

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.

DeviceInterfaceData [out]

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 System Defined Device Interface Classes for a list of available device interface classes.

Requirements

Version

Available in Microsoft Windows 2000 and later versions of Windows.

Header

Setupapi.h (include Setupapi.h)

Library

Setupapi.lib

See also

SetupDiGetClassDevs
SetupDiEnumDeviceInfo
SetupDiGetDeviceInterfaceDetail

 

 

Send comments about this topic to Microsoft

Build date: 2/13/2014

Show:
© 2014 Microsoft. All rights reserved.