devcon工具使用
+ -

DevCon DriverFiles命令

2022-01-28 67 0

显示指定设备的已安装 INF 文件和设备驱动程序文件的完整路径和文件名。 仅在本地计算机上有效。

命令格式

devcon driverfiles {* | ID [ID ...] | =class [ID [ID ...]]}

* 表示计算机上的所有设备。
ID 指定设备的所有或部分硬件 ID、兼容 ID 或设备实例 ID。 指定多个 ID 时,在每个 ID 之间键入一个空格。 包含字符和字符的(&) 必须用引号引起来。

以下特殊字符修改 ID 参数。

字符 说明
匹配任何字符或无字符。 使用通配符 () 创建 ID 模式,例如磁盘。
@ 指示设备实例 ID,例如 @ROOT\FTDISK\0000 。
‘(单引号) 与字符串在字面上 (与字符串在文本) 。 在字符串前加单引号以指示星号是 ID 名称的一部分,而不是通配符,例如 “*PNP0600”,其中*PNP0600 (包括星号) 是硬件 ID。
= class 指定设备的设备类。 =字符串标识为类名。

还可以在类名后指定硬件 ID、兼容的 ID、设备实例 ID 或 ID 模式。 在每个 ID 或模式之间键入空格。 DevCon 在 类中查找与指定 ID 匹配的设备。

使用方法

devcon driverfiles *
devcon driverfiles FDC\GENERIC_FLOPPY_DRIVE pci*
devcon driverfiles =media
devcon driverfiles =media isapnp*

使用示例

devcon.exe driverfiles @"PCI\VEN_8086&DEV_A12F&SUBSYS_72708086&REV_31\3&11583659&0&A0"

输出为:

PCI\VEN_8086&DEV_A12F&SUBSYS_72708086&REV_31\3&11583659&0&A0
    Name: Intel(R) USB 3.0 eXtensible Host Controller - 1.0 (Microsoft)
    Driver installed from C:\Windows\INF\usbxhci.inf [Generic.Install]. 1 file(s) used by driver:
        C:\Windows\system32\DRIVERS\USBXHCI.SYS
1 matching device(s) found.

INF文件
驱动名

实现原理

一种是通过SetupDiOpenDevRegKey打开注册表的方式,
另一种是通过

  if(!SetupDiGetDeviceInstallParams(Devs, DevInfo, &deviceInstallParams)) {
        return FALSE;
    }

    //
    // Set the flags that tell SetupDiBuildDriverInfoList to just put the
    // currently installed driver node in the list, and that it should allow
    // excluded drivers. This flag introduced in WinXP.
    //
    deviceInstallParams.FlagsEx |= (DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS);

    if(SetupDiSetDeviceInstallParams(Devs, DevInfo, &deviceInstallParams)) {
        //
        // we were able to specify this flag, so proceed the easy way
        // we should get a list of no more than 1 driver
        //
        if(!SetupDiBuildDriverInfoList(Devs, DevInfo, SPDIT_CLASSDRIVER)) {
            return FALSE;
        }
        if (!SetupDiEnumDriverInfo(Devs, DevInfo, SPDIT_CLASSDRIVER,
                                   0, DriverInfoData)) {
            return FALSE;
        }
        //
        // we've selected the current driver
        //

    }

更多详见:SetupAPI根据硬件ID获取驱动INF文件和驱动日期版本信息

0 篇笔记 写笔记

devcon.exe driverfiles显示设备驱动
devcon.exe driverfiles "USBVID_0483&PID_3748&REV_0100"USBVID_0483&PID_37485&1E7D8DB7&0&5 Name: STM32 STLink......
DevCon DriverFiles命令
显示指定设备的已安装 INF 文件和设备驱动程序文件的完整路径和文件名。 仅在本地计算机上有效。命令格式devcon driverfiles {* | ID [ID ...] | =class [ID [ID ...]]}* 表示计算机上的所有设备。ID 指定设备的所有或部分硬件 ID、兼容 I......
作者信息
我爱内核
Windows驱动开发,网站开发
好好学习,天天向上。
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

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

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