The Plug and Play (PnP) manager and Setup use device identification strings to identify devices that are installed in a computer.
Setup uses the following device identification strings to locate the information (INF) file that best matches the device. These strings are reported by a device's enumerator:
Pnp管理器和安装程序是通过设备标识字符串来将匹配安装一个设备到电脑中的。安装程序通过下面的设备标识字符串来找到和这个设备匹配的inf文件:
Device IDs(设备ID)
A device ID is a vendor-defined identification string that is the most specific ID that Setup uses to match a device to an INF file. A device has only one device ID. A device ID has the same format as a hardware ID. When an enumerator reports a list of hardware IDs for a device, the device ID should be the first hardware ID in the list.
The Plug and Play (PnP) manager uses the device ID to create a subkey for a device under the registry key for the device's enumerator.
To obtain a device ID, use an IRP_MN_QUERY_ID request and set the Parameters.QueryId.IdType field to BusQueryDeviceID.
设备ID是大多数厂商都会指定的ID以便安装程序用来找到与设备相匹配的inf文件。一个设备只能有一个设备ID。设备ID有着和硬件ID一样的格式。在枚举器上报一个设备的硬件ID列表时,设备ID必将是列表中的第一个硬件ID。
Pnp管理器通过设备ID在注册表的此设备枚举器键下面为此设备创建一个子键。
设置Parameters.QueryId.IdType 的值为BusQueryDeviceID然后发送IRP_MN_QUERY_ID给相应的设备,便可以获得到该设备的设备ID。
Hardware IDs (硬件ID)
A hardware ID is a vendor-defined identification string that Setup uses to match a device to an INF file. In most cases, a device has associated with it a list of hardware IDs. (However, there are exceptions − see Identifiers for 1394 Devices). When an enumerator reports a list of hardware IDs for a device, the first hardware ID in the list should be the device ID, and the remaining hardware IDs should be listed in order of decreasing suitability.