Windows 设备管理器和硬件 ID

发布于 2024-07-19 02:25:25 字数 191 浏览 8 评论 0原文

我很好奇 Windows 设备管理器如何获取设备的硬件 ID,即使尚未为该设备加载设备驱动程序。 有人知道 Windows 是如何处理这个问题的吗?

与此相关的是,我有兴趣支持我们正在编写的软件的语言本地化; 设备和/或驱动程序是否可以以本地化方式报告其友好名称和描述? 这已经有一个常见的做法了吗?

谢谢你的时间。

I'm curious how the windows device manager obtains the hardware IDs for a device, even though no device driver may be loaded for the device yet. Anybody have a clue on how Windows goes on about this?

On a related note, I am interested in supporting language localization for the software we are writing; is it possible for a device and/or driver to report back its friendly name and description in a localized fashion? Is there a common practice for this already?

Thanks for your time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

迷路的信 2024-07-26 02:25:25

首先,要了解驱动程序加载的顺序,建议您将设备管理器切换到View | 按连接模式划分的设备。

正如您所注意到的,这些设备位于其总线驱动程序下方。 对于 PCI 设备,它将是“PCI 总线”。 对于 USB 设备,它是它们的 USB 集线器。 每个总线驱动程序对于如何格式化标识符字符串都有自己的想法:

  • 设备实例 ID
  • 硬件 ID
  • 兼容 ID
  • 位置等。

它返回它们以响应 IRP_MN_QUERY_ID (BusQueryInstanceIDBusQueryHardwareIDsBusQueryCompatibleIDs)和IRP_MN_QUERY_DEVICE_TEXTDeviceTextDescriptionDeviceTextLocationInformation等)

的当然,由于总线驱动程序首先枚举了设备(即创建了您所看到的子设备)(通过适合总线的任何标准接口;例如USB上的“获取设备/字符串描述符”),因此它知道它们的供应商ID、产品ID等。

此时不必加载设备的驱动程序。 事实上,它无法加载。 设备 ID 准确地指示 PnP 系统哪个驱动程序与设备匹配。

至于本地化:

与提供用于设备匹配的不透明字符串的 IRP_MN_QUERY_ID 不同,IRP_MN_QUERY_DEVICE_TEXT 信息确实旨在本地化。 为此,您会在输入数据 (Parameters.QueryDeviceText.LocaleId) 中收到请求的区域设置 ID (LCID)。

[正如 Alphaneo 所指出的,USB 集线器驱动程序可能会将此 LCID 向前传递到 USB 设备(在获取字符串描述符请求内),希望 USB 设备本身具有本地化字符串。]

First, to understand the order of drivers being loaded, you're recommended to switch the Device Manager into View | Devices by Connection mode.

As you would notice, the devices are located below their bus driver. For PCI devices, it'll be "PCI bus". For USB devices, it would be their USB hub. Each bus driver has its own idea about how the identifier strings should be formatted:

  • Device Instance Id
  • Hardware Ids
  • Compatible Ids
  • Location, etc.

It returns them in response to IRP_MN_QUERY_ID (BusQueryInstanceID, BusQueryHardwareIDs, BusQueryCompatibleIDs) and IRP_MN_QUERY_DEVICE_TEXT (DeviceTextDescription, DeviceTextLocationInformation etc.)

Of course, since the bus driver enumerated the devices (i.e. created the child devices you're seeing) in the first place (through whatever standard interface appropriate for the bus; e.g. 'Get Device/String Descriptor' on USB), it knows their vendor ID, product ID etc.

The device's driver does not have to be loaded at this time. In fact, it can't be loaded. The device IDs are precisely what instructs the PnP system as to which driver matches the device.

As to localization:

Unlike IRP_MN_QUERY_ID, which provides opaque strings intended for device matching, the IRP_MN_QUERY_DEVICE_TEXT information was indeed intended to be localized. For that purpose, you receive the requested Locale ID (LCID) in the input data (Parameters.QueryDeviceText.LocaleId).

[As Alphaneo noted, a USB hub driver might pass this LCID onwards to the USB device (within a Get String Descriptor request), hoping that the USB device itself has localized strings.]

秋风の叶未落 2024-07-26 02:25:25

顶层过程称为枚举。 大多数现代设备总线都支持一种机制,让操作系统可以查询总线并确定哪些设备连接到总线。

PCI 系列总线均支持枚举。 PCI 总线为此有一个特殊的枚举空间。 这就是“即插即用”ID 的由来。

设备 ID 唯一标识总线上的设备,并使操作系统能够找到该设备的正确驱动程序。

其他总线,包括 USB 和 FireWire 都有枚举策略

The top level process is called enumeration. Most modern device buses support a mechanism that lets the OS query the buss and determine what devices are connected to the bus.

The PCI family of buses all support enumeration. The PCI bus has a special enumeration space just for this. This is where "Plug-n-Play" ID's come from.

The device id's uniquely identify a device on the bus and enable the OS to find the correct driver for that device.

Other buses, including USB and FireWire have enumeration strategies

一页 2024-07-26 02:25:25

设备 ID 是设备给出的信息的组合。 例如,对于 USB 设备,该字符串基于 VID 和 PID(供应商 ID 和产品 ID)。 现在,如果没有加载驱动程序,就不会发生这种情况。 至少必须加载一些驱动程序、总线驱动程序,操作系统才能获取设备 ID。

现在,对于语言支持,我想对于 WDM 驱动程序,有一个 QUERY_LANG 或其他东西,我记不太清了,或者某些设备(例如 USB)具有语言 ID 支持。 该语言 ID 确定产品描述符字符串的语言。

Device ID, is a combination of information given from the device. For example, for a USB device, the string is based on the VID and PID (Vendor ID and Product ID). Now, this cannot happen if no driver is loaded. Atleast some driver, bus driver would have to be loaded for the OS to get the Device ID.

Now, for language support, I guess for WDM driver, there is a QUERY_LANG or something, I dont remember properly, alternatively some devices like USB, have Language ID support. This language ID determines the language of the Product descriptor string.

乖乖哒 2024-07-26 02:25:25

请注意,硬件标识符/序列号与真正的唯一硬件 ID 之间存在差异。 也许这会更好地解释它:
http://www.soft.tahionic.com /download-hdd_id/hardware%20ID%20programmer%27s%20DLL.html

Please note that there is a difference between the hardware identifier/serial number and the true unique hardware ID. Maybe this will explain it better:
http://www.soft.tahionic.com/download-hdd_id/hardware%20ID%20programmer%27s%20DLL.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文