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

# XStoreAcquireLicenseForDurablesAsync

> XStoreAcquireLicenseForDurablesAsync

# XStoreAcquireLicenseForDurablesAsync

取得 DLC (含套件的耐久性產品)、不含套件的耐久性產品或耐久性附加元件產品的授權。

## 語法

```cpp theme={null}
HRESULT XStoreAcquireLicenseForDurablesAsync(
         const XStoreContextHandle storeContextHandle,
         const char* storeId,
         XAsyncBlock* async
)
```

### 參數

*storeContextHandle*   \_In\_\
類型：XStoreContextHandle

使用者的市集內容控制代碼，由 [XStoreCreateContext](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstorecreatecontext.md) 傳回。

*storeId*   \_In\_z\_\
類型：char\*

要取得授權之耐久性產品的市集識別碼。

*async*   \_Inout\_\
類型：XAsyncBlock\*

定義非同步工作的 [XAsyncBlock](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md)。
使用 [XAsyncBlock](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md) 來檢查呼叫的狀態並取得呼叫結果。
如需詳細資訊，請參閱 [XAsyncBlock](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md)。

### 傳回值

類型：HRESULT

成功時傳回 **S\_OK**，否則傳回錯誤碼。

## 備註

此 API 會嘗試取得所要求耐久性產品的授權。
如果是裝置第一次取得授權，則會進行服務呼叫，因此需要線上連線。
由於快取的緣故，後續對相同授權的呼叫可能會比較快，但授權隨時可能失效。
在主機上，離線存取需要為擁有的帳戶啟用「主要 XBOX」，而且必須先在線上時取得過一次授權。
在 PC 上，離線存取需要為擁有授權的帳戶設定「離線權限」，而且必須先在線上時取得過一次授權。

[XStoreRegisterPackageLicenseLost](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstoreregisterpackagelicenselost.md) 可用來監視從此 API 取得的授權是否遺失。

## 需求

**標頭：** XStore.h

**程式庫：** xgameruntime.lib

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

## 概念文件

* [基本市集作業](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-basic-operations.md)
* [如何使用不含套件的耐久性產品](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-dwob.md)
* [授予玩家附加元件內容的存取權](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-granting-access.md)
* [啟用授權測試](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-licensing-setup.md)

## 另請參閱

[XStore](https://docs.xbox.com/zh-TW/reference/system/xstore/xstore_members.md)\
[XAsyncBlock](https://docs.xbox.com/zh-TW/reference/system/xasync/structs/xasyncblock.md)\
[XStoreAcquireLicenseForDurablesResult](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstoreacquirelicensefordurablesresult.md)\
[如何使用不含套件的耐久性產品](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-dwob.md)\
[授予玩家附加元件內容的存取權](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-granting-access.md)


## Related topics

- [XStoreAcquireLicenseForDurablesResult](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstoreacquirelicensefordurablesresult.md)
- [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [XStoreRegisterPackageLicenseLost](https://docs.xbox.com/zh-TW/reference/system/xstore/functions/xstoreregisterpackagelicenselost.md)
- [啟用授權測試](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-licensing-setup.md)
- [授予玩家附加元件內容的存取權](https://docs.xbox.com/zh-TW/publishing/xstore-commerce/xstore-granting-access.md)
