> ## 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](/zh-TW/reference/system/xstore/functions/xstorecreatecontext) 所傳回之使用者的市集內容控制代碼。

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

套件識別碼字串的清單。
套件識別碼可唯一識別 Microsoft Store 中的套件。如需套件識別碼的詳細資訊，請參閱[管理可下載內容 (DLC) 並授權](/zh-TW/publishing/xstore-commerce/xstore-dlc)。

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

`packageIdentifiers` 中的識別碼數目。

*async*   \_Inout\_\
類型：[XAsyncBlock\*](/zh-TW/reference/system/xasync/structs/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)。

### 傳回值

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

HRESULT 成功或錯誤碼。

## 備註

此函式會下載並安裝指定之市集套件的更新。

<Note>當您呼叫此函式且它找到遊戲的更新時，遊戲會立即終止，以便進行安裝。</Note>

若要擷取下載和安裝更新的結果，請在呼叫此函式之後呼叫 [XStoreDownloadAndInstallPackageUpdatesResult](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult)。
如需使用範例，請參閱 [XStoreQueryGameAndDlcPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesasync)。

當您從執行中的遊戲呼叫此 API 時，下載會是高優先順序，並依照 `storeIds` 參數中指定的順序排在佇列的最前面。

## 需求

**標頭：** XStore.h (包含在 XGameRuntime.h 中)

**程式庫：** xgameruntime.lib

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

## 概念文件

* [檢查更新](/zh-TW/publishing/xstore-commerce/xstore-checking-updates)

## 另請參閱

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


## Related topics

- [XStoreDownloadAndInstallPackageUpdatesAsync](/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md)
- [XStoreDownloadAndInstallPackageUpdatesResult](/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult.md)
