> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPackageMountWithUiAsync

> XPackageMountWithUiAsync

# XPackageMountWithUiAsync

指定されたコンテンツのインストールを非同期でマウントし、そのマウント ハンドルを返します。
サインインしているすべてのユーザーのペアレンタル設定に基づいてコンテンツが年齢制限されている場合、ユーザーのペアレンタル同意 UI を表示します。

## Syntax

```cpp theme={null}
HRESULT XPackageMountWithUiAsync(
  const char * packageIdentifier,
  XAsyncBlock * async
) noexcept;
```

### Parameters

*packageIdentifier*  \_In\_z\_\
型: const char \*

ディスク上のインストール済みパッケージを一意に識別する文字列。
[XPackageEnumerationCallback](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackageenumerationcallback.md) から返される [XPackageDetails](https://docs.xbox.com/ja-jp/reference/system/xpackage/structs/xpackagedetails.md) 構造体の packageIdentifier フィールドを渡します。
パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://docs.xbox.com/ja-jp/publishing/xstore-commerce/xstore-dlc.md) を参照してください。

*async*  \_Inout\_\
型: XAsyncBlock \*

非同期呼び出しの状態を監視するための **XAsyncBlock**。

### Return value

型: HRESULT

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

## Remarks

この API は、API がサインインしているすべてのユーザーの年齢に適さないコンテンツをマウントする場合、ユーザーにペアレンタル同意プロンプトを表示します。
プロンプトで大人のユーザーがペアレンタル同意を承認した場合、API はパッケージのマウントを試みます。
プロンプトで大人のユーザーがペアレンタル同意を拒否した場合、API はパッケージのマウントに失敗します。

この API は、[XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md) / [Result](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstoreacquirelicenseforpackageresult.md) および [XStoreIsLicenseValid](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstoreislicensevalid.md) を自動的に呼び出します。
API が DLC の有効なライセンスを取得できない場合、マウントは失敗します。

このコード例では、コンテンツが年齢制限されている場合、ゲームは DLC を白黒でレンダリングします。
ユーザーが使用する DLC の一部を選択したとき、ゲーム内の外部コードは `MountDlc` を呼び出します。

```cpp theme={null}
extern void RenderDlc(const char* packageId, const char* displayName, bool monochrome); 

void ShowDlc() 
{ 
// Enumerate all DLC for the game and render it to the user 
XPackageEnumeratePackages(XPackageKind::Content, XPackageEnumerationScope::ThisAndRelated, nullptr,
 [](void*, const XPackageDetails* details) 
  {     
        RenderDlc(details->packageIdentifier,
                  details->displayName, 
                  details->ageRestricted);
  }); 
} 

 HRESULT MountDlc(const char* packageId, XPackageMountHandle* handle)
 {  
    XAsync async{};  
    RETURN_IF_FAILED(XPackageMountWithUiAsync(packageId, &async));
    RETURN_IF_FAILED(XAsyncGetStatus(&async, true));
    RETURN_IF_FAILED(XPackageMountWithUiResult(&async, handle));  
    return S_OK; 
} 
```

## Requirements

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

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

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

## Conceptual documentation

* [Games-as-a-Service (GaaS) のサポート](https://docs.xbox.com/ja-jp/build/core-features/common/packaging/supporting-games-as-a-service.md)

## See also

[XPackageMountWithUiResult](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackagemountwithuiresult.md)
[XPackage](https://docs.xbox.com/ja-jp/reference/system/xpackage/xpackage_members.md)\
[XPackageEnumeratePackages](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackageenumeratepackages.md)\
[XPackageEnumerationCallback](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackageenumerationcallback.md)\
[XPackageDetails](https://docs.xbox.com/ja-jp/reference/system/xpackage/structs/xpackagedetails.md)\
[XPackageGetMountPath](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackagegetmountpath.md)\
[XPackageGetMountPathSize](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackagegetmountpathsize.md)\
[PC および XBOX One 用のダウンロード可能コンテンツ パッケージ (DLC) を作成および使用する方法](https://docs.xbox.com/ja-jp/build/core-features/common/packaging/packaging-downloadable-content-dlc.md)


## Related topics

- [XPackageMount](https://docs.xbox.com/ja-jp/reference/system/xpackage/functions/xpackagemount.md)
- [Games-as-a-Service (GaaS) のサポート](https://docs.xbox.com/ja-jp/build/core-features/common/packaging/supporting-games-as-a-service.md)
- [XStoreAcquireLicenseForPackageAsync](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [XPackage (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xpackage/xpackage_members.md)
- [Publisher Content パッケージ](https://docs.xbox.com/ja-jp/build/core-features/common/packaging/packaging-publisher-content.md)
