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

# XGameSaveContainerInfoCallback

> XGameSaveContainerInfoCallback

# XGameSaveContainerInfoCallback

Callback function for completing work after calling for data from XGameSave.

## Syntax

```cpp theme={null}
bool XGameSaveContainerInfoCallback(  
         const XGameSaveContainerInfo* info,  
         void* context  
)  
```

### Parameters

*info*   \_In\_\
Type: [XGameSaveContainerInfo\*](/reference/system/xgamesave/structs/xgamesavecontainerinfo)

XGameSaveContainerInfo passed from the call made to [XGameSaveGetContainerInfo](/reference/system/xgamesave/functions/xgamesavegetcontainerinfo), [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo) or [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname).

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

The object passed into [XGameSaveGetContainerInfo](/reference/system/xgamesave/functions/xgamesavegetcontainerinfo), [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo) or [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname). The context pointer carries information about that object that may be needed in the callback function.

```cpp theme={null}
void Sample::_GetContainerInfo(const char* name) 
{ 
    XGameSaveContainerInfoCallback* callback = [](_In_ const XGameSaveContainerInfo* info, _In_ void* ctx) -> bool 
    { 
        auto self = reinterpret_cast<Sample*>(ctx); 
        self->_UpdateContainerList(info); 
        return true; 
    }; 
  
    HRESULT hr = XGameSaveGetContainerInfo(_provider, name, this, callback); 
    if (FAILED(hr)) 
    { 
        _HandleContainerErrors(name, hr); 
    } 
} 
 
void Sample::_UpdateContainerList(const XGameSaveContainerInfo* container) 
{ 
    //update UX 
    printf("%s - %s: %I64dbytes %d blobs\n", container->name, container->displayName, container->totalSize, container->blobCount); 
    if (strcmp(container->name, "AutoSave") == 0) 
    { 
        _ReadContainerBlobsAsync(container); 
    } 
} 
 
void Sample::_HandleContainerErrors(const char* name, HRESULT hr) 
{ 
    switch (hr) 
    { 
    case E_GS_INVALID_CONTAINER_NAME: 
        printf("\'%s\' name is invalid for a container", name); 
        break; 
    case E_GS_USER_CANCELED: 
        printf("Container %s failed to sync user canceled hr=0x%08x\n", name, hr); 
        break; 
    case E_GS_CONTAINER_NOT_IN_SYNC: 
    case E_GS_CONTAINER_SYNC_FAILED: 
        printf("Container %s failed to sync hr=0x%08x\n", name, hr); 
        break; 
    case E_GS_HANDLE_EXPIRED: 
        printf("Container %s failed, re-initialize provider", name); 
        break; 
    case S_OK: 
        break; 
    default: 
        printf("Unknown Container error %s hr=0x%08X\n", name, hr); 
    } 
} 
```

### Return value

Type: bool

Return false to stop enumeration.

## Remarks

Passed as a parameter to the [XGameSaveGetContainerInfo](/reference/system/xgamesave/functions/xgamesavegetcontainerinfo), [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo) or [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname) call. This function is used as a callback so that other processes may continue while XGameSave information is obtained. This callback pattern also allows for data to be returned in sections. Whether your callback function is declared separately or inline the function must have the same parameters and boolean return value as **XGameSaveContainerInfoCallback**.

## Requirements

**Header:** XGameSave.h

**Library:** xgameruntime.lib

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

## See also

[XGameSave](/reference/system/xgamesave/xgamesave_members)\
[XGameSaveGetContainerInfo](/reference/system/xgamesave/functions/xgamesavegetcontainerinfo)\
[XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo)\
[XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname)
[Debugging Game Saves](/build/core-features/common/game-save/game-saves-debugging)


## Related topics

- [XGameSaveContainerInfo](/reference/system/xgamesave/structs/xgamesavecontainerinfo.md)
- [XGameSaveEnumerateContainerInfo](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfo.md)
- [XGameSaveGetContainerInfo](/reference/system/xgamesave/functions/xgamesavegetcontainerinfo.md)
- [XGameSaveEnumerateContainerInfoByName](/reference/system/xgamesave/functions/xgamesaveenumeratecontainerinfobyname.md)
- [XGameSave](/reference/system/xgamesave/xgamesave_members.md)
