USB控制器
+ -

USB控制器驱动注册表键名称DriverKeyName

2023-10-20 265 0

使用IOCTL_GET_HCD_DRIVERKEY_NAME获取USB驱动注册表键值名称。

DriverKeyName是一个Windows驱动程序的注册表键名。在Windows操作系统中,驱动程序使用注册表来存储设备和驱动程序的相关信息。DriverKeyName指的是驱动程序在注册表中的键名,它通常用于标识驱动程序和设备之间的关联关系。通过DriverKeyName,操作系统可以查找并加载正确的驱动程序,以支持设备的正常工作。

请注意,具体的DriverKeyName的命名和结构可能会因驱动程序的不同而有所差异。它一般由厂商提供的驱动程序开发工具生成,并根据设备的硬件特性和功能进行命名。在注册表中,DriverKeyName通常位于HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\下,用于存储与设备相关的信息。

对于USB控制器,可以通过以下测试代码来获取

#include <iostream>
#include <windows.h>
#include <tchar.h>
#include <usbdi.h>

VOID UsbControlInfo(HANDLE h)
{
    char buff[1024] = { 0 };
    ULONG rtn = 0;
    BOOL isok = DeviceIoControl(h, IOCTL_GET_HCD_DRIVERKEY_NAME, NULL, 0, buff, sizeof(buff), &rtn, NULL);
    if (isok)
    {
        PUSB_HCD_DRIVERKEY_NAME pInfo = (PUSB_HCD_DRIVERKEY_NAME)buff;
        printf("%ws\n", pInfo->DriverKeyName);
    }
}

#define NUM_HCS_TO_CHECK 10
VOID EnumerateHostControllers()
{
    TCHAR        HCName[16];
    for (int HCNum = 0; HCNum < NUM_HCS_TO_CHECK; HCNum++)
    {
        _stprintf_s(HCName, sizeof(HCName) / sizeof(HCName[0]), _T("\\\\.\\HCD%d"), HCNum);
        HANDLE hHCDev = CreateFile(HCName,
            GENERIC_WRITE,
            FILE_SHARE_WRITE,
            NULL,
            OPEN_EXISTING,
            0,
            NULL);
        if (hHCDev != INVALID_HANDLE_VALUE)
        {
            UsbControlInfo(hHCDev);
            CloseHandle(hHCDev);
        }
    }
}
int main()
{
    EnumerateHostControllers();
    return 0;
}

在本人电脑中输出为:

{36fc9e60-c465-11cf-8056-444553540000}\0002
{4d36e97d-e325-11ce-bfc1-08002be10318}\0071

而以上2个正对对应本人电脑中2个USB控制器的驱动键名:

这里使用USBTreeViewer来展示

  ===================== USB Host Controller =======================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : USB Redirector Technician Edition Virtual USB Host Controller
Device ID                : ROOT\SYSTEM\0002
Hardware IDs             : *ttechusbdhcDevice
Driver KeyName           : {4d36e97d-e325-11ce-bfc1-08002be10318}\0071 (GUID_DEVCLASS_SYSTEM)
Driver                   : \SystemRoot\System32\drivers\ttechusbdbus.sys (Version: 1.9.7.3130  Date: 2021-04-12)
Driver Inf               : C:\Windows\inf\oem148.inf
Legacy BusType           : Internal
Class                    : System
Class GUID               : {4d36e97d-e325-11ce-bfc1-08002be10318} (GUID_DEVCLASS_SYSTEM)
Service                  : ttechusbdbus
Enumerator               : ROOT
Location Info            : -
Container ID             : {00000000-0000-0000-FFFF-FFFFFFFFFFFF} (GUID_CONTAINERID_INTERNALLY_CONNECTED_DEVICE)
Manufacturer Info        : SimplyCore LLC
Capabilities             : 0x00 (-)
Status                   : 0x0180200B (DN_ROOT_ENUMERATED, DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Power State              : D0 (supported: D0, D3)

{36fc9e60-c465-11cf-8056-444553540000}\0002

另一个为:

 ===================== USB Host Controller =======================

        +++++++++++++++++ Device Information ++++++++++++++++++
Friendly Name            : Intel(R) USB 3.10 可扩展主机控制器 - 1.10 (Microsoft)
Device Description       : 符合 USB xHCI 的主机控制器
Device Path              : \\?\PCI#VEN_8086&DEV_34ED&SUBSYS_097B1028&REV_30#3&11583659&1&A0#{3abf6f2d-71c4-462a-8a92-1e6861e6af27} (GUID_DEVINTERFACE_USB_HOST_CONTROLLER)
Kernel Name              : \Device\NTPNP_PCI0003
Device ID                : PCI\VEN_8086&DEV_34ED&SUBSYS_097B1028&REV_30\3&11583659&1&A0
Vendor                   : Intel
Hardware IDs             : PCI\VEN_8086&DEV_34ED&SUBSYS_097B1028&REV_30 PCI\VEN_8086&DEV_34ED&SUBSYS_097B1028 PCI\VEN_8086&DEV_34ED&CC_0C0330 PCI\VEN_8086&DEV_34ED&CC_0C03
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0002 (GUID_DEVCLASS_USB)
Driver                   : \SystemRoot\System32\drivers\USBXHCI.SYS (Version: 10.0.18362.900  Date: 2020-06-29)
Driver Inf               : C:\Windows\inf\usbxhci.inf
Legacy BusType           : PCIBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service                  : USBXHCI
Enumerator               : PCI
Location Info            : PCI bus 0, device 20, function 0
Location IDs             : PCIROOT(0)#PCI(1400), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)
Container ID             : {00000000-0000-0000-ffff-ffffffffffff} (GUID_CONTAINERID_INTERNALLY_CONNECTED_DEVICE)
Manufacturer Info        : 通用 USB xHCI 主机控制器
Capabilities             : 0x00 (-)
Status                   : 0x0180200A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Address                  : 1310720 (0x140000)
IdleInWorkingState       : 1
Power State              : D0 (supported: D0, D3, wake from D0, wake from D3)
 Child Device 1          : USB 根集线器(USB 3.0)
  Device Path            : \\?\USB#ROOT_HUB30#4&2dd4af6a&2&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8} (GUID_DEVINTERFACE_USB_HUB)
  Kernel Name            : \Device\USBPDO-0
  Device ID              : USB\ROOT_HUB30\4&2DD4AF6A&2&0
  Class                  : USB
  Driver KeyName         : {36fc9e60-c465-11cf-8056-444553540000}\0006 (GUID_DEVCLASS_USB)
  Service                : USBHUB3
  LocationPaths          : PCIROOT(0)#PCI(1400)#USBROOT(0)  ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)
  IdleInWorkingState     : 1

{4d36e97d-e325-11ce-bfc1-08002be10318}\0071

HID人机交互QQ群:564808376    UAC音频QQ群:218581009    UVC相机QQ群:331552032    BOT&UASP大容量存储QQ群:258159197    STC-USB单片机QQ群:315457461    USB技术交流QQ群2:580684376    USB技术交流QQ群:952873936   

0 篇笔记 写笔记

USBIP USB控制器驱动键名称DriverKeyName
IOCTL_GET_HCD_DRIVERKEY_NAME用于获取USB主机控制器驱动注册表键值的名称即DriverKeyName。PAGEABLE NTSTATUSvhci_ioctl_vhci(pvhci_dev_t vhci, PIO_STACK_LOCATION irpstack, ULO......
USB控制器驱动注册表键名称DriverKeyName
使用IOCTL_GET_HCD_DRIVERKEY_NAME获取USB驱动注册表键值名称。DriverKeyName是一个Windows驱动程序的注册表键名。在Windows操作系统中,驱动程序使用注册表来存储设备和驱动程序的相关信息。DriverKeyName指的是驱动程序在注册表中的键名,它通......
USBIP 集线器的IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME/DirverKeyName
和USB控制器一样,也有DriverKeyName case IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME: status = get_node_driverkey_name(vhub, buffer, inlen, poutlen......
关注公众号
  • HID人机交互
  • Linux&USB
  • UAC音频
  • TYPE-C
  • USB规范
  • USB大容量存储
  • USB百科
  • USB周边
  • UVC摄像头
  • Windows系统USB
  • 音视频博客
  • 取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

    打开支付宝扫一扫,即可进行扫码打赏哦

    您的支持,是我们前进的动力!