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

# XtfGetConsoleInfoList

> XtfGetConsoleInfoList

# XtfGetConsoleInfoList

本体に関する情報を含む `XtfConsoleInfo` オブジェクトを返します。

<a id="syntaxSection" />

## 構文

```cpp theme={null}
HRESULT XtfGetConsoleInfoList(
         PCWSTR address,
         XtfConsoleInfo *hConsoleInfo
)  
```

<a id="parametersSection" />

### パラメーター

*address*\
型: PCWSTR

\[in] 本体のアドレスです。

*hConsoleInfo*\
型: XtfConsoleInfo\*

\[out] 本体に関する情報を取得するために [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) 関数と共に使用するポインターです。

<a id="retvalSection" />

### 戻り値

型: HRESULT

関数が成功し、[XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) を使用して **hConsoleInfo** から値を取得できる場合は `S_OK` を返します。それ以外の場合は HRESULT エラー コードを返します。

<a id="remarksSection" />

## 解説

本体に関する情報を取得するには、まずこの関数を使用して `XtfConsoleInfo` ポインターを取得し、次に [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) を使用してそのポインターから本体に関する情報を取得します。 必要な情報を取得した後、[XtfCloseConsoleInfoList](/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m) を使用して、返された `XtfConsoleInfo` ポインターに関連付けられているリソースを解放します。

<Note>`XtfGetConsoleInfoList` は、本体からすべての情報を取得し、その情報へのポインターを提供します。 [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) は、取得された情報を反復処理するだけです。 本体に関する情報を取得するには、両方の関数を一緒に使用する必要があります。</Note>

<Note>この関数の `address` で指定された対象の本体がプロビジョニングされていない場合、[XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) 関数は、`field` に [XtfConsoleFieldId::DeviceID](/reference/tools/xtf/xtfapi/enums/xtfconsolefieldid-xbox-windows-t) が指定されている場合に空の値を返します。</Note>

次のコード サンプルは、開発本体のコンソール ID を取得するために `XtfGetConsoleInfoList` および `XtfGetConsoleFieldValue` 関数を一緒に使用する方法を示しています。

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

<a id="requirementsSection" />

## 要件

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

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

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

<a id="seealsoSection" />

## 関連項目

[XtfConsoleControl](/reference/tools/xtf/xtfconsolecontrol/xtfconsolecontrol_members)\
[XBOX Tools Framework](/reference/tools/xtf/atoc-xbox-tools-framework)


## Related topics

- [XtfCloseConsoleInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m.md)
- [XtfGetConsoleFieldValue](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m.md)
- [XtfGetCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m.md)
- [XtfCloseCredentialInfoList](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m.md)
- [XtfGetCredentialInfoCount](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfocount-xtfapi-xbox-windows-m.md)
