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

[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath) が返すマウント パスを保持する配列に必要なサイズを取得します。

## Syntax

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

### Parameters

*mount*   \_In\_\
型: XPackageMountHandle

マウントされたインストールへのハンドル。

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

戻り時、配列に必要なサイズを含みます。

### Return value

型: HRESULT

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

## Remarks

<Note>この関数はタイム センシティブ スレッドで呼び出すのは安全ではありません。詳細については、[タイム センシティブ スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。</Note>

**XPackageGetMountPathSize** と [XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath) は、パッケージの内容へのファイル パスを返すために一緒に使用されます。

[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath) は、指定されたパッケージ識別子をマウントし、そのマウント ハンドルを返します。これには数秒かかる場合があります。パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages) を参照してください。

コンテンツ パッケージのみマウントできます。別のゲームをマウントしようとすると、E\_ACCESS\_DENIED が返されます。

次のコード例は、通常のパッケージのマウント方法を示しています:

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

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

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

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

## Conceptual documentation

* [タイム センシティブ スレッド](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[PC および XBOX One 用のダウンロード可能コンテンツ パッケージ (DLC) を作成および使用する方法](/build/core-features/common/packaging/packaging-downloadable-content-dlc)\
[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath)


## Related topics

- [XPackageGetMountPath](/ja-jp/reference/system/xpackage/functions/xpackagegetmountpath.md)
- [XPackageCloseMountHandle](/ja-jp/reference/system/xpackage/functions/xpackageclosemounthandle.md)
- [XPackageMountWithUiAsync](/ja-jp/reference/system/xpackage/functions/xpackagemountwithuiasync.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)
