UsbTreeView中设备驱动信息获取方法

 UsbTreeView是一个专门解析USB设备描述符的工具,可以显示USB设备的一系列属性值。其中包括驱动路径,和inf配置文件路径,查询了一下,没找到可以获取这些驱动信息的SetupApi。好奇这个软件是怎么实现的,于是对它调用的API抓了一下包,找到了它的实现方法。

(1)驱动路径获取方法

可见驱动路径是通过读取注册表

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet\services\usbccgp项的ImagePath子项来获取的。

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet\services是固定位置,usbccgp是设备的service属性值,可以通过调用SetupDiGetDeviceRegistryProperty传参SPDRP_SERVICE来获得。

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet\services下包含一些列的驱动服务子项,每项下面都有ImagePath这一子项,包含了驱动的路径。

(2)inf文件位置

 inf文件位置是通过读取HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0009下的InfPath子项得到。

HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\是固定位置

{4d36e972-e325-11ce-bfc1-08002be10318}\0009是设备的DriverKey,可以通过调用SetupDiGetDeviceRegistryProperty传参SPDRP_DRIVER来获得。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
The USB Device Tree Viewer, short UsbTreeView is based upon the Microsoft "USBView" sample application found in the Windows Driver Development Kits and now standalone at GitHub. But it is source code only, there is no executable for end users provided. Meanwhile USBView comes as executables as part of the "Debugging Tools für Windows", see here: USBView. UsbTreeView started with the USBView source code from the DDK for Server 2003. Here are the improvements I've done: Informations from the Windows Device Management are collected and matched with the found USB devices; Therefore UsbTreeView can show the child devices, including drive letters and COM-ports Window position is saved Background color and font of the right pane can be set (the font shown in the screenshots is DOSLike 7) Text output rearranged Keeps the tree item selection over refresh way more descriptors are decoded, as Audio 2.0 Hexdump of the descriptors can be shown Safe removal, device restart and port restart Extended USB information available under Windows 8 (taken from the latest USBView sample application) Extended information about host controllers Enumeration of the USB devices accelerated and independent from the treeview Failed USB requests are re-tried in the background, e.g. if a USB mouse was moved while requesting its properties Toolbar with jump-lists for easily finding devices in complex trees TreeView with handmade 16x16 icons, USBView used 32x32 icons scaled down to 15x15 many minor improvements With V3.0 No more enumeration of all devices on arrival and removal of a USB device Search function (not full text, only things like device ID, drive letter, volume name etc) Some new Keyboard shortcuts (Alt+D to open the drives list, Alt+O the Others list, Alt+S to focus the search edit, Alt+Left/Right to cycle thru the search hits Options not to expand empty hubs or hub with only empty hubs attached Options to jump to arrived and removed devices Option to expand tree items to make selected

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值