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

# WdRegisterRemoteXboxGame

> WdRegisterRemoteXboxGame

# WdRegisterRemoteXboxGame

在远程设备上注册游戏。

> [!NOTE]
>
> `WdRegisterRemoteXboxGame` 当前尚未实现，被调用时将返回 S\_OK。它将在 API 的后续版本中添加。

## 语法

```cpp theme={null}
HRESULT WdRegisterRemoteXboxGame(  
         _In_z_ const char* remoteDevice,  
         _In_z_ const char* remoteFolderPath,  
         _In_opt_z_ const char* commonRootAlias  
);  
```

### 参数

`_In_z_ remoteDevice`\
类型：**const char\***

远程设备的主机名或 IP 地址（例如 `"192.168.1.100"` 或 `"MyDevKit"`）。

`_In_z_ remoteFolderPath`\
类型：**const char\***

远程设备上包含要注册的游戏的文件夹路径（例如 `"D:\\Games\\MyGame"`，或者在使用公共根时为 `"MyGame"`）。如果 `remoteFolderPath` 是绝对路径，则会忽略 `commonRootAlias`。

`_In_opt_z_ commonRootAlias`\
类型：**const char\***

可选。远程设备上公共根目录的别名。传入 `nullptr` 以使用默认公共根位置。

### 返回值

类型：**HRESULT**

如果成功，则返回 `S_OK`；否则，返回错误代码。

#### 错误代码

| 代码 | 值 | 说明 | 根本原因 | 故障排除 |
| - | - | - | - | - |
| E\_CONNECTIONERROR | 0x8C114014 | 连接错误。 | 建立网络连接时的通用故障（传输层故障），与 IP 地址有效性或远程计算机名称解析无关 | 检查远程计算机上的网络连接、防火墙规则和服务可用性；检查设备之间的可见性，两者应能够互相 ping 通；启用日志记录后重试连接。 |
| E\_NAMERESOLUTIONFAILED | 0x8C114012 | 无法解析远程计算机名称。 | 无法通过 DNS 或本地名称解析来解析主机名。 | 验证主机名拼写、DNS 配置和网络连接。；使用 IP 地址以隔离名称解析问题。 |
| E\_INVALIDADDRESS | 0x8C114013 | 无效地址。 | 提供的网络地址不正确、格式错误或不受支持（例如 IP 格式错误、错误的 IP 或不受支持的协议）。 | 确认正确的 IP 地址；更正地址格式并确保使用 IPv4 协议 |
| E\_CLIENTNOTAUTHORIZED | 0x8C114008 | 设备拒绝了客户端。 | 客户端不在该设备的受信任客户端列表中。在完成配对流程之前就尝试了连接 | 成功完成 PIN 码配对流程；重新执行连接请求 |
| E\_SERVERNOTAUTHORIZED | 0x8C114009 | 客户端拒绝了设备。 | 目标设备不在该客户端的受信任端点列表中。在完成配对流程之前就尝试了连接 | 成功完成 PIN 码配对流程；重新执行连接请求 |
| E\_ADMIN\_REQUIRED | 0x8C114016 | 需要管理员权限。 | 端点未以提升的权限运行，而该操作需要管理员级别的权限 | 以管理员身份重新运行该端点 |

## 备注

`WdRegisterRemoteXboxGame` 旨在在远程设备上注册已部署的游戏包。`remoteFolderPath` 必须指向包含有效游戏包的文件夹。

> [!NOTE]
>
> 目前使用 [WdLaunchRemoteGame](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdlaunchremotegame.md) 启动游戏不需要注册。当此函数在未来版本中完全实现后，对于使用 XBOX 服务或 OGAT 打包方式的游戏，启动前将需要先注册。

## 要求

| 要求 | 值 |
| - | - |
| **头文件** | WdRemoteIteration.h |
| **库** | wdremoteapi.lib |
| **支持的操作系统** | Windows 11 及更高版本 |
| **支持的体系结构** | x64、ARM64 |

## 另请参阅

* [WdLaunchRemoteGame](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdlaunchremotegame.md)
* [WdRemoteCopy](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdremotecopy.md)
* [XBOX PC 远程迭代 API 错误代码](https://docs.xbox.com/zh-CN/reference/remoting/error-codes.md)
* [XBOX PC 远程迭代 API](https://docs.xbox.com/zh-CN/reference/remoting/remoteiteration_members.md)


## Related topics

- [XBOX PC Remote Iteration API](https://docs.xbox.com/zh-CN/reference/remoting/remoteiteration_members.md)
- [WdLaunchRemoteGame](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdlaunchremotegame.md)
- [WdResumeRemoteGame](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdresumeremotegame.md)
- [WdTerminateRemoteGame](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdterminateremotegame.md)
- [WdRemoteCopy](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdremotecopy.md)
