XtfGetConsoleInfoList

Returns an XtfConsoleInfo object that contains information about a console.

Syntax

HRESULT XtfGetConsoleInfoList(
         PCWSTR address,
         XtfConsoleInfo *hConsoleInfo
)  

Parameters

address
Type: PCWSTR 

[in] Address of the console.

hConsoleInfo
Type: XtfConsoleInfo *

[out]

Return value

Type: HRESULT 

A return value of S_OK indicates the function succeeded and XtfGetConsoleFieldValue can be used to retrieve values from hConsoleInfo. Any other value indicates an unexpected error occurred.

Remarks

Use XtfGetConsoleInfoList to get an XtfConsoleInfo object then use XtfGetConsoleFieldValue to retrieve the values from that object. When you have retrieved the values you needed, use XtfCloseConsoleInfoList to free resources associated with the returned XtfConsoleInfo object.

Note XtfGetConsoleInfoList retrieves all of the information from the console. XtfGetConsoleFieldValue simply iterates across that retrieved information.

Note If the target console has not been provisioned DeviceID will return an empty value.

Example

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

Header: Declared in XtfApi.h.

Library: Use XtfApi.lib.