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

# XStoreGameLicense

> XStoreGameLicense

# XStoreGameLicense

描述游戏许可证。

## 语法

```cpp theme={null}
typedef struct XStoreGameLicense {  
    char skuStoreId[STORE_SKU_ID_SIZE];  
    bool isActive;  
    bool isTrialOwnedByThisUser;  
    bool isDiscLicense;  
    bool isTrial;  
    uint32_t trialTimeRemainingInSeconds;  
    char trialUniqueId[TRIAL_UNIQUE_ID_MAX_SIZE];  
    time_t expirationDate;  
} XStoreGameLicense  
```

### 成员

*skuStoreId*\
类型：char\[STORE\_SKU\_ID\_SIZE]

商店 ID。

*isActive*\
类型：bool

指示许可证是否处于活动状态。

*isTrialOwnedByThisUser*\
类型：bool

指示试用是否由与 XStoreContext 关联的用户拥有。如果在 PC 上，这将是当前登录 Microsoft Store 应用的用户。

*isDiscLicense*\
类型：bool

指示许可证是否为光盘许可证。

*isTrial*\
类型：bool

指示许可证是否为试用许可证。

*trialTimeRemainingInSeconds*\
类型：uint32\_t

试用许可证剩余时间。

*trialUniqueId*\
类型：char\[TRIAL\_UNIQUE\_ID\_MAX\_SIZE]

试用的唯一 ID。

*expirationDate*\
类型：time\_t

许可证的过期日期。

## 备注

要获取游戏许可证，请调用 [XStoreQueryGameLicenseAsync](/reference/system/xstore/functions/xstorequerygamelicenseasync)。你将在其结果函数 [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult) 中找到返回的许可证。**XStoreGameLicense** 是 [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult) 的输出参数。

## 要求

**头文件：** XStore.h（包含在 XGameRuntime.h 中）

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 概念文档

* [为游戏实现试用](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-usage-limited-free-trials)

## 另请参阅

[XStore](/reference/system/xstore/xstore_members)\
[XStoreQueryGameLicenseAsync](/reference/system/xstore/functions/xstorequerygamelicenseasync)\
[XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult)


## Related topics

- [XStoreQueryGameLicenseResult](/zh-CN/reference/system/xstore/functions/xstorequerygamelicenseresult.md)
- [为游戏实现试玩](/zh-CN/publishing/xstore-commerce/xstore-trials.md)
- [XStore](/zh-CN/reference/system/xstore/xstore_members.md)
- [从你的服务检测 XBOX Game Pass 订阅访问](/zh-CN/publishing/xstore-commerce/xstore-detecting-game-pass.md)
- [基础 DRM 与许可证检查](/zh-CN/publishing/xstore-commerce/xstore-basic-drm.md)
