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

# XStoreRegisterGameLicenseChanged

> 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](/reference/system/xstore/functions/xstorecreatecontext).

*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\*](/reference/system/xtaskqueue/structs/xtaskqueueregistrationtoken)

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](/reference/system/xstore/functions/xstoregamelicensechangedcallback).
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](/reference/system/xstore/functions/xstoreunregistergamelicensechanged) when you are finished with the callback function.

See [XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext) 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](/publishing/xstore-commerce/xstore-licensing-setup)

## See also

[XStore](/reference/system/xstore/xstore_members)\
[XStoreGameLicenseChangedCallback](/reference/system/xstore/functions/xstoregamelicensechangedcallback)\
[XStoreUnregisterGameLicenseChanged](/reference/system/xstore/functions/xstoreunregistergamelicensechanged)


## Related topics

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