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

# XGameSaveEnumerateBlobInfo

> XGameSaveEnumerateBlobInfo

# XGameSaveEnumerateBlobInfo

Recupera as informações de blob para o conteúdo de um XGameSaveContainer.

## Sintaxe

```cpp theme={null}
HRESULT XGameSaveEnumerateBlobInfo(  
         XGameSaveContainerHandle container,  
         void* context,  
         XGameSaveBlobInfoCallback* callback  
)  
```

### Parâmetros

*container*   \_In\_\
Tipo: XGameSaveContainerHandle

Identificador para o **XGameSaveContainer** que contém os blobs a serem enumerados.

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

Ponteiro que será passado para a função de retorno de chamada.

*callback*   \_In\_\
Tipo: XGameSaveBlobInfoCallback\*

Função a ser chamada para cada blob no contêiner; retorne false para interromper a enumeração.

### Valor retornado

Tipo: HRESULT

Resultado da função.

## Comentários

<Note>Embora seja seguro chamar esta função em uma thread sensível ao tempo, o XGameSaveBlobInfoCallback pode causar atrasos, dependendo do que o título faz dentro do retorno de chamada. Por exemplo, copiar dados do retorno de chamada não tem problema; no entanto, fazer qualquer chamada não sensível ao tempo pode atrasar o retorno do retorno de chamada. Para obter mais informações, consulte [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Os blobs contêm os dados recuperáveis reais que compõem um contêiner. Enumerar os blobs permitirá que você veja todos os dados disponíveis dentro do contêiner. Você pode usar [XGameSaveEnumerateBlobInfoByName](/pt-BR/reference/system/xgamesave/functions/xgamesaveenumerateblobinfobyname) para enumerar os blobs que correspondem a um determinado prefixo.

```cpp theme={null}
// wrapper for calling a method on each item in the XGameSaveContainerInfo 
HRESULT Sample::_ForEachBlob(_In_ const XGameSaveContainerInfo* container, _In_ void* context, _In_ XGameSaveBlobInfoCallback* callback) 
{ 
    // create the container handle so we can inspect the contents 
    XGameSaveContainerHandle containerContext = nullptr; 
    HRESULT hr = XGameSaveCreateContainer(_provider, container->name, &containerContext); 
    if (SUCCEEDED(hr)) 
    { 
        // for each item in the container invoke the callback 
        hr = XGameSaveEnumerateBlobInfo(containerContext, context, callback); 
    } 
  
    if (containerContext != nullptr) 
    { 
        // make sure we close the context handle or we will leak memory 
        XGameSaveCloseContainer(containerContext); 
    } 
    return hr; 
} 
  
// check to see if the container has the minimum blobs we need to load a save 
HRESULT Sample::_CheckForRequiredBlobs(_In_ XGameSaveContainerInfo* container) 
{ 
    const char* blobNames[] = { 
        "WorldState", 
        "PlayerState", 
        "PlayerInventory" 
    }; 
    return _CheckContainerForRequiredBlobs(container, blobNames, _countof(blobNames)); 
} 
  
//confirm this container has the blobs the caller is looking for 
HRESULT Sample::_CheckContainerForRequiredBlobs( 
    _In_ XGameSaveContainerInfo* container, 
    _In_z_count_(countOfBlobs) const char** expectedBlobNames, 
    _In_ uint32_t countOfBlobs) 
{ 
    HRESULT hr; 
    struct QueryContext 
    { 
        QueryContext(const char** blobNames, uint32_t countOfBlobs) : 
            expectedCount(countOfBlobs), expectedBlobNames(blobNames), hitCount(0) 
        {} 
  
        uint32_t expectedCount; 
        const char** expectedBlobNames; 
        uint32_t hitCount; 
    }; 
  
    QueryContext qc{ expectedBlobNames, countOfBlobs }; 
  
    // simple check to see if we just see each of the blob names in the container 
    // a more robust check would identify which blob was missing to inform the caller 
    auto callback = [](_In_ const XGameSaveBlobInfo* info, _In_ void* context) 
    { 
        QueryContext* qc = reinterpret_cast<QueryContext*>(context); 
        for (uint32_t i = 0; i < qc->expectedCount; i++) 
        { 
            if (strcmp(qc->expectedBlobNames[i], info->name) == 0) 
            { 
                if (++qc->hitCount == qc->expectedCount) 
                { 
                    // all the expected names are here, can stop enum 
                    return false; 
                } 
            } 
        } 
        // keep enumerating 
        return true; 
    }; 
  
    hr = _ForEachBlob(container, &qc, callback); 
    if (SUCCEEDED(hr)) 
    { 
        if (qc.hitCount != qc.expectedCount) 
        { 
            printf("missing blobs from container!"); 
            hr = E_UNEXPECTED; 
        } 
    } 
  
    return hr; 
} 
  
// find the size of a set of blobs in a container 
HRESULT Sample::_GetContainerBlobsDataSize( 
    _In_ const XGameSaveContainerInfo* container, 
    _In_z_count_(countOfBlobs) const char** blobNames, 
    _In_ uint32_t countOfBlobs, 
    _Out_ size_t* containerSize) 
{ 
  
    *containerSize = 0; 
  
    struct BlobSize { 
        size_t size; 
        const char** blobNames; 
        uint32_t countOfBlobs; 
    }; 
  
    BlobSize blobSize = { 0, blobNames, countOfBlobs }; 
  
    HRESULT hr = _ForEachBlob(container, &blobSize, 
        [](const XGameSaveBlobInfo* info, void* ctx) 
    { 
        BlobSize* size = reinterpret_cast<BlobSize*>(ctx); 
        for (uint32_t i = 0; i < size->countOfBlobs; i++) 
        { 
            if (strcmp(info->name, size->blobNames[i]) == 0) 
            { 
                size->size += strlen(info->name) + 1; // length + null 
                size->size += info->size + sizeof(XGameSaveBlob); 
                break; 
            } 
        } 
        return true; 
    }); 
  
    if (SUCCEEDED(hr)) 
    { 
        *containerSize = blobSize.size; 
    } 
  
    return hr; 
} 
```

## Requisitos

**Cabeçalho:** XGameSave.h

**Biblioteca:** xgameruntime.lib

**Plataformas com suporte:** Windows, consoles da família XBOX One e consoles XBOX Series

## Documentação conceitual

* [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Confira também

[XGameSave](/pt-BR/reference/system/xgamesave/xgamesave_members)\
[XGameSaveBlobInfo](/pt-BR/reference/system/xgamesave/structs/xgamesaveblobinfo)\
[XGameSaveEnumerateBlobInfoByName](/pt-BR/reference/system/xgamesave/functions/xgamesaveenumerateblobinfobyname)\
[Depuração de salvamentos de jogos](/pt-BR/build/core-features/common/game-save/game-saves-debugging)


## Related topics

- [XGameSaveEnumerateBlobInfo](/reference/system/xgamesave/functions/xgamesaveenumerateblobinfo.md)
- [XGameSaveEnumerateBlobInfoByName](/reference/system/xgamesave/functions/xgamesaveenumerateblobinfobyname.md)
