XUserCheckPrivilege

Determines if a user has a specific privilege.

Syntax

HRESULT XUserCheckPrivilege(  
         XUserHandle user,  
         XUserPrivilegeOptions options,  
         XUserPrivilege privilege,  
         bool* hasPrivilege,  
         XUserPrivilegeDenyReason* reason  
)  

Parameters

user   _In_
Type: XUserHandle

A handle to the user whose privilege we are checking.

options   _In_
Type: XUserPrivilegeOptions

User privilege options.

privilege   _In_
Type: XUserPrivilege

The privilege to check for.

hasPrivilege   _Out_
Type: bool*

True if the user has the specific privilege, false otherwise.

reason   _Out_opt_
Type: XUserPrivilegeDenyReason*

The reason the user does not have the requested privilege. This value is informational only, and may be inaccurate in many scenarios. This value should not be used to make decisions in your title. Instead, use the XUserResolvePrivilegeWithUiAsync to resolve any and all privilege issues.

Return value

Type: HRESULT

HRESULT success or error code.

Return Code Description
S_OK The operation succeeded.
E_GAMEUSER_RESOLVE_USER_ISSUE_REQUIRED The user must use a UI to resolve the issue. Call XUserResolveIssueWithUiAsync to display the UI to the user.

Remarks

Determines whether the user has a given XUserPrivilege.

alert NOTE: The value returned in the hasPrivilege argument is informational only, and may be inaccurate in many scenarios. This value should not be used to make decisions in your title.

If a privilege is denied (i.e. hasPrivilege is false), the game can give the player an opportunity to resolve the privilege by calling XUserResolvePrivilegeWithUiAsync with the same privilege value.

If this method returns E_GAMEUSER_RESOLVE_USER_ISSUE_REQUIRED, the game can give the player an opportunity to resolve the issue by calling XUserResolveIssueWithUiAsync.

Requirements

Header: XUser.h

Library: xgameruntime.lib

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

See also

Client-side use of Xbox Live user privileges

XUser

XUserResolvePrivilegeWithUiAsync