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

# XLaunchRestartOnCrash

> XLaunchRestartOnCrash

# XLaunchRestartOnCrash

当游戏当前运行的实例因崩溃而异常终止时，自动重启游戏。

## Syntax

```cpp theme={null}
HRESULT XLaunchRestartOnCrash(  
         const char* args,  
         uint32_t reserved  
)  
```

### Parameters

*args*   \_In\_opt\_z\_\
类型：char\*

用于重新启动游戏的任何适用的、特定于游戏的参数。

*reserved*   \_In\_\
类型：uint32\_t

保留。必须设置为 0。

### Return value

类型：HRESULT

HRESULT 成功或错误代码。

## Remarks

与 [XLaunchNewGame](https://docs.xbox.com/zh-CN/reference/system/xgame/functions/xlaunchnewgame.md) 类似，**XLaunchRestartOnCrash** 保证每次只运行一个游戏可执行文件。用于确定检测到崩溃时是否启动新可执行文件的内部状态与当前游戏实例的生存期相关联。如果仍然需要重启行为，重新启动的游戏实例必须再次调用 **XLaunchRestartOnCrash**。

\[!NOTE] 如果标题调用了 **XLaunchRestartOnCrash**，随后调用了
[XLaunchNewGame](https://docs.xbox.com/zh-CN/reference/system/xgame/functions/xlaunchnewgame.md)，然后在启动新游戏之前崩溃，则将重启调用方游戏，而不是通过 [XLaunchNewGame](https://docs.xbox.com/zh-CN/reference/system/xgame/functions/xlaunchnewgame.md) 指定的新启动。

> [!NOTE]
>
> 此 API 不适用于零售场景，在非开发工具包的主机上调用时将返回 E\_NOTIMPL。

## Requirements

**头文件：** XGame.h

**库：** xgameruntime.lib

**受支持的平台：** XBOX One 系列主机和 XBOX Series 主机

## See also

[XGame](https://docs.xbox.com/zh-CN/reference/system/xgame/xgame_members.md)


## Related topics

- [XGame（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xgame/xgame_members.md)
- [Launch](https://docs.xbox.com/zh-CN/reference/tools/xtf/xtfapplication/classes/IXtfApplicationClient/methods/launch-ixtfapplicationclient-xtfapplication-xbox-microsoft-m.md)
- [crash_detected](https://docs.xbox.com/zh-CN/services/playfab/api-references/events/MultiplayerServers/crash-detected.md)
- [Crash data 页面](https://docs.xbox.com/zh-CN/tools/tools-console/wdp/windows-device-portal-on-xbox-crash-data.md)
- [CrashDetectedEventPayload](https://docs.xbox.com/zh-CN/services/playfab/api-references/events/data-types/crashdetectedeventpayload.md)
