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

# XUserLocalId

> XUserLocalId

# XUserLocalId

사용자의 게임 세션 ID를 지정합니다.

## 구문

```cpp theme={null}
typedef struct XUserLocalId {  
    uint64_t value;  
} XUserLocalId  
```

### 멤버

*value*\
형식: uint64\_t

사용자의 게임 세션 ID입니다.

## 설명

XUserLocalId는 게임 세션 내에서 사용자를 고유하게 식별합니다. **XUserHandle**을 복제하는 경우 두 핸들 모두 동일한 XUserLocalId를 유지합니다. 게임 세션이 종료되면 동일한 사용자가 다음 세션에서 다른 XUserLocalId를 가질 수 있습니다. 이러한 ID는 게임 세션 간 사용자를 추적하는 데 사용할 수 없습니다. ID는 게임 세션별로만 유효합니다.

"null" XUserLocalId는 **XUserNullUserLocalId** 값과 같습니다.

다음 콜백 함수와 함수는 XUserLocalId 구조체 또는 그에 대한 포인터를 인수로 사용합니다.

* [XUserChangeEventCallback](/reference/system/xuser/functions/xuserchangeeventcallback): 사용자 변경 이벤트에 대한 콜백 함수입니다.
* [XUserDefaultAudioEndpointUtf16ChangedCallback](/reference/system/xuser/functions/xuserdefaultaudioendpointutf16changedcallback): 사용자의 기본 오디오 엔드포인트가 변경될 때 호출되는 콜백입니다.
* [XUserFindUserByLocalId](/reference/system/xuser/functions/xuserfinduserbylocalid): 특정 로컬 ID를 사용하여 사용자에 대한 핸들을 검색하는 함수입니다.
* [XUserGetDefaultAudioEndpointUtf16](/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16): 특정 사용자의 기본 오디오 엔드포인트를 검색하는 함수입니다.
* [XUserGetLocalId](/reference/system/xuser/functions/xusergetlocalid): 사용자의 고유한 게임 세션 ID를 검색하는 함수입니다.

다음 예제에서는 XUserLocalId 구조체를 사용하여 사용자의 기본 오디오 엔드포인트를 검색하는 방법을 보여줍니다.

```cpp theme={null}
HRESULT GetAudioDeviceAssociation(
    IMMDeviceEnumerator* audioDeviceEnumerator,
    XUserLocalId user,
    XUserDefaultAudioEndpointKind defaultAudioEndpointKind,
    _Outptr_result_maybenull_ IMMDevice** endpoint)
{
    wchar_t audioDeviceId[XUserAudioEndpointMaxUtf16Count];
    RETURN_IF_FAILED_WITH_EXPECTED(XUserGetDefaultAudioEndpointUtf16(user, defaultAudioEndpointKind, std::size(audioDeviceId), audioDeviceId, nullptr), E_NOTFOUND);

    return audioDeviceEnumerator->GetDevice(audioDeviceId, endpoint);
}

HRESULT GetAudioAssociations()
{
    Mwrl::ComPtr<IMMDeviceEnumerator> audioDeviceEnumerator;

    RETURN_IF_FAILED(CoCreateInstance(
        __uuidof(MMDeviceEnumerator),
        nullptr,
        CLSCTX_ALL,
        __uuidof(IMMDeviceEnumerator),
        (void**)&audioDeviceEnumerator));

    XUserLocalId userLocalId;
    RETURN_IF_FAILED(XUserGetLocalId(_handle.get(), &userLocalId));

    {
        wil::unique_cotaskmem_string id;
        Mwrl::ComPtr<IMMDevice> device;
        if (SUCCEEDED(GetAudioDeviceAssociation(audioDeviceEnumerator.Get(), userLocalId, XUserDefaultAudioEndpointKind::CommunicationRender, &device)))
        {
            RETURN_IF_FAILED(device->GetId(&id));
        }
        appLog.AddLog("Preferred render communication device id: %S\n", id.get());
    }

    {
        wil::unique_cotaskmem_string id;
        Mwrl::ComPtr<IMMDevice> device;
        if (SUCCEEDED(GetAudioDeviceAssociation(audioDeviceEnumerator.Get(), userLocalId, XUserDefaultAudioEndpointKind::CommunicationCapture, &device)))
        {
            RETURN_IF_FAILED(device->GetId(&id));
        }
        appLog.AddLog("Preferred capture communication device id: %S\n", id.get());
    }

    return S_OK;
}
```

## 요구 사항

**헤더:** XUser.h

**지원되는 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XUser](/reference/system/xuser/xuser_members)

[XUserChangeEventCallback](/reference/system/xuser/functions/xuserchangeeventcallback)

[XUserDefaultAudioEndpointUtf16ChangedCallback](/reference/system/xuser/functions/xuserdefaultaudioendpointutf16changedcallback)

[XUserFindUserByLocalId](/reference/system/xuser/functions/xuserfinduserbylocalid)

[XUserGetDefaultAudioEndpointUtf16](/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16)

[XUserGetLocalId](/reference/system/xuser/functions/xusergetlocalid)


## Related topics

- [XUserGetLocalId](/ko/reference/system/xuser/functions/xusergetlocalid.md)
- [XUserFindUserByLocalId](/ko/reference/system/xuser/functions/xuserfinduserbylocalid.md)
- [APP_LOCAL_DEVICE_ID](/ko/reference/system/xuser/structs/app_local_device_id.md)
- [XUserDeviceAssociationChange](/ko/reference/system/xuser/structs/xuserdeviceassociationchange.md)
- [XUserChangeEventCallback](/ko/reference/system/xuser/functions/xuserchangeeventcallback.md)
