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

# XStoreAcquireLicenseForDurablesAsync

> XStoreAcquireLicenseForDurablesAsync

# XStoreAcquireLicenseForDurablesAsync

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

<a id="syntaxSection" />

## 語法

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

<a id="parametersSection" />

### 參數

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

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

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

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

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

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

<a id="retvalSection" />

### 傳回值

類型：HRESULT

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

<a id="remarksSection" />

## 備註

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

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

<a id="requirementsSection" />

## 需求

**標頭：** XStore.h

**程式庫：** xgameruntime.lib

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

<a id="seealsoSection" />

## 概念文件

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

## 另請參閱

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


## Related topics

- [XStoreAcquireLicenseForDurablesAsync](/reference/system/xstore/functions/xstoreacquirelicensefordurablesasync.md)
- [XStoreAcquireLicenseForDurablesResult](/reference/system/xstore/functions/xstoreacquirelicensefordurablesresult.md)
- [XStoreAcquireLicenseForPackageAsync](/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [XStoreRegisterPackageLicenseLost](/reference/system/xstore/functions/xstoreregisterpackagelicenselost.md)
- [XStoreQueryAddOnLicensesAsync](/reference/system/xstore/functions/xstorequeryaddonlicensesasync.md)
