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

[XtfGetConsoleInfoList](/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m) によって返された **XtfConsoleInfo** オブジェクトに関連付けられたリソースを解放します。

## Syntax

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

### Parameters

*hConsoleInfo*\
型: XtfConsoleInfo

\[in] 解放する XtfConsoleInfo オブジェクトです。

### Return value

型: HRESULT

戻り値が S\_OK の場合、関数は成功しています。それ以外の値は、予期しないエラーが発生したことを示します。

## Remarks

[XtfGetConsoleInfoList](/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m) を使用して **XtfConsoleInfo** オブジェクトを取得し、次に [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) を使用してそのオブジェクトから値を取得します。必要な値の取得が完了したら、返された **XtfConsoleInfo** オブジェクトに関連付けられたリソースを解放するために [XtfCloseConsoleInfoList](/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m) を使用します。

<Note>**XtfGetConsoleInfoList** はコンソールからすべての情報を取得します。[XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) は取得済みのそれらの情報を単に反復処理するだけです。</Note>

<Note>ターゲット コンソールがプロビジョニングされていない場合、**DeviceID** は空の値を返します。</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;
}  
```

## Requirements

**ヘッダー:** xtfapi.h

**ライブラリ:** XtfApi.lib

**サポートされているプラットフォーム:** Windows (XBOX コンソール ツール用)

## See also

[XTF Transport Errors (NDA topic)](/tools/tools-console/commandlinetools/xtf-transport-errors)\
[Additional Xtf APIs](/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [XtfGetConsoleInfoList](/ja-jp/reference/tools/xtf/xtfconsolecontrol/functions/xtfgetconsoleinfolist-xtfconsolecontrol-xbox-microsoft-m.md)
- [XtfGetConsoleFieldValue](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m.md)
- [XtfCloseCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m.md)
- [XtfGetCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m.md)
- [XtfClosePackageInfo](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfclosepackageinfo-xtfapi-xbox-windows-m.md)
