正在解析WMI中Win32_PnPEntities的层次结构
Resolving hierarchy of Win32_PnPEntities in WMI
当USB设备插入或拔出时,我使用WMI查询来接收事件。
SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_USBControllerDevice'
从接收到的事件中,我使用Dependent
对象来获取Win32_PnPEntity。
问题是,对于几乎所有的物理设备,都至少有两个逻辑设备。所以我收到的数据如下:
Device unplugged: LPK25
Device unplugged: USB Composite Device
Device plugged: LPK25
instance of Win32_PnPEntity
{
Caption = "LPK25";
ClassGuid = "{4d36e96c-e325-11ce-bfc1-08002be10318}";
CompatibleID = {"USB\Class_01&SubClass_01&Prot_00", "USB\Class_01&SubClass_01", "USB\Class_01"};
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_PnPEntity";
Description = "USB Audio Device";
DeviceID = "USB\VID_09E8&PID_0076&MI_00\6&383464A1&0&0000";
HardwareID = {"USB\VID_09E8&PID_0076&REV_0100&MI_00", "USB\VID_09E8&PID_0076&MI_00"};
Manufacturer = "(Generic USB Audio)";
Name = "LPK25";
PNPDeviceID = "USB\VID_09E8&PID_0076&MI_00\6&383464A1&0&0000";
Service = "usbaudio";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "COMPUTER";
};
Device plugged: USB Composite Device
instance of Win32_PnPEntity
{
Caption = "USB Composite Device";
ClassGuid = "{36fc9e60-c465-11cf-8056-444553540000}";
CompatibleID = {"USB\DevClass_00&SubClass_00&Prot_00", "USB\DevClass_00&SubClass_00", "USB\DevClass_00", "USB\COMPOSITE"};
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_PnPEntity";
Description = "USB Composite Device";
DeviceID = "USB\VID_09E8&PID_0076\5&385A3465&0&2";
HardwareID = {"USB\VID_09E8&PID_0076&REV_0100", "USB\VID_09E8&PID_0076"};
Manufacturer = "(Standard USB Host Controller)";
Name = "USB Composite Device";
PNPDeviceID = "USB\VID_09E8&PID_0076\5&385A3465&0&2";
Service = "usbccgp";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "COMPUTER";
};
显然,其中的LPK25是真正的设备,而USB复合设备是一些伪实体。对于一只老鼠,我得到四个实体。对于游戏控制器三等。那么,我该如何判断其中哪一个是"真实的东西"呢?
据我所知,你在制造混乱,对我来说,你收到两个事件是正常的。这是因为出现了两个新对象。
usbccgp
的低级别对象是usb音频的低级别驱动程序- 支持音频硬件的高级对象
我认为您必须按服务进行筛选,例如,我使用USB密钥进行测试,我有两个事件,一个用于USBSTOR
(低级别),另一个用于disk
(高级别)。
相关文章:
- 如何重构类层次结构以避免菱形问题
- C++ 中模板化类型的类层次结构
- 为什么不同类型层次结构的指针之间的dynamic_cast定义得很好?
- 继承层次结构并将元素添加到向量
- C++ 类层次结构中的"对齐"是什么意思?
- 相同的层次结构,访问基类的受保护成员时的行为不同
- 类层次结构中的运算符重载
- 如何在层次结构中实现运算符使用?
- 反向层次结构中的可变参数模板参数
- 如何在继承层次结构中调用具有默认参数的构造函数?
- C++ 提升 - 包含类层次结构对象的类的序列化
- 在C++继承层次结构时提取实现者
- 在C++中将类实例添加到对象层次结构中的问题
- 确定大层次结构中基本指针的实际类型,无需dynamic_cast
- 在继承层次结构中复制和移动
- 模板冲突的类型-但类型应该是相同的cfr类层次结构
- 使用C++绘制数据结构图
- 删除父/子窗口层次结构的最佳方法
- 是否可以使一个类成为两个不同层次结构的子类?
- 我们可以在层次结构中创建多个纯虚拟接口及其实现而不会代码爆炸吗?