XPackageGetMountPath
Gets the path to a mounted installation.
Syntax
HRESULT XPackageGetMountPath(
XPackageMountHandle mount,
size_t pathSize,
char* path
)
Parameters
mount _In_
Type: XPackageMountHandle
The handle to the mount.
pathSize _In_
Type: size_t
Size of the path parameter, in bytes. Use XPackageGetMountPathSize to determine the required path size.
path _Out_writes_(pathSize)
Type: char*
The path to the mounted installation.
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.
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).
Together, XPackageGetMountPath and XPackageGetMountPathSize are used to return the file path to a package's contents.
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:
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
See also
XPackage
How to create and use Downloadable Content Packages (DLC) for PC and Xbox One
XPackageGetMountPathSize