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

# XtfGetCredentialInfoList

> XtfGetCredentialInfoList

# XtfGetCredentialInfoList

現在コンソールに保存されている資格情報の一覧を含む `XtfNetworkCredentials` オブジェクトを返します。

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
HRESULT XtfGetCredentialInfoList(
         LPCWSTR address,
         XtfNetworkCredentials* credentialInfo
)  
```

<a id="ID4EG" />

### Parameters

*address*<br />型: LPCWSTR

\[in] コンソールのアドレスです。

*credentialInfo*<br />型: XtfNetworkCredentials\*

\[out] 現在コンソールに保存されている資格情報の一覧を含む `XtfNetworkCredentials` オブジェクトです。

<a id="ID4EN" />

### Return value

型: HRESULT

戻り値が `S_OK` の場合、関数は成功しており、**credentialInfo** オブジェクトから資格情報を取得できます。それ以外の値は、予期しないエラーが発生したことを示します。

<a id="remarks" />

## Remarks

資格情報を追加するには [XtfAddCredential](/reference/tools/xtf/xtfapi/functions/xtfaddcredential-xtfapi-xbox-windows-m) を使用します。資格情報を削除するには [XtfRemoveCredential](/reference/tools/xtf/xtfapi/functions/xtfremovecredential-xtfapi-xbox-windows-m) を使用します。現在保存されている資格情報の一覧を列挙するには、[XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m)、[XtfGetCredentialInfoCount](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfocount-xtfapi-xbox-windows-m)、[XtfGetCredentialServerName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialtargetname-xtfapi-xbox-windows-m)、[XtfGetCredentialUserName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialusername-xtfapi-xbox-windows-m) を使用します。[XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) から返される `XtfNetworkCredentials` を解放するには、[XtfCloseCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m) を使用します。

<Note>
  [XtfGetCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialinfolist-xtfapi-xbox-windows-m) はコンソールからすべての情報を取得します。[XtfGetCredentialServerName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialtargetname-xtfapi-xbox-windows-m) および [XtfGetCredentialUserName](/reference/tools/xtf/xtfapi/functions/xtfgetcredentialusername-xtfapi-xbox-windows-m) は、取得済みのそれらの情報を単に反復処理するだけです。
</Note>

<Note>
  必要な値の取得が完了したら、返された XtfNetworkCredentials オブジェクトに関連付けられたリソースを解放するために [XtfCloseCredentialInfoList](/reference/tools/xtf/xtfapi/functions/xtfclosecredentialinfo-xtfapi-xbox-windows-m) を使用します。
</Note>

<a id="ID4ETC" />

```cpp theme={null}
HRESULT               hr                = S_OK;
PCWSTR                consoleAddress    = L"190.167.10.182";
XtfNetworkCredentials credentialInfo    = nullptr;
UINT32                count             = 0;
PWSTR                 pServerNameBuffer = nullptr;
PWSTR                 pUserNameBuffer   = nullptr;
UINT32                bufferSize        = 0;

hr = XtfAddCredential(consoleAddress, L"devpc001", L"devpc001\\test", L"test");
if (FAILED(hr))
{
    wprintf(L"\n\n*** XtfAddCredential failed 0x%x", hr);
    return hr;
}

hr = XtfAddCredential(consoleAddress, L"devpc002", L"devpc002\\test1", L"test1");
if (FAILED(hr))
{
    wprintf(L"\n\n*** XtfAddCredential failed 0x%x", hr);
    return hr;
}

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

hr = XtfGetCredentialInfoCount(credentialInfo, &count);
if (FAILED(hr))
{
    wprintf(L"\n\n*** XtfGetCredentialInfoCount failed 0x%x", hr);
    return hr;
}

wprintf(L"\n\n*** List of Users:");
wprintf(L"\n\t*** Number of users: %d", count);


for (UINT32 i=0; i < count ; i++)
{
    bufferSize=0;
    hr = XtfGetCredentialServerName(credentialInfo, i, nullptr, &bufferSize);
    if (hr != HRESULT_FROM_WIN32(ERROR_MORE_DATA))
    {
        wprintf(L"\n\n*** XtfGetCredentialServerName failed 0x%x", hr);
        return hr;
    }

    pServerNameBuffer = new WCHAR[bufferSize];

    hr = XtfGetCredentialServerName(credentialInfo, i, pServerNameBuffer, &bufferSize);
    if (FAILED(hr))
    {
        wprintf(L"\n\n*** XtfGetCredentialServerName failed 0x%x", hr);
        return hr;
    }

    bufferSize=0;
    hr = XtfGetCredentialUserName(credentialInfo, i, nullptr, &bufferSize);
    if (hr != HRESULT_FROM_WIN32(ERROR_MORE_DATA))
    {
        wprintf(L"\n\n*** XtfGetCredentialUserName failed 0x%x", hr);
        return hr;
    }

    pUserNameBuffer = new WCHAR[bufferSize];

    hr = XtfGetCredentialUserName(credentialInfo, i, pUserNameBuffer, &bufferSize);
    if (FAILED(hr))
    {
        wprintf(L"\n\n*** XtfGetCredentialUserName failed 0x%x", hr);
        return hr;
    }

    wprintf(L"\n\t Server: %ls, User: %ls", pServerNameBuffer, pUserNameBuffer);
    delete[] pServerNameBuffer;
    delete[] pUserNameBuffer;
}

XtfCloseCredentialInfoList(credentialInfo);

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

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

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

hr = XtfGetCredentialInfoCount(credentialInfo, &count);
if (FAILED(hr))
{
    wprintf(L"\n\n*** XtfGetCredentialInfoCount failed 0x%x", hr);
    return hr;
}

wprintf(L"\n\n*** Number of users: %d", count);
XtfCloseCredentialInfoList(credentialInfo);

wprintf(L"\n\n");
return hr;  
```

## Requirements

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

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

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

## See also

[Run from PC Deployment (NDA topic)](/home/setup-install/concepts/deployment)<br />[XTF Transport Errors (NDA topic)](/tools/tools-console/commandlinetools/xtf-transport-errors)<br />[Additional Xtf APIs](/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [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)
- [XtfAddCredential](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfaddcredential-xtfapi-xbox-windows-m.md)
- [XtfRemoveCredential](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfremovecredential-xtfapi-xbox-windows-m.md)
- [XtfGetCredentialServerName](/ja-jp/reference/tools/xtf/xtfapi/functions/xtfgetcredentialtargetname-xtfapi-xbox-windows-m.md)
