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

指定されたセレクターに一致するチャンクをアンインストールします。

## Syntax

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

### Parameters

*packageIdentifier*   \_In\_z\_\
型: char\*

ディスク上のインストール済みパッケージを一意に識別する文字列。パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages) を参照してください。

*selectorCount*   \_In\_\
型: uint32\_t

*selectors* パラメーター内のセレクターの数。

*selectors*   \_In\_reads\_(selectorCount)\
型: [XPackageChunkSelector\*](/reference/system/xpackage/structs/xpackagechunkselector)

アンインストールするチャンクを指定するセレクターの配列。

アンインストールするチャンクを指定するために整数 ID のみを使用することはサポートされていません。これを試行すると、**XPackageUninstallChunks** は E\_INVALIDARG を返します。アンインストールするチャンクを指定するには、言語やタグなど、セレクターに追加情報を指定します。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。

## Remarks

<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;
}
```

## Requirements

**ヘッダー:** XPackage.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [インテリジェント デリバリー: 言語指定子](/build/core-features/common/packaging/intelligentdelivery-language)
* [インテリジェント デリバリー: OnDemand コンテンツ](/build/core-features/common/packaging/intelligentdelivery-ondemand)
* [タイム センシティブ スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[ストリーミング インストールとインテリジェント デリバリー](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)


## Related topics

- [XPackageUninstallUWPInstance](/ja-jp/reference/system/xpackage/functions/xpackageuninstalluwpinstance.md)
- [Intelligent Delivery: OnDemand コンテンツ](/ja-jp/build/core-features/common/packaging/intelligentdelivery-ondemand.md)
- [XPackage](/ja-jp/reference/system/xpackage/xpackage_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageUninstallPackage](/ja-jp/reference/system/xpackage/functions/xpackageuninstallpackage.md)
