以下是一些您可能会觉得有用的MSDN链接:
INF制造商部门
INF模型部分
看一下INF文件
INF文件的一般语法规则
你正在寻找的部分被称为 楷模 部分,确实在 生产厂家 部分 - 这是在提到的 楷模 上面链接中的部分文档:
每个models-section-name必须在INF制造商中列出 INF文件的一部分。任何一个或多个条目都可以 每个制造商的型号部分,取决于有多少设备(和 驱动程序)INF文件为特定制造商安装。
这是记录在案的 楷模 部分语法(来自同一链接):
[models-section-name] | [models-section-name.TargetOSVersion] (Windows XP and later versions of Windows) device-description=install-section-name[,hw-id][,compatible-id...] [device-description=install-section-name[,hw-id][,compatible-id]...] ...
如果您想手动解析INF,您可能还会发现一些有用的Windows SetupAPI实用程序,如下所示:
从INF文件中提取文件信息
如果您有兴趣提取仅与特定操作系统版本相关的信息,那么这些API也可能有用:
SetupDiGetActualModelsSection
SetupDiGetActualSectionToInstallEx
最后,如果您只是对硬件ID感兴趣,请使用 的 InfVerif 强> WDK工具 /info @cody提到的标志可能确实是解决问题的最佳方法,因为该工具将为您完成所有必要的解析。
/info
消耗输出可能更容易 InfVerif 作为一部分的实用工具 Windows驱动程序工具包 。您无需安装Visual Studio或其他任何东西即可使用它。
InfVerif
需要一个 /info 以一致格式打印设备信息的标志。例如,在我当前机器上的随机inf文件上运行它:
xusb22.inf Information INF Hash: e41db3fe2103ee21 Family ID: Microsoft-xusb22.inf Device: Xbox 360 Controller for Windows Hardware ID: USB\Vid_045E&Pid_028E Service: xusb22 Section Name: CC_Install Architecture: amd64 Device: Xbox 360 Wireless Receiver for Windows Hardware ID: USB\Vid_045E&Pid_0719 Service: xusb22 Section Name: CC_Install Architecture: amd64 Device: Xbox 360 Controller for Windows Hardware ID: USB\MS_COMP_XUSB10 Service: xusb22 Section Name: CC_Install Architecture: amd64 ...