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

# XPackageEnumerateChunkAvailability

> XPackageEnumerateChunkAvailability

# XPackageEnumerateChunkAvailability

Examines the installation package and enumerates the availability of all chunks that match the specified selectors.

## Syntax

```cpp theme={null}
HRESULT XPackageEnumerateChunkAvailability(  
         const char* packageIdentifier,  
         XPackageChunkSelectorType type,  
         void* context,  
         XPackageChunkAvailabilityCallback* callback  
)  
```

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

*type*   \_In\_\
Type: [XPackageChunkSelectorType](/reference/system/xpackage/enums/xpackagechunkselectortype)

The type of attributes to be enumerated.

*context*   \_In\_\
Type: void\*

The context to be passed to the callback specified in the *callback* parameter.

*callback*   \_In\_\
Type: [XPackageChunkAvailabilityCallback\*](/reference/system/xpackage/functions/xpackagechunkavailabilitycallback)

A callback to be called on completion.

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

**XPackageEnumerateChunkAvailability** is used to examine the package and to enumerate the availability of all selectors of a particular type. For example, calling this with **XPackageChunkSelectorType::Language** will enumerate all language attributes in the package, as well as their availability.

In the example below, a game will show all the languages it supports and will allow the user to install or remove a language. To do this, the game will query the package to determine which languages are available and whether they are installed.

```cpp theme={null}
HRESULT GetPackageLanguages(_Out_ std::map<std::string, bool>& languages)
{
    char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];

    HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
    if (FAILED(hr)) return hr;

    hr = XPackageEnumerateChunkAvailability(id,
        XPackageChunkSelectorType::Language, &languages,
        [](void* context, const XPackageChunkSelector* sel, XPackageChunkAvailability av)
    {
        auto languages = static_cast<std::map<std::string, bool>*>(context);
        switch (av)
        {
        case XPackageChunkAvailability::Ready:
        case XPackageChunkAvailability::Pending:
            languages->emplace(sel->language, true);
            break;

        case XPackageChunkAvailability::Installable:
            languages->emplace(sel->language, false);
            break;

        case XPackageChunkAvailability::Unavailable:
        default:
            break;
        }
        return true;
    });

    return hr;
}
```

## Requirements

**Header:** XPackage.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [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

- [XPackageChunkAvailabilityCallback](/reference/system/xpackage/functions/xpackagechunkavailabilitycallback.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageChunkAvailability](/reference/system/xpackage/enums/xpackagechunkavailability.md)
- [XPackageFindChunkAvailability](/reference/system/xpackage/functions/xpackagefindchunkavailability.md)
