SetupDiEnumDeviceInterfaces function (转)

本文介绍了一个用于枚举设备接口的函数SetupDiEnumDeviceInterfaces。该函数通过提供的设备信息集返回指定设备接口类的所有实例,包括如何使用参数进行指定设备信息元素及接口类等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 bySetupDiGetClassDevs.

DeviceInfoData [in, optional]

A pointer to an SP_DEVINFO_DATA structure that specifies a device information element inDeviceInfoSet. 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 isNULL, repeated calls to SetupDiEnumDeviceInterfaces return information about the interfaces that are associated with all the device information elements inDeviceInfoSet. 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 withMemberIndex set to zero to obtain the first interface. Then, repeatedly incrementMemberIndex 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 completedSP_DEVICE_INTERFACE_DATA structure that identifies an interface that meets the search parameters. The caller must setDeviceInterfaceData.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 callingGetLastError.

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, callSetupDiGetDeviceInterfaceDetail. The detailed information includes the name of the device interface that can be passed to a Win32 function such asCreateFile (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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值