> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](https://docs.xbox.com/reference/system/xuser/enums/xuserprivilegeoptions.md)

User privilege options.

*privilege*   \_In\_\
Type: [XUserPrivilege](https://docs.xbox.com/reference/system/xuser/enums/xuserprivilege.md)

The privilege to check for.

*hasPrivilege*   \_Out\_\
Type: bool\*

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

*reason*   \_Out\_opt\_\
Type: [XUserPrivilegeDenyReason\*](https://docs.xbox.com/reference/system/xuser/enums/xuserprivilegedenyreason.md)

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](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveprivilegewithuiasync.md) 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](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveissuewithuiasync.md) to display the UI to the user. |

## Remarks

Determines whether the user has a given [XUserPrivilege](https://docs.xbox.com/reference/system/xuser/enums/xuserprivilege.md).

> ![alert](https://mintcdn.com/microsoft-4404708b/-_0FrcE2bDxzGxv-/images/gdk/reference/caution.gif?s=2e4f582499c4cb4859c57646638ae366) **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](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveprivilegewithuiasync.md) 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](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveissuewithuiasync.md).

## 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](https://docs.xbox.com/services/xbox-services/fundamentals/identity/privileges/concepts/live-user-privileges-client.md)

[XUser](https://docs.xbox.com/reference/system/xuser/xuser_members.md)

[XUserResolvePrivilegeWithUiAsync](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveprivilegewithuiasync.md)


## Related topics

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