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

# XPackageUninstallChunks

> XPackageUninstallChunks

# XPackageUninstallChunks

解除安裝符合指定選取器的區塊。

## 語法

```cpp theme={null}
HRESULT XPackageUninstallChunks(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors  
)  
```

### 參數

*packageIdentifier*   \_In\_z\_\
類型：char\*

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

*selectorCount*   \_In\_\
類型：uint32\_t

*selectors* 參數中的選取器數目。

*selectors*   \_In\_reads\_(selectorCount)\
類型：[XPackageChunkSelector\*](/zh-TW/reference/system/xpackage/structs/xpackagechunkselector)

指定要解除安裝之區塊的選取器陣列。

不支援僅使用整數識別碼來指定要解除安裝的區塊；嘗試這麼做會導致 **XPackageUninstallChunks** 傳回 E\_INVALIDARG 值。若要指定要解除安裝的區塊，請為選取器提供其他資訊，例如語言或標記。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

## 備註

<Note>在時間敏感的執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感的執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

**XPackageUninstallChunks** 會移除符合指定安裝選取器的區塊。這不會移除套件運作所需的區塊。例如，您無法移除為目前執行中遊戲的語言提供資產所需的區塊。

移除區塊時，遊戲不會停止。遊戲必須自行關閉其所移除區塊中檔案的所有檔案控制代碼，以及其不再存取檔案之區塊中的檔案控制代碼。

在下列範例中，**XPackageUninstallChunks** 用來解除安裝標記為 "BigMaps" 的地圖套件：

```cpp theme={null}
HRESULT UninstallBigMaps()
{
    char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];
    HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
    if (FAILED(hr)) return hr;

    XPackageChunkSelector selector;
    selector.type = XPackageChunkSelectorType::Tag;
    selector.tag = "BigMaps";

    hr = XPackageUninstallChunks(id, 1, &selector);
    return hr;
}
```

## 需求

**標頭：** XPackage.h

**程式庫：** xgameruntime.lib

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

## 概念文件

* [Intelligent Delivery：語言指定元](/zh-TW/build/core-features/common/packaging/intelligentdelivery-language)
* [Intelligent Delivery：OnDemand 內容](/zh-TW/build/core-features/common/packaging/intelligentdelivery-ondemand)
* [時間敏感的執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[XPackage](/zh-TW/reference/system/xpackage/xpackage_members)\
[串流安裝和 Intelligent Delivery](/zh-TW/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)


## Related topics

- [XPackageUninstallChunks](/reference/system/xpackage/functions/xpackageuninstallchunks.md)
- [XPackageUninstallUWPInstance](/reference/system/xpackage/functions/xpackageuninstalluwpinstance.md)
