gpt4 book ai didi

c++ - Windows 设备属性文档?

转载 作者:行者123 更新时间:2023-11-28 00:53:32 30 4
gpt4 key购买 nike

在 Windows 中,如果你去DeviceManager -> 选择设备(如键盘)-> 转到详细信息 -> 属性列表:

Device description
Hardware Ids
Compatible Ids
Device class
Device class guid
Driver key
ConfigFlags
... etc

我在哪里可以找到每个属性的含义?

最佳答案

来自 MSDN documentation ,您会找到设备实例 ID 的描述,以及指向其他描述的链接。 This link简要介绍其中的一些,如下所示:

Device IDs

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. If an enumerator reports a list of hardware IDs for a device, the device ID should be the first hardware ID in the list.

The 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.

Hardware IDs

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). The first hardware ID in the list should be the device ID, and the remaining IDs should be listed in order of decreasing suitability.

A hardware ID has one of the following generic formats:

<enumerator>\<enumerator-specific-device-ID> This is the most common format for individual PnP devices reported to the PnP Manager by a single enumerator. New enumerators should use this format or the following format. *<enumerator-specific-ID> The asterisk indicates that the device is supported by more than one enumerator, such as ISAPNP and the BIOS. <device-class-specific-ID> An existing device class that has established its own naming convention might use a custom format. For information on their hardware ID formats, see the hardware specification for such buses. New enumerators should not use this format. The number of characters of a hardware ID, excluding a NULL-terminator, must be less than MAX_LENGTH_LEN. This constraint applies to the sum of the lengths of all the fields and any “\” field separators in a hardware ID. In addition, when an instance ID is concatenated to a hardware ID to create a device instance ID, the lengths of the hardware ID and the instance ID are further constrained by the maximum possible length of a device instance ID.

To obtain the list of hardware IDs for a device, call IoGetDeviceProperty with the DeviceProperty parameter set to DevicePropertyHardwareID. The list of hardware IDs that this routine retrieves is a REG_MULTI_SZ value. The maximum number of characters in a hardware list, including a NULL terminator after each hardware ID and a final NULL terminator, is REGSTR_VAL_MAX_HCID_LEN. The maximum possible number of IDs in a list of hardware IDs is MAX_HCID_COUNT.

Examples of Hardware IDs

In the following, the first example is a generic identifier for a PnP device, and the second example is an identifier for a PCI device:

root*PNP0F08

PCI\VEN_1000&DEV_0001&SUBSYS_00000000&REV_02

Compatible IDs

A compatible ID is a vendor-defined identification string that Setup uses to match a device to an INF file. A device can have associated with it a list of compatible IDs. The compatible IDs should be listed in order of decreasing suitability. If Setup cannot locate an INF file that matches one of a device's hardware IDs, it uses compatible IDs to locate an INF file. Compatible IDs have the same format as hardware IDs; however, compatible IDs are typically more generic than hardware IDs.

If a vendor ships an INF file that specifies a compatible ID for a driver node, the vendor should ensure that their INF file can support all the hardware that matches the compatible ID. Because a match with a compatible ID is not as strong as a match to a hardware ID, the PnP Manager prompts the user for confirmation before processing the INF file.

To obtain a list of compatible IDs for a device, call IoGetDeviceProperty with the DeviceProperty parameter set to DevicePropertyCompatibleID. The list of compatible IDs that this routine retrieves is a REG_MULTI_SZ value. The maximum number of characters in a compatible ID list, including a NULL terminator after each compatible ID and a final NULL terminator, is REGSTR_VAL_MAX_HCID_LEN. The maximum possible number of IDs in a list of compatible IDs is MAX_HCID_COUNT.

Instance IDs

An instance ID is a device identification string that distinguishes a device from other devices of the same type on a machine. An instance ID contains serial number information, if supported by the underlying bus, or some kind of location information. The string cannot contain any "\" characters; otherwise, the generic format of the string is bus-specific.

The number of characters of an instance ID, excluding a NULL-terminator, must be less than MAX_LENGTH_LEN. In addition, when an instance ID is concatenated to a device ID to create a device instance ID, the lengths of the device ID and the instance ID are further constrained by the maximum possible length of a device instance ID.

The UniqueID member of the DEVICE_CAPABILITIES structure for a device indicates if a bus-supplied instance ID is unique across the system, as follows:

If UniqueID is FALSE, the bus-supplied instance ID for a device is unique only to the device's bus. The PnP Manager modifies the bus-supplied instance ID, and combines it with the corresponding device ID, to create a device instance ID that is unique in the system. If UniqueID is TRUE, the device instance ID, formed from the bus-supplied device ID and instance ID, uniquely identifies a device in the system. An instance ID is persistent across system boots.

To obtain the bus-supplied instance ID for a device, use an IRP_MN_QUERY_ID request and set the Parameters.QueryId.IdType member to BusQueryInstanceID.

Device Instance IDs

A device instance ID is a system-supplied device identification string that uniquely identifies a device in the system. The PnP Manager assigns a device instance ID to each device node in a system's device tree.

The format of this string consists of an instance ID concatenated to a device ID, as follows:

\ The number of characters of a device instance ID, excluding a NULL-terminator, must be less than MAX_LENGTH_LEN. This constraint applies to the sum of the lengths of all the fields and “\” field separator between the device ID and instance-specific-ID fields. A device instance ID is persistent across system boots.

The following is an example of an instance ID ("1&08") concatenated to a device ID for a PCI device:

PCI\VEN_1000&DEV_0001&SUBSYS_00000000&REV_02\1&08

关于c++ - Windows 设备属性文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12723399/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com