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

Uninstalls chunks that match the specified selectors.

## Syntax

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

### Parameters

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

A string that uniquely identifies the installed package on the disk. For more information about package identifiers, see [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc).

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

The number of selectors in the *selectors* parameter.

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

An array of selectors that specify the chunks to be uninstalled.

There's no support for using only the integer ID to specify chunks to be uninstalled; attempting to do so will cause **XPackageUninstallChunks** to return a value of E\_INVALIDARG. To specify chunks to be uninstalled, supply additional information for the selector, such as a language or a tag.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

**XPackageUninstallChunks** removes chunks that match the specified installation selectors. This will not remove chunks necessary for the package to function. For example, you can't remove chunks required to provide assets for the language of the currently running game.

The title is not stopped when chunks are removed. It's up to the title to close all file handles to files in the chunks that it removes and in the chunks where it no longer accesses files.

In the following example, **XPackageUninstallChunks** is used to uninstall a map package with the tag "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

**Header:** XPackage.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Intelligent Delivery: language specifiers](/build/core-features/common/packaging/intelligentdelivery-language)
* [Intelligent Delivery: OnDemand content](/build/core-features/common/packaging/intelligentdelivery-ondemand)
* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[Streaming Installation and Intelligent Delivery](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)


## Related topics

- [XPackageUninstallUWPInstance](/reference/system/xpackage/functions/xpackageuninstalluwpinstance.md)
- [Intelligent Delivery: OnDemand content](/build/core-features/common/packaging/intelligentdelivery-ondemand.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [XPackageUninstallPackage](/reference/system/xpackage/functions/xpackageuninstallpackage.md)
- [XPackageChunkSelector](/reference/system/xpackage/structs/xpackagechunkselector.md)
