获取父设备 [英] Get parent device
问题描述
我有两个USB设备ID,例如 USB\VID_E4F1和放大器; PID_0661\00000115FA9CE7750000000000000000
和 USB\VID_E4F1和放大器; PID_0661&安培; MI_00\7&安培; B5A5DDF&安培; 0&安培; 0000
I have two USB device IDs, e.g. USB\VID_E4F1&PID_0661\00000115FA9CE7750000000000000000
and USB\VID_E4F1&PID_0661&MI_00\7&B5A5DDF&0&0000
如何验证设备#2的设备#1(物理上它们是相同的USB复合设备的不同部分)的直接孩子?
How to verify device #2 is a direct child of device #1 (physically they’re different parts of the same USB composite device)?
在现实生活中的情景将是许多人连接到同一个USB控制器。此外,有可能他们会在同一品牌和型号的。这就是为什么我不能验证VID,PID,并使用 Win32_USBControllerDevice
WMI查询,以验证它们插入到相同的USB控制器 - 我需要以某种方式确认亲子关系,不只是事实他们插入到相同的控制器。
In real-life scenarios it will be many of them connected to the same USB controller. Moreover, it's possible they'll be of the same maker and model. That's why I cant verify the VID, PID, and use Win32_USBControllerDevice
WMI query to verify they're plugged into the same USB controller - I need to somehow verify the parent-child relation, not just the fact they're plugged into the same controller.
如果它很重要,我只需要支持Windows 8 +。
If it matters, I only need to support Windows 8+.
推荐答案
的即插即用配置管理器API 是你的朋友在这里:
-
<一个HREF =http://msdn.microsoft.com/en-us/library/windows/hardware/ff538742%28v=vs.85%29.aspx相对=nofollow> CM_Locate_DevNode 打开设备句柄给予设备ID;
CM_Locate_DevNode opens a device handle given a device ID;
的 CM_Get_Parent 找到父设备;
的 CM_Get_Device_ID_Size 和的 CM_Get_Device_ID 取设备句柄,并返回设备ID
CM_Get_Device_ID_Size and CM_Get_Device_ID take the device handle and return the device ID.
这篇关于获取父设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!