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

# XPackageGetMountPath

> XPackageGetMountPath

# XPackageGetMountPath

マウントされたインストールへのパスを取得します。

## Syntax

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

### Parameters

*mount*   \_In\_\
型: XPackageMountHandle

マウントのハンドル。

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

*path* パラメーターのサイズ (バイト単位)。必要なパス サイズを判定するには、[XPackageGetMountPathSize](/reference/system/xpackage/functions/xpackagegetmountpathsize) を使用します。

*path*   \_Out\_writes\_(pathSize)\
型: char\*

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

### Return value

型: HRESULT

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

## Remarks

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

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

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

コンテンツ パッケージのみマウントできます。別のゲームをマウントしようとすると、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

* [XBOX 本体のローカル ストレージ](/build/console-features/storage/local-storage)
* [タイム センシティブ スレッド](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)
[XPackageGetMountPathSize](/reference/system/xpackage/functions/xpackagegetmountpathsize)


## Related topics

- [XPackageGetMountPathSize](/ja-jp/reference/system/xpackage/functions/xpackagegetmountpathsize.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)
