Skip to main content

XUserFindForDevice

Retrieves the user ID for a specific device ID.

Syntax

Parameters

deviceId   _In_
Type: APP_LOCAL_DEVICE_ID*
The ID of the device.
handle   _Out_
Type: XUserHandle*
Contains the XUID for the local user.

Return value

Type: HRESULT Returns S_OK if successful; otherwise, returns an error code. For a list of error codes, see Error Codes.

Remarks

This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
The association between user and device can change for many reasons:
  • The user signs out from the console.
  • Someone uses the input device to select a different user in the Account Picker.
To receive a notification when the user-device association changes, call XUserRegisterForDeviceAssociationChanged to get an XUserDeviceAssociationChangedCallback.
XUserFindForDevice cannot return a user handle to a user that hasn’t been signed in with a call to XUserAddAsync. See Users and input devices for more information.

Requirements

Header: XUser.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

Conceptual documentation

See also

XUser XUserRegisterForDeviceAssociationChanged XUserDeviceAssociationChangedCallback
Last modified on August 20, 2026