Warm tip: This article is reproduced from stackoverflow.com, please click
c# windows device-instance-id

Get parent device

发布于 2020-03-27 10:18:16

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

How to verify device #2 is a direct child of device #1 (physically they’re different parts of the same USB composite device)?

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.

If it matters, I only need to support Windows 8+.

Questioner
Soonts
Viewed
126
Harry Johnston 2014-09-25 04:23

The PnP Configuration Manager API is your friend here: