Partager via


XUserFindUserByLocalId

Retrieves a handle to the user for a specific local user ID.

Syntax

HRESULT XUserFindUserByLocalId(  
         XUserLocalId userLocalId,  
         XUserHandle* handle  
)  

Parameters

userLocalId   _In_
Type: XUserLocalId

The local ID to get the user for.

handle   _Out_
Type: XUserHandle*

Contains a handle to the user associated with a specific local user ID.

Return value

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

Type: HRESULT

HRESULT success or error code.

Return Code Description
S_OK The operation succeeded.
HRESULT_FROM_WIN32(ERROR_NOT_FOUND) The user was not found.

Remarks

For each XUserHandle handle that you retrieve from an XUser API, inluding XUserFindUserByLocalId, you must close that handle calling XUserCloseHandle. The reference count of the handle increases after calling Get / Find functions.

To retrieve a handle to a user for a specific local user ID, call XUserFindUserByLocalId.

To retrieve the Xbox User ID (XUID) for a local user, call XUserFindUserById.

To retrieve a user ID for a specific device ID, call XUserFindForDevice.

Requirements

Header: XUser.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XUser

XUserFindUserById

XUserFindForDevice