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

# XPackageMountWithUiAsync

> XPackageMountWithUiAsync

# XPackageMountWithUiAsync

Asynchronously mounts the installation of specified content, and returns a mount handle to it.
Shows user parental consent UI if content is age-restricted based on the parental settings of all signed in users.

## Syntax

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

### Parameters

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

A string that uniquely identifies the installed package on the disk.
Pass in the packageIdentifier field from the [XPackageDetails](/reference/system/xpackage/structs/xpackagedetails) struct returned from  [XPackageEnumerationCallback](/reference/system/xpackage/functions/xpackageenumerationcallback).
For more information about package identifiers, see [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc).

*async*  \_Inout\_\
Type: XAsyncBlock \*

An **XAsyncBlock** for monitoring the status of the asynchronous call.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

This API shows a parental consent prompt to the user if the API mounts content that isn't age-appropriate for all signed in users.
If an adult user approves parental consent in the prompt, the API attempts to mount the package.
If an adult user denies parental consent in the prompt, the API fails to mount the package.

This API automatically calls [XStoreAcquireLicenseForPackageAsync](/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync) / [Result](/reference/system/xstore/functions/xstoreacquirelicenseforpackageresult) and [XStoreIsLicenseValid](/reference/system/xstore/functions/xstoreislicensevalid).
If the API can't acquire a valid license for the DLC, the mount fails.

In this code example, a game renders DLC in black and white if the content is age-restricted.
External code in the game calls `MountDlc` when the user selects a piece of DLC to use.

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

**Header:** XPackage.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Supporting Games-as-a-Service (GaaS)](/build/core-features/common/packaging/supporting-games-as-a-service)

## See also

[XPackageMountWithUiResult](/reference/system/xpackage/functions/xpackagemountwithuiresult)
[XPackage](/reference/system/xpackage/xpackage_members)\
[XPackageEnumeratePackages](/reference/system/xpackage/functions/xpackageenumeratepackages)\
[XPackageEnumerationCallback](/reference/system/xpackage/functions/xpackageenumerationcallback)\
[XPackageDetails](/reference/system/xpackage/structs/xpackagedetails)\
[XPackageGetMountPath](/reference/system/xpackage/functions/xpackagegetmountpath)\
[XPackageGetMountPathSize](/reference/system/xpackage/functions/xpackagegetmountpathsize)\
[How to create and use Downloadable Content Packages (DLC) for PC and XBOX One](/build/core-features/common/packaging/packaging-downloadable-content-dlc)


## Related topics

- [[DEPRECATED] XPackageMount](/reference/system/xpackage/functions/xpackagemount.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [Supporting Games-as-a-Service (GaaS)](/build/core-features/common/packaging/supporting-games-as-a-service.md)
- [XStoreAcquireLicenseForPackageAsync](/reference/system/xstore/functions/xstoreacquirelicenseforpackageasync.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
