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

# XStoreQueryGameLicenseAsync

> XStoreQueryGameLicenseAsync

# XStoreQueryGameLicenseAsync

앱을 실행할 수 있도록 획득한 라이선스에 대한 정보를 검색합니다.

## 구문

```cpp theme={null}
HRESULT XStoreQueryGameLicenseAsync(  
         const XStoreContextHandle storeContextHandle,  
         XAsyncBlock* async  
)  
```

### 매개 변수

*storeContextHandle*   \_In\_\
형식: XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext)에서 반환된 사용자의 스토어 컨텍스트 핸들입니다.

*async*   \_Inout\_\
형식: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

수행 중인 비동기 작업을 정의하는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)입니다. [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 사용하여 호출 상태를 폴링하고 호출 결과를 검색할 수 있습니다. 자세한 내용은 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 참조하세요.

### 반환 값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.

## 설명

이 함수의 실행 결과와 라이선스 정보를 검색하려면 이 함수를 호출한 후 [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult)를 호출합니다. [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult)는 **XStoreQueryGameLicenseAsync**의 콜백 함수에서 호출해야 합니다. 다음 코드 조각은 게임 실행을 허용하기 위해 획득한 라이선스에 대한 라이선스 정보를 검색하는 예를 보여줍니다.

```cpp theme={null}
void CALLBACK GameLicenseCallback(XAsyncBlock* asyncBlock)
{
    XStoreGameLicense result{};

    HRESULT hr = XStoreQueryGameLicenseResult(
        asyncBlock,
        &result);

    if (FAILED(hr))
    {
        printf("Failed retrieve the game license result: 0x%x\r\n", hr);
        return;
    }

    printf("expirationDate        : %d\r\n", result.expirationDate);
    printf("isActive              : %s\r\n", result.isActive ? "true" : "false");
    printf("isDiscLicense         : %s\r\n", result.isDiscLicense ? "true" : "false");
    printf("isTrial               : %s\r\n", result.isTrial ? "true" : "false");
    printf("isTrialOwnedByThisUser: %s\r\n", result.isTrialOwnedByThisUser ? "true" : "false");
    printf("skuStoreId            : %s\r\n", result.skuStoreId);
    printf("trialTimeRemaining    : %d\r\n", result.trialTimeRemainingInSeconds);
    printf("trialUniqueId         : %s\r\n", result.trialUniqueId);
}

void QueryGameLicense(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = GameLicenseCallback;

    HRESULT hr = XStoreQueryGameLicenseAsync(
        storeContextHandle,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get the game license: 0x%x\r\n", hr);
        return;
    }
}
```

## 요구 사항

**헤더:** XStore.h (XGameRuntime.h에 포함됨)

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [PC GDK 타이틀에 대한 모드 지원](/build/core-features/common/packaging/packaging-mods)
* [라이선스 테스트 사용](/publishing/xstore-commerce/xstore-licensing-setup)
* [GDK Commerce 시스템 개요](/publishing/xstore-commerce/xstore-overview)
* [XStore 개발 및 테스트 사용](/publishing/xstore-commerce/xstore-product-testing-setup)

## 참고 항목

[XStore](/reference/system/xstore/xstore_members)\
[XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult)\
[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext)


## Related topics

- [XStoreQueryGameLicenseResult](/ko/reference/system/xstore/functions/xstorequerygamelicenseresult.md)
- [XStoreGameLicense](/ko/reference/system/xstore/structs/xstoregamelicense.md)
- [라이선싱 테스트 활성화](/ko/publishing/xstore-commerce/xstore-licensing-setup.md)
- [PC의 XStore — DRM, 라이선스 토큰, 샌드박스](/ko/publishing/xstore-commerce/xstore-pc.md)
- [GDK 커머스 시스템 개요](/ko/publishing/xstore-commerce/xstore-overview.md)
