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

# XSystemGetXboxLiveSandboxId

> XSystemGetXboxLiveSandboxId

# XSystemGetXboxLiveSandboxId

擷取 XBOX Live 沙箱 ID。

## 語法

```cpp theme={null}
HRESULT XSystemGetXboxLiveSandboxId(  
         size_t sandboxIdSize,  
         char* sandboxId,  
         size_t* sandboxIdUsed  
)  
```

### 參數

*sandboxIdSize*   \_In\_<br />類型：size\_t

*sandboxId* 的大小 (以位元組為單位)。此值必須等於或大於 XSystem.h 中定義的 **XSystemXboxLiveSandboxIdMaxBytes** 常數。

*sandboxId*   \_Out\_writes\_bytes\_to\_(sandboxIdSize,\*sandboxIdUsed)<br />類型：char\*

將接收沙箱 ID 的字元緩衝區。

*sandboxIdUsed*   \_Out\_opt\_<br />類型：size\_t\*

傳回之 *sandboxId* 緩衝區的實際大小 (以位元組為單位)。

### 傳回值

類型：[HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

如果成功，則傳回 **S\_OK**；否則傳回錯誤碼。如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。如果函式因 *sandboxIdSize* 設定為小於 **XSystemXboxLiveSandboxIdMaxBytes** 的值而失敗，傳回值會設定為 **HRESULT\_FROM\_WIN32(ERROR\_INSUFFICIENT\_BUFFER)**。

## 備註

沙箱 ID 與 TitleID 和服務設定 ID (SCID) 一起，對 XBOX Live 遊戲和應用程式的開發至關重要。沙箱 ID 會識別您的沙箱，沙箱在開發期間為您的開發套件提供內容隔離。內容隔離可確保您擁有乾淨的環境來開發和測試您的遊戲。

<Note>
  沙箱 ID 區分大小寫。
</Note>

對於 XBOX 和 PC 裝置，沙箱 ID 儲存在裝置上。如果找不到沙箱 ID，或您沒有存取沙箱 ID 的權限，沙箱 ID 預設為 'RETAIL'。

如果您的遊戲實際上是在零售環境中執行，此函式也會傳回 'RETAIL'。

## 需求

**標頭：** XSystem.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[設定開發套件設定 (NDA 主題)](/zh-TW/home/setup-install/dev-kit-settings/config-dev-kit-settings)<br />[設定 XBOX Live 開發的沙箱](/zh-TW/services/xbox-services/fundamentals/sandboxes/live-setting-up-sandboxes)<br />[XSystemGetConsoleId](/zh-TW/reference/system/xsystem/functions/xsystemgetconsoleid)<br />[XSystem](/zh-TW/reference/system/xsystem/xsystem_members)


## Related topics

- [XSystemGetXboxLiveSandboxId](/reference/system/xsystem/functions/xsystemgetxboxlivesandboxid.md)
- [Advanced XBOX services sandboxes](/services/xbox-services/fundamentals/sandboxes/live-advanced-sandboxes.md)
- [XSystem](/reference/system/xsystem/xsystem_members.md)
- [Determining console location](/build/game-principles/localization/determining-console-geolocation.md)
- [콘솔 위치 확인](/ko/build/game-principles/localization/determining-console-geolocation.md)
