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

# 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](/reference/system/xgame/functions/xlaunchnewgame) 类似，**XLaunchRestartOnCrash** 保证每次只运行一个游戏可执行文件。用于确定检测到崩溃时是否启动新可执行文件的内部状态与当前游戏实例的生存期相关联。如果仍然需要重启行为，重新启动的游戏实例必须再次调用 **XLaunchRestartOnCrash**。

<Note>如果标题调用了 **XLaunchRestartOnCrash**，随后调用了</Note>
[XLaunchNewGame](/reference/system/xgame/functions/xlaunchnewgame)，然后在启动新游戏之前崩溃，则将重启调用方游戏，而不是通过 [XLaunchNewGame](/reference/system/xgame/functions/xlaunchnewgame) 指定的新启动。

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

## Requirements

**头文件：** XGame.h

**库：** xgameruntime.lib

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

## See also

[XGame](/reference/system/xgame/xgame_members)


## Related topics

- [XGame](/zh-CN/reference/system/xgame/xgame_members.md)
- [crash_detected](/zh-CN/services/playfab/api-references/events/MultiplayerServers/crash-detected.md)
- [Crash data 页面](/zh-CN/tools/tools-console/wdp/windows-device-portal-on-xbox-crash-data.md)
- [CrashDetectedEventPayload](/zh-CN/services/playfab/api-references/events/data-types/crashdetectedeventpayload.md)
- [XLaunchUri](/zh-CN/reference/system/xlauncher/functions/xlaunchuri.md)
