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

# XStoreDownloadPackageUpdatesAsync

> XStoreDownloadPackageUpdatesAsync

# XStoreDownloadPackageUpdatesAsync

> [!NOTE]
>
> 此 API 无法按预期工作，因为 XBOX 上的更新会在下载时同步安装。
> 如果更新针对的是游戏，游戏将终止。
> 如果更新针对的是 DLC，并且 DLC 包当前已装载，游戏将终止。
>
> 请改用 [XStoreDownloadAndInstallPackageUpdatesAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md)。

下载指定包的更新但不安装它们。这允许你的游戏控制更新的安装时机，以防止在用户玩游戏时游戏被关闭。

## 语法

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

### 参数

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

由 [XStoreCreateContext](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorecreatecontext.md) 返回的用户的应用商店上下文句柄。

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

包标识符列表。
包标识符是 Microsoft Store 包的唯一 ID 字符串。有关包标识符的详细信息，请参阅[管理和授权可下载内容 (DLC)](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-dlc.md)。

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

**packageIdentifiers** 中的标识符数量。

*async*   \_Inout\_\
类型：[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)。可使用 [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)。

### 返回值

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

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

## 备注

此函数仅下载更新，但不安装它。要在一次调用中下载并安装更新，请使用 [XStoreDownloadAndInstallPackageUpdatesAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md) 函数。要检索此函数的结果，请在调用此函数后调用 [XStoreDownloadPackageUpdatesResult](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadpackageupdatesresult.md)。有关用法示例，请参阅 [XStoreQueryGameAndDlcPackageUpdatesAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesasync.md)。

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

## 要求

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

**库：** xgameruntime.lib

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

## 另请参阅

[XStore](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)\
[XStoreDownloadPackageUpdatesResult](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadpackageupdatesresult.md)\
[XStoreDownloadAndInstallPackageUpdatesAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md)


## Related topics

- [XStoreDownloadPackageUpdatesResult](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadpackageupdatesresult.md)
- [XStore（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)
- [在 Unity 项目中使用 GDK API 的 C# 包装器](https://docs.xbox.com/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XStoreDownloadAndInstallPackageUpdatesAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md)
- [XStoreDownloadAndInstallPackageUpdatesResult](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult.md)
