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

# XPackageGetMountPathSize

> XPackageGetMountPathSize

# XPackageGetMountPathSize

Obtém o tamanho necessário para uma matriz armazenar um caminho de montagem retornado por [XPackageGetMountPath](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagegetmountpath.md).

## Sintaxe

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

### Parâmetros

*mount*   \_In\_\
Tipo: XPackageMountHandle

O identificador da instalação montada.

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

No retorno, contém o tamanho necessário para uma matriz.

### Valor retornado

Tipo: HRESULT

Código de sucesso ou de erro HRESULT.

## Comentários

> [!NOTE]
>
> Não é seguro chamar esta função em um thread sensível ao tempo. Para obter mais informações, consulte [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).

Juntas, **XPackageGetMountPathSize** e [XPackageGetMountPath](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagegetmountpath.md) são usadas para retornar o caminho do arquivo para o conteúdo de um pacote.

[XPackageGetMountPath](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagegetmountpath.md) monta o identificador de pacote especificado e retorna um identificador de montagem para ele. Isso pode levar vários segundos. Para obter mais informações sobre identificadores de pacote, consulte [Gerenciar e licenciar conteúdo para download (DLC)](https://docs.xbox.com/pt-BR/publishing/xstore-commerce/xstore-dlc.md).

Somente pacotes de conteúdo podem ser montados. Uma tentativa de montar outro jogo resultará em E\_ACCESS\_DENIED.

O exemplo de código a seguir mostra como os pacotes geralmente são montados:

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

## Requisitos

**Cabeçalho:** XPackage.h

**Biblioteca:** xgameruntime.lib

**Plataformas compatíveis:** Windows, consoles da família XBOX One e consoles XBOX Series

## Documentação conceitual

* [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Confira também

[XPackage](https://docs.xbox.com/pt-BR/reference/system/xpackage/xpackage_members.md)\
[Como criar e usar pacotes de conteúdo para download (DLC) para PC e XBOX One](https://docs.xbox.com/pt-BR/build/core-features/common/packaging/packaging-downloadable-content-dlc.md)\
[XPackageGetMountPath](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagegetmountpath.md)


## Related topics

- [XPackageGetMountPath](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagegetmountpath.md)
- [XPackageCloseMountHandle](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackageclosemounthandle.md)
- [XPackageMountWithUiAsync](https://docs.xbox.com/pt-BR/reference/system/xpackage/functions/xpackagemountwithuiasync.md)
- [XPackage (conteúdo da API)](https://docs.xbox.com/pt-BR/reference/system/xpackage/xpackage_members.md)
- [Usar wrappers C# para APIs do GDK no seu projeto do Unity](https://docs.xbox.com/pt-BR/build/gdk-and-engines/unity/unity-api-wrappers.md)
