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

# XStoreAcquireLicenseForPackageResult

> XStoreAcquireLicenseForPackageResult

# XStoreAcquireLicenseForPackageResult

检索对 [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md) 调用的结果。

## 语法

```cpp theme={null}
HRESULT XStoreAcquireLicenseForPackageResult(  
         XAsyncBlock* async,  
         XStoreLicenseHandle* storeLicenseHandle  
)  
```

### 参数

*async*   \_Inout\_\
类型：[XAsyncBlock\*](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md)

传递给 [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md) 的 XAsyncBlock。
使用 [XAsyncBlock](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md) 检查调用状态并获取结果。
有关详细信息，请参阅 [XAsyncBlock](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md)。

*storeLicenseHandle*   \_Out\_\
类型：XStoreLicenseHandle\*

如果调用成功，则此值为商店许可证的句柄。

### 返回值

类型：HRESULT

如果成功，则返回 **S\_OK**；否则返回错误代码。

`XStoreAcquireLicenseForPackageResult` 可以返回以下错误代码：

| 错误代码 | 说明 |
| - | - |
| 0x87E10BC6 `LM_E_CONTENT_NOT_IN_CATALOG` | 目录中未找到产品。 |
| 0x803F8001 `LM_E_CONTENT_NOT_OWNED` | 未拥有该产品。 |
| 0x803F8008 `LM_E_PREDOWNLOAD_LICENSE_NOT_YET_AVAILABLE` | 拥有该产品，但由于尚未发布无法获得许可证。 |
| 0x803F9006 `LM_E_ENTITLED_USER_SIGNED_OUT` | 产品所有者未登录。 |
| 0x89245305 `E_GAMESTORE_LICENSE_ACTION_THROTTLED` | 游戏过度查询该产品的许可证，现已被限流。同一产品在 10 分钟内的限制为 30 次授权尝试。 |

## 备注

可安全地在时间敏感型线程上调用此函数。

此结果函数检索 [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md) 的执行结果，以及在执行成功时该函数请求的许可证。
因此，应在调用 [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md) 之后调用此函数，通常在回调函数的上下文中调用。
如果返回许可证，请调用 [XStoreIsLicenseValid](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreislicensevalid.md) 验证许可证是否有效。

有关用法示例，请参阅 [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)。

## 要求

**头文件：** XStore.h（包含在 XGameRuntime.h 中）

**库：** xgameruntime.lib

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

## 概念文档

* [授予玩家访问加载项内容的权限](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-granting-access.md)

## 另请参阅

[XStore](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)\
[XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)\
[XStoreAcquireLicenseForPackageResult](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageresult.md)\
[XStoreIsLicenseValid](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreislicensevalid.md)\
[XStoreCloseLicenseHandle](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorecloselicensehandle.md)\
[XStoreRegisterPackageLicenseLost](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreregisterpackagelicenselost.md)\
[XStoreUnregisterPackageLicenseLost](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreunregisterpackagelicenselost.md)\
[管理和授权可下载内容 (DLC)](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-dlc.md)


## Related topics

- [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [XStoreCloseLicenseHandle](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorecloselicensehandle.md)
- [XStoreRegisterPackageLicenseLost](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreregisterpackagelicenselost.md)
- [XStoreUnregisterPackageLicenseLost](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreunregisterpackagelicenselost.md)
- [XStoreIsLicenseValid](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoreislicensevalid.md)
