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

Recupera información sobre la licencia que se adquirió para permitir el inicio de la aplicación.

## Sintaxis

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

### Parámetros

*storeContextHandle*   \_In\_\
Tipo: XStoreContextHandle

El identificador de contexto de la tienda para el usuario devuelto por [XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext).

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

Un [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) que define el trabajo asincrónico que se está realizando. El [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) se puede usar para sondear el estado de la llamada y recuperar los resultados de la llamada. Consulte [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) para obtener más información.

### Valor devuelto

Tipo: HRESULT

Código de error o de operación correcta HRESULT.

## Comentarios

Para recuperar la información de licencia, así como el resultado de la ejecución de esta función, llame a [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult) después de llamar a esta función. Se debe llamar a [XStoreQueryGameLicenseResult](/reference/system/xstore/functions/xstorequerygamelicenseresult) en la función de devolución de llamada de **XStoreQueryGameLicenseAsync**. El siguiente fragmento de código muestra un ejemplo de cómo recuperar la información de la licencia que se adquirió para permitir el inicio del juego.

```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;
    }
}
```

## Requisitos

**Encabezado:** XStore.h (incluido en XGameRuntime.h)

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Documentación conceptual

* [Compatibilidad con mods para títulos de GDK para PC](/build/core-features/common/packaging/packaging-mods)
* [Habilitación de las pruebas de licencias](/publishing/xstore-commerce/xstore-licensing-setup)
* [Información general de los sistemas de comercio del GDK](/publishing/xstore-commerce/xstore-overview)
* [Habilitación del desarrollo y las pruebas de XStore](/publishing/xstore-commerce/xstore-product-testing-setup)

## Consulte también

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


## Related topics

- [XStoreQueryGameLicenseResult](/es/reference/system/xstore/functions/xstorequerygamelicenseresult.md)
- [XStoreGameLicense](/es/reference/system/xstore/structs/xstoregamelicense.md)
- [Habilitación de las pruebas de licencias](/es/publishing/xstore-commerce/xstore-licensing-setup.md)
- [XStore en PC: DRM, tokens de licencia y sandboxes](/es/publishing/xstore-commerce/xstore-pc.md)
- [Información general sobre los sistemas de comercio del GDK](/es/publishing/xstore-commerce/xstore-overview.md)
