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

# XStoreRegisterGameLicenseChanged

> XStoreRegisterGameLicenseChanged

Registers a callback for the title license changed event.
This only applies to changes to the running title's license, and not any durable (DLC) licenses.

## Syntax

```cpp theme={null}
HRESULT XStoreRegisterGameLicenseChanged(  
         XStoreContextHandle storeContextHandle,  
         XTaskQueueHandle queue,  
         void* context,  
         XStoreGameLicenseChangedCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*storeContextHandle*   \_In\_\
Type: XStoreContextHandle

The store context handle for the user returned by [XStoreCreateContext](https://docs.xbox.com/reference/system/xstore/functions/xstorecreatecontext.md).

*queue*   \_In\_\
Type: XTaskQueueHandle

Async queue to handle asynchronous work.

*context*   \_In\_opt\_\
Type: void\*

Game defined context to be passed to the callback.

*callback*   \_In\_\
Type: XStoreGameLicenseChangedCallback\*

The callback to register.

*token*   \_Out\_\
Type: [XTaskQueueRegistrationToken\*](https://docs.xbox.com/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken.md)

On success contains a token used to identify the callback.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

This function registers the callback function defined by [XStoreGameLicenseChangedCallback](https://docs.xbox.com/reference/system/xstore/functions/xstoregamelicensechangedcallback.md).
The registered function will be called when the next game license change event occurs.
This event occurs when a purchase related to the current game takes place on this device or when the game's license is refreshed and the game moves from a trial license to a full license.
The registered function will not be called by the act of registration.
In order to avoid a memory leak you must call [XStoreUnregisterGameLicenseChanged](https://docs.xbox.com/reference/system/xstore/functions/xstoreunregistergamelicensechanged.md) when you are finished with the callback function.

See [XStoreCreateContext](https://docs.xbox.com/reference/system/xstore/functions/xstorecreatecontext.md) for a usage example.

## Requirements

**Header:** XStore.h (included in XGameRuntime.h)

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Enabling licensing testing](https://docs.xbox.com/publishing/xstore-commerce/xstore-licensing-setup.md)

## See also

[XStore](https://docs.xbox.com/reference/system/xstore/xstore_members.md)\
[XStoreGameLicenseChangedCallback](https://docs.xbox.com/reference/system/xstore/functions/xstoregamelicensechangedcallback.md)\
[XStoreUnregisterGameLicenseChanged](https://docs.xbox.com/reference/system/xstore/functions/xstoreunregistergamelicensechanged.md)


## Related topics

- [XStoreUnregisterGameLicenseChanged](https://docs.xbox.com/reference/system/xstore/functions/xstoreunregistergamelicensechanged.md)
- [XStoreGameLicenseChangedCallback](https://docs.xbox.com/reference/system/xstore/functions/xstoregamelicensechangedcallback.md)
- [XStoreCreateContext](https://docs.xbox.com/reference/system/xstore/functions/xstorecreatecontext.md)
- [Enabling licensing testing](https://docs.xbox.com/publishing/xstore-commerce/xstore-licensing-setup.md)
- [XTaskQueueRegistrationToken](https://docs.xbox.com/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken.md)
