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

# XUserCheckPrivilege

> XUserCheckPrivilege

# XUserCheckPrivilege

Determines if a user has a specific privilege.

## Syntax

```cpp theme={null}
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](/reference/system/xuser/enums/xuserprivilegeoptions)

User privilege options.

*privilege*   \_In\_\
Type: [XUserPrivilege](/reference/system/xuser/enums/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\*](/reference/system/xuser/enums/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](/reference/system/xuser/functions/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](/reference/system/xuser/functions/xuserresolveissuewithuiasync) to display the UI to the user. |

## Remarks

Determines whether the user has a given [XUserPrivilege](/reference/system/xuser/enums/xuserprivilege).

> <img src="https://mintcdn.com/microsoft-4404708b/-_0FrcE2bDxzGxv-/images/gdk/reference/caution.gif?s=2e4f582499c4cb4859c57646638ae366" alt="alert" width="11" height="11" data-path="images/gdk/reference/caution.gif" /> **NOTE:**  The value returned in the *reason* 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](/reference/system/xuser/functions/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](/reference/system/xuser/functions/xuserresolveissuewithuiasync).

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, Steam Deck, XBOX One family consoles and XBOX Series consoles

## See also

[Client-side use of XBOX Live user privileges](/services/xbox-services/fundamentals/identity/privileges/concepts/live-user-privileges-client)

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

[XUserResolvePrivilegeWithUiAsync](/reference/system/xuser/functions/xuserresolveprivilegewithuiasync)


## Related topics

- [XUserPrivilege](/reference/system/xuser/enums/xuserprivilege.md)
- [XR-045 XBOX network and Account Privileges](/publishing/certification/xr/xr-045.md)
- [XUserPrivilegeOptions](/reference/system/xuser/enums/xuserprivilegeoptions.md)
- [Client-side use of XBOX services user privileges](/services/xbox-services/fundamentals/identity/privileges/concepts/live-user-privileges-client.md)
- [XUserPrivilegeDenyReason](/reference/system/xuser/enums/xuserprivilegedenyreason.md)
