SetupDiEnumDeviceInterfaces
BOOL SetupDiEnumDeviceInterfaces(
HDEVINFO DeviceInfoSet, //設備訊息集
PSP_DEVINFO_DATA DeviceInfoData, //額外的設備描述
const GUID* InterfaceClassGuid, //GUID
DWORD MemberIndex, //設備訊息集裡的設備序號
PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData // Output
);
Parameters
DeviceInfoSet
[in] Handle 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] Pointer to an SP_DEVINFO_DATA structure that constrains the search for interfaces to those of just one device in the device information set. This parameter is optional.
InterfaceClassGuid
[in] Pointer to a GUID that specifies the device interface class for the requested interface.
MemberIndex
[in] 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 an SP_DEVICE_INTERFACE_DATA structure that receives information for the device interface. You must set the cbSize member to sizeof( SP_DEVICE_INTERFACE_DATA) before calling this function.
------------------------------------------------------------------------------------------------------------------------------------------------------------
SetupDiEnumDeviceInfo
BOOL SetupDiEnumDeviceInfo(
HDEVINFO DeviceInfoSet, //設備訊息集
DWORD MemberIndex, //設備訊息集裡的設備序號
PSP_DEVINFO_DATA DeviceInfoData // Output
);
Parameters
DeviceInfoSet
[in] Handle to the device information set containing the devices for which to return element information.
MemberIndex
[in] 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.
DeviceInfoData
[out] Pointer to an SP_DEVINFO_DATA structure that receives information about this element. You must set the cbSize member to sizeof( SP_DEVINFO_DATA) before calling this function.
------------------------------------------------------------------------------------------------------------------------------------------------------------
SetupDiEnumDeviceInterfaces 跟 SetupDiEnumDeviceInfo 的差別
SetupDiEnumDeviceInterfaces :已經知道Class GUID, 只列舉出這個GUID符合的設備
呼叫順序:
SetupDiGetClassDevs() //列舉出特定GUID的Information Set
[...]
SetupDiEnumDeviceInterfaces() //列舉符合該GUID的設備接口
[...]
SetupDiGetInterfaceDeviceDetail() //取得該設備接口的細節(設備路徑)
EX: iPod Downloader
SetupDiEnumDeviceInfo :不知道設備的GUID, 列舉出所有設備
呼叫順序:
SetupDiGetClassDevs(..., DIGCF_ALLCLASSES) //列舉出所有已安裝的設備 (第一個參數會被忽略)
[...]
SetupDiEnumDeviceInfo() //取得該設備的細節(設備路徑, 不用把GUID當作參數帶入)
EX: MobileDevice.dll
沒有留言:
張貼留言