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

# XStoreDownloadAndInstallPackageUpdatesAsync

> XStoreDownloadAndInstallPackageUpdatesAsync

# XStoreDownloadAndInstallPackageUpdatesAsync

下载并安装指定应用商店包的更新。

## 语法

```cpp theme={null}
HRESULT XStoreDownloadAndInstallPackageUpdatesAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char** packageIdentifiers,  
         size_t packageIdentifiersCount,  
         XAsyncBlock* async  
)  
```

### 参数

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

由 [XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext) 返回的用户的应用商店上下文句柄。

*packageIdentifiers*   \_In\_z\_count\_(packageIdentifiersCount)\
类型：char\*\*

包标识符字符串的列表。
包标识符唯一标识来自 Microsoft Store 的包。有关包标识符的详细信息，请参阅[管理和授权可下载内容 (DLC)](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages)。

*packageIdentifiersCount*   \_In\_\
类型：size\_t

`packageIdentifiers` 中的标识符数量。

*async*   \_Inout\_\
类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

定义正在执行的异步工作的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)。可使用 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 轮询调用状态并检索调用结果。有关详细信息，请参阅 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)。

### 返回值

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

HRESULT 成功或错误代码。

## 备注

此函数下载并安装指定应用商店包的更新。

<Note>当你调用此函数并且它为游戏找到更新时，游戏将立即终止以允许安装。</Note>

要检索下载和安装更新的结果，请在调用此函数后调用 [XStoreDownloadAndInstallPackageUpdatesResult](/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult)。
有关用法示例，请参阅 [XStoreQueryGameAndDlcPackageUpdatesAsync](/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesasync)。

当你从正在运行的游戏中调用此 API 时，下载将被视为高优先级，它们将按 `storeIds` 参数中指定的顺序排在队列前面。

## 要求

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

**库：** xgameruntime.lib

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

## 概念文档

* [检查更新](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-checking-for-updates)

## 另请参阅

[XStore](/reference/system/xstore/xstore_members)\
[XStoreDownloadAndInstallPackageUpdatesResult](/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult)


## Related topics

- [XStoreDownloadAndInstallPackageUpdatesResult](/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult.md)
- [XStoreDownloadPackageUpdatesAsync](/zh-CN/reference/system/xstore/functions/xstoredownloadpackageupdatesasync.md)
- [检查更新](/zh-CN/publishing/xstore-commerce/xstore-checking-updates.md)
- [XStore](/zh-CN/reference/system/xstore/xstore_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
