> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetDeviceInfo

> GetDeviceInfo

# GetDeviceInfo

访问有关输入设备完整属性和能力的静态信息。

## 语法

```cpp theme={null}
HRESULT GetDeviceInfo(
    const GameInputDeviceInfo** info
);
```

### 参数

*info*   \_Outptr\_\
类型:GameInputDeviceInfo\*\*

与 IGameInputDevice 关联的设备信息。

### 返回值

类型:HRESULT

函数结果。

## 注解

`GetDeviceInfo` 方法所返回的内存不由应用程序拥有。只要应用程序保持 `IGameInput` 实例存活，该内存就将保持可访问。一旦对 `IGameInput` 对象的引用被释放，该内存也随之消失。

以下代码示例演示如何判断赛车方向盘是否具有离合器。

```cpp theme={null}
bool HasClutch(IGameInputDevice* wheel) noexcept
{
    const GameInputDeviceInfo* wheelInfo = nullptr;
    const bool succeeded = wheel->GetDeviceInfo(&wheelInfo);
    assert(succeeded);
    assert(wheelInfo->racingWheelInfo);

    const bool hasClutch = wheelInfo->racingWheelInfo->hasClutch;

    return hasClutch;
}
```

## 要求

**头文件:** GameInput.h

[GameInput 概述](/build/core-features/common/input/overviews/input-overview)\
[GameInputDeviceInfo](/reference/input/gameinput/structs/gameinputdeviceinfo)\
[IGameInputDevice](/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice)

## 版本历史

| 版本     | 变更                                                                                                                                                                                                                                                                 |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **v3** | 签名未变。[GameInputDeviceInfo](/reference/input/gameinput/structs/gameinputdeviceinfo) 扩展:新增 `controllerInfo`（替换独立的轴/按钮/开关计数+信息字段以及 `uiNavigationInfo`）；新增 `inputReportCount`/`inputReportInfo` 与 `outputReportCount`/`outputReportInfo`；移除 `hapticFeedbackMotorInfo`。 |
| **v2** | 签名未变。[GameInputDeviceInfo](/reference/input/gameinput/structs/gameinputdeviceinfo) 扩展了 `revisionNumber`、`hardwareVersion`、`firmwareVersion`、`containerId` 和 `sensorsInfo`。                                                                                         |
| **v1** | 签名未变。[GameInputDeviceInfo](/reference/input/gameinput/structs/gameinputdeviceinfo) 被大幅简化:移除 `infoSize`、`interfaceNumber`、`collectionNumber`、`capabilities` 以及触摸/触觉/字符串/描述符相关字段；新增 `supportedSystemButtons`、`displayName` 和 `pnpPath`。                              |
| **v0** | 引入。                                                                                                                                                                                                                                                                |


## Related topics

- [GameInputDeviceFamily](/zh-CN/reference/input/gameinput/enums/gameinputdevicefamily.md)
- [GameInput 上的力反馈](/zh-CN/build/core-features/common/input/advanced/input-forcefeedback.md)
- [用户与输入设备](/zh-CN/build/core-features/common/user/users-input-devices.md)
- [GameInput API 版本管理](/zh-CN/build/core-features/common/input/overviews/input-versioning.md)
- [player_device_info](/zh-CN/services/playfab/api-references/events/PlayerIdentity/player-device-info.md)
