Previous Next

SetupDiEnumDeviceInterfaces

The SetupDiEnumDeviceInterfaces function returns a context structure for a device interface element 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.

WINSETUPAPI BOOL WINAPI
  SetupDiEnumDeviceInterfaces(
    IN HDEVINFO  DeviceInfoSet,
    IN PSP_DEVINFO_DATA  DeviceInfoData,  OPTIONAL
    IN LPGUID  InterfaceClassGuid,
    IN DWORD  MemberIndex,
    OUT PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData
    );

Parameters

DeviceInfoSet
Pointer to a device information set containing the device(s) for which to return interface information. This handle is typically returned by SetupDiGetClassDevs.
DeviceInfoData
Optionally points to an SP_DEVINFO_DATA structure that constrains the search for interfaces to those of just one device in the device information set. This pointer is typically returned by SetupDiEnumDeviceInfo.
InterfaceClassGuid
Pointer to a GUID that specifies the device interface class for the requested interface.
MemberIndex
Specifies 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
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.

Headers

Declared in setupapi.h. Include setupapi.h.

Comments

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 Platform SDK documentation) to get a handle to the interface.

See Also

SetupDiGetClassDevs, SetupDiEnumDeviceInfo, SetupDiGetDeviceInterfaceDetail