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

Returns an `XtfConsoleInfo` object that contains information about a console.

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### Parameters

*address*\
Type: PCWSTR

\[in] The address of the console.

*hConsoleInfo*\
Type: XtfConsoleInfo\*

\[out] A pointer to be used with the [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) function to retrieve information about a console.

<a id="retvalSection" />

### Return value

Type: HRESULT

Returns `S_OK` if the function succeeded and [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) can be used to retrieve values from **hConsoleInfo**; otherwise, returns an HRESULT error code.

<a id="remarksSection" />

## Remarks

To retrieve information about a console, first use this function to get an `XtfConsoleInfo` pointer, and then use [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) to retrieve information about the console from that pointer. After you retrieve the information you need, use [XtfCloseConsoleInfoList](/reference/tools/xtf/xtfapi/functions/xtfcloseconsoleinfolist-xbox-microsoft-m) to free resources associated with the returned `XtfConsoleInfo` pointer.

<Note>`XtfGetConsoleInfoList` retrieves all of the information from the console and provides a pointer to that information. [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) only iterates that retrieved information. You must use both functions together to retrieve information about a console.</Note>

<Note>If the target console specified in `address` for this function has not been provisioned, the [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m) function returns an empty value if [XtfConsoleFieldId::DeviceID](/reference/tools/xtf/xtfapi/enums/xtfconsolefieldid-xbox-windows-t) is specified in `field`.</Note>

The following code sample demonstrates how to use the `XtfGetConsoleInfoList` and `XtfGetConsoleFieldValue` functions together to retrieve the console ID of a development console.

```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" />

## Requirements

**Header:** xtfapi.h

**Library:** XtfApi.lib

**Supported platforms:** Windows (for XBOX console tools)

<a id="seealsoSection" />

## See also

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


## Related topics

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