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

# XStoreDownloadPackageUpdatesAsync

> XStoreDownloadPackageUpdatesAsync

# XStoreDownloadPackageUpdatesAsync

<Note>
  此 API 無法如預期運作，因為 XBOX 上的更新會在下載時同步安裝。
  如果更新是針對遊戲，遊戲將會終止。
  如果更新是針對 DLC，且 DLC 套件目前已掛接，遊戲將會終止。

  請改用 [XStoreDownloadAndInstallPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync)。
</Note>

下載指定套件的更新但不進行安裝。這可讓您的遊戲控制何時安裝更新，以避免在使用者遊玩時關閉遊戲。

## 語法

```cpp theme={null}
HRESULT XStoreDownloadPackageUpdatesAsync(  
         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)

如果成功，則傳回 **S\_OK**；否則傳回錯誤碼。

## 備註

此函式只會下載更新，但不會安裝更新。若要在一次呼叫中下載並安裝更新，請使用 [XStoreDownloadAndInstallPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync) 函式。若要擷取此函式的結果，請在呼叫此函式之後呼叫 [XStoreDownloadPackageUpdatesResult](/zh-TW/reference/system/xstore/functions/xstoredownloadpackageupdatesresult)。如需使用範例，請參閱 [XStoreQueryGameAndDlcPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesasync)。

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

## 需求

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

**程式庫：** xgameruntime.lib

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

## 另請參閱

[XStore](/zh-TW/reference/system/xstore/xstore_members)\
[XStoreDownloadPackageUpdatesResult](/zh-TW/reference/system/xstore/functions/xstoredownloadpackageupdatesresult)\
[XStoreDownloadAndInstallPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync)


## Related topics

- [XStoreDownloadPackageUpdatesResult](/zh-TW/reference/system/xstore/functions/xstoredownloadpackageupdatesresult.md)
- [XStore](/zh-TW/reference/system/xstore/xstore_members.md)
- [適用於 GDK 的 Unity C# API 包裝函式](/zh-TW/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XStoreDownloadAndInstallPackageUpdatesAsync](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesasync.md)
- [XStoreDownloadAndInstallPackageUpdatesResult](/zh-TW/reference/system/xstore/functions/xstoredownloadandinstallpackageupdatesresult.md)
