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

# XPackageCloseMountHandle

> XPackageCloseMountHandle

# XPackageCloseMountHandle

Ferme le handle de montage spécifié et démonte le périphérique.

## Syntaxe

```cpp theme={null}
void XPackageCloseMountHandle(  
         XPackageMountHandle mount  
)  
```

### Paramètres

*mount*   \_In\_\
Type : XPackageMountHandle

Handle de montage à fermer.

### Valeur renvoyée

Type : void

## Remarques

<Note>Cette fonction ne peut pas être appelée en toute sécurité sur un thread à contrainte de temps. Pour plus d'informations, consultez [Threads à contrainte de temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Une fois que [XPackageMount](/fr/reference/system/xpackage/functions/xpackagemount) a monté un identificateur de package particulier et renvoyé un handle de montage vers celui-ci, XPackageCloseMountHandle démonte le périphérique. Cette opération peut prendre plusieurs secondes. Pour plus d'informations sur les identificateurs de package, consultez [Gérer et accorder des licences pour le contenu téléchargeable (DLC)](/fr/publishing/xstore-commerce/xstore-dlc).

[XPackageGetMountPathSize](/fr/reference/system/xpackage/functions/xpackagegetmountpathsize) et [XPackageGetMountPath](/fr/reference/system/xpackage/functions/xpackagegetmountpath) permettent de renvoyer le chemin d'accès aux fichiers du contenu du package.

Seuls les packages de contenu peuvent être montés. Toute tentative de montage d'un autre jeu renvoie E\_ACCESS\_DENIED.

Exemple :

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

## Configuration requise

**En-tête :** XPackage.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Documentation conceptuelle

* [Threads à contrainte de temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Voir aussi

[XPackage](/fr/reference/system/xpackage/xpackage_members)\
[Comment créer et utiliser des packages de contenu téléchargeable (DLC) pour PC et XBOX One](/fr/build/core-features/common/packaging/packaging-downloadable-content-dlc)
[XPackageMount](/fr/reference/system/xpackage/functions/xpackagemount)\
[XPackageGetMountPathSize](/fr/reference/system/xpackage/functions/xpackagegetmountpathsize)\
[XPackageGetMountPath](/fr/reference/system/xpackage/functions/xpackagegetmountpath)


## Related topics

- [XPackageCloseMountHandle](/reference/system/xpackage/functions/xpackageclosemounthandle.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [XPersistentLocalStorageMountForPackage](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragemountforpackage.md)
