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

# XtfCloseConsoleInfoList

> XtfCloseConsoleInfoList

# XtfCloseConsoleInfoList

Libère les ressources associées à un objet **XtfConsoleInfo** retourné par [XtfGetConsoleInfoList](/fr/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m).

## Syntaxe

```cpp theme={null}
HRESULT XtfCloseConsoleInfoList(
         XtfConsoleInfo hConsoleInfo
)  
```

### Paramètres

*hConsoleInfo*\
Type : XtfConsoleInfo

\[in] Objet XtfConsoleInfo à libérer.

### Valeur renvoyée

Type : HRESULT

Une valeur renvoyée S\_OK indique que la fonction a réussi. Toute autre valeur indique qu'une erreur inattendue s'est produite.

## Remarques

Utilisez [XtfGetConsoleInfoList](/fr/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m) pour obtenir un objet **XtfConsoleInfo**, puis utilisez [XtfGetConsoleFieldValue](/fr/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) pour récupérer les valeurs de cet objet. Une fois les valeurs nécessaires récupérées, utilisez [XtfCloseConsoleInfoList](/fr/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m) pour libérer les ressources associées à l'objet **XtfConsoleInfo** retourné.

<Note>**XtfGetConsoleInfoList** récupère toutes les informations de la console. [XtfGetConsoleFieldValue](/fr/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) se contente de parcourir ces informations récupérées.</Note>

<Note>Si la console cible n'a pas été provisionnée, **DeviceID** retourne une valeur vide.</Note>

```cpp theme={null}
int wmain(int argc, wchar_t **argv)
{
  HRESULT             hr             = S_OK;
  PCWSTR              consoleAddress = L" 190.167.10.18";
  XtfConsoleInfo      hConsoleInfo   = nullptr;
  XtfConsoleFieldType fieldType      = XtfConsoleFieldType::FieldTypeUINT32;
  BYTE *              pValueBuffer   = nullptr;
  UINT32              bufferSize     = 0;

  hr = XtfGetConsoleInfoList(consoleAddress, &hConsoleInfo);
  if (FAILED(hr))
  {
    wprintf(L"\n\n*** XtfGetConsoleInfoList failed 0x%x", hr);
    return hr;
  }

  hr = XtfGetConsoleFieldValue(hConsoleInfo, XtfConsoleFieldId::ConsoleId, &fieldType, nullptr, &bufferSize);
  if (hr != HRESULT_FROM_WIN32(ERROR_MORE_DATA))
  {
    XtfCloseConsoleInfoList(hConsoleInfo);
    wprintf(L"\n\n*** XtfGetConsoleFieldValue failed 0x%x", hr);
    return hr;
  }

  pValueBuffer = new BYTE[bufferSize];

  hr  = XtfGetConsoleFieldValue(hConsoleInfo, XtfConsoleFieldId::ConsoleId, &fieldType, pValueBuffer, &bufferSize);
  if (SUCCEEDED(hr))
  {
    PWCHAR consoleId = (PWCHAR)pValueBuffer;
    wprintf(L"\n\n*** Console ID is %s", consoleId);
  }
  else
  {
    wprintf(L"\n\n*** XtfGetConsoleFieldValue failed 0x%x", hr);
  }

  XtfCloseConsoleInfoList(hConsoleInfo);
  delete[] pValueBuffer;

  return hr;
}  
```

## Configuration requise

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

**Bibliothèque :** XtfApi.lib

**Plateformes prises en charge :** Windows (pour les outils de console XBOX)

## Voir aussi

[Erreurs de transport XTF (rubrique sous NDA)](/fr/tools/tools-console/commandlinetools/xtf-transport-errors)\
[API Xtf supplémentaires](/fr/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [XtfCloseConsoleInfoList](/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m.md)
- [XtfGetConsoleInfoList](/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m.md)
- [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m.md)
