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

# XPackageGetMountPathSize

> XPackageGetMountPathSize

# XPackageGetMountPathSize

Gets the size required for an array to hold a mount path returned by [XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath).

## Syntax

```cpp theme={null}
HRESULT XPackageGetMountPathSize(  
         XPackageMountHandle mount,  
         size_t* pathSize  
)  
```

### Parameters

*mount*   \_In\_\
Type: XPackageMountHandle

The handle to the mounted installation.

*pathSize*   \_Out\_\
Type: size\_t\*

On return, contains the size required for an array.

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

Together, **XPackageGetMountPathSize** and [XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath) are used to return the file path to a package's contents.

[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath) mounts the specified package identifier and returns a mount handle to it. This might take several seconds. For more information about package identifiers, see [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc).

Only content packages can be mounted. An attempt to mount another game will yield E\_ACCESS\_DENIED.

The following code example shows how packages are usually mounted:

```cpp theme={null}
HRESULT MountDlc(char* dlcIdentifier)
{
    XPackageMountHandle mountHandle;
    HRESULT hr = XPackageMount(dlcIdentifier, &mountHandle);
    if (FAILED(hr)) return hr;

    size_t pathSize;
    hr = XPackageGetMountPathSize(mountHandle, &pathSize);
    if (FAILED(hr))
    {
        XPackageCloseMountHandle(mountHandle);
        return hr;
    }

    char* path = new (std::nothrow) char[pathSize];
    if (path == nullptr)
    {
        XPackageCloseMountHandle(mountHandle);
        return E_OUTOFMEMORY;
    }

    hr = XPackageGetMountPath(mountHandle, pathSize, path);
    if (FAILED(hr))
    {
        XPackageCloseMountHandle(mountHandle);
        delete[] path;
        return hr;
    }

    printf("Dlc %s mounted at path %s\n", dlcIdentifier, path);

    delete[] path;

    // Unmounts DLC path if this is the last handle
    // to it.
    XPackageCloseMountHandle(mountHandle);
    return S_OK;
}
```

## 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)\
[How to create and use Downloadable Content Packages (DLC) for PC and XBOX One](/build/core-features/common/packaging/packaging-downloadable-content-dlc)\
[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath)


## Related topics

- [XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath.md)
- [XPackageCloseMountHandle](/reference/system/xpackage/functions/xpackageclosemounthandle.md)
- [XPackageMountWithUiAsync](/reference/system/xpackage/functions/xpackagemountwithuiasync.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
