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

# XStoreQueryPackageUpdatesAsync

> XStoreQueryPackageUpdatesAsync

# XStoreQueryPackageUpdatesAsync

인수에 지정된 패키지에 대해 사용 가능한 업데이트 목록을 검색합니다. 이 목록을 사용하여 업데이트를 다운로드하고 설치합니다.

## 구문

```cpp theme={null}
HRESULT XStoreQueryPackageUpdatesAsync (   
         const XStoreContextHandle storeContextHandle,    
         const char** packageIdentifiers,   
         size_t packageIdentifiersCount,   
         XAsyncBlock* async   

)   
```

### 매개 변수

*storeContextHandle*   \_In\_\
형식: XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext)에서 반환된 사용자의 스토어 컨텍스트 핸들입니다.

*packageIdentifiers*   \_In\_z\_count\_(packageIdentifiersCount)\
형식: char\*\*

패키지 식별자 문자열의 목록입니다.
패키지 식별자는 Microsoft Store의 패키지를 고유하게 식별합니다. 패키지 식별자에 대한 자세한 내용은 [다운로드 가능 콘텐츠(DLC) 관리 및 라이선싱](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages)을 참조하세요.

*packageIdentifiersCount*   \_In\_\
형식: size\_t

`packageIdentifiers`의 식별자 수입니다.

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

비동기 작업을 정의하는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)입니다. [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 사용하여 호출 상태를 폴링하고 호출 결과를 검색합니다. 자세한 내용은 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 참조하세요.

### 반환 값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.

## 설명

현재 실행 중인 게임의 패키지 식별자를 가져오려면 [XPackageGetCurrentProcessPackageIdentifier](/reference/system/xpackage/functions/xpackagegetcurrentprocesspackageidentifier)를 사용하거나, DLC 및 관련 게임의 패키지 식별자를 가져오려면 [XPackageEnumeratePackages](/reference/system/xpackage/functions/xpackageenumeratepackages)를 사용합니다.

이 함수의 실행 결과와 사용 가능한 업데이트 목록을 검색하려면 이 함수를 호출한 후 [XStoreQueryPackageUpdatesResult](/reference/system/xstore/functions/xstorequerypackageupdatesresult)를 호출합니다. 검색할 업데이트 수를 가져오려면 이 함수를 호출한 후 [XStoreQueryPackageUpdatesResultCount](/reference/system/xstore/functions/xstorequerypackageupdatesresultcount)를 호출합니다. 결과 개수 함수는 결과 함수에 전달할 배열의 적절한 크기를 결정할 수 있게 해주므로 중요합니다.

다음 코드 조각은 지정된 패키지에 대해 게임 및 선택적 업데이트를 검색하는 예를 보여줍니다.

```cpp theme={null}
void CALLBACK QueryPackageUpdatesCallback(XAsyncBlock* asyncBlock)
{
    uint32_t count;

    HRESULT hr = XStoreQueryPackageUpdatesResultCount(
        asyncBlock,
        &count);

    if (FAILED(hr))
    {
        printf("XStoreQueryPackageUpdatesResultCount failed : 0x%x\n", hr);
        return;
    }

    printf("Number of updates: %d", count);

    if (count > 0)
    {
        XStorePackageUpdate* updates = new XStorePackageUpdate[count];
        hr = XStoreQueryPackageUpdatesResult(
            asyncBlock,
            count,
            updates);

        if (FAILED(hr))
        {
            delete[] updates;
            printf("XStoreQueryPackageUpdatesResult failed: 0x%x\n", hr);
            return;
        }

        for (uint32_t index = 0; index < count; index++)
        {
            printf("Update found for packageIdentifier: %s\n", updates[index].packageIdentifier);

            // Proceed to XStoreDownloadAndInstallPackageUpdates flow
        }

        delete[] updates;
    }
}

void QueryPackageUpdates(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle)
{
    std::vector<std::string> packageIds;

    HRESULT hr = XPackageEnumeratePackages(
        XPackageKind::Game,
        XPackageEnumerationScope::ThisAndRelated,
        &packageIds, [](void* context, const XPackageDetails* details) -> bool
        {
            auto packageIds = reinterpret_cast<std::vector<std::string>*>(context);

            printf("Identifier: %s name: %s\n", details->packageIdentifier, details->displayName);
            packageIds->push_back(details->packageIdentifier);
        });

    // packageIds now populated with ids for all installed packages

    auto asyncBlock = new XAsyncBlock();
    asyncBlock->queue = m_asyncQueue;
    asyncBlock->callback = QueryPackageUpdatesCallback;

    hr = XStoreQueryPackageUpdatesAsync(
        m_storeContext,
        packageIds.data(),
        packageIds.size(),
        asyncBlock);

    if (FAILED(hr))
    {
        printf("XStoreQueryPackageUpdatesAsync failed: 0x%x\n", hr);
        return;
    }
}   

```

## 요구 사항

**헤더:** XStore.h (XGameRuntime.h에 포함됨)

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [업데이트 확인](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-checking-for-updates)

## 참고 항목

[XStore](/reference/system/xstore/xstore_members)\
[XStoreQueryPackageUpdatesResult](/reference/system/xstore/functions/xstorequerypackageupdatesresult)\
[XStoreQueryPackageUpdatesResultCount](/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesresultcount)


## Related topics

- [XStoreQueryPackageUpdatesResult](/ko/reference/system/xstore/functions/xstorequerypackageupdatesresult.md)
- [XStoreQueryPackageUpdatesResultCount](/ko/reference/system/xstore/functions/xstorequerypackageupdatesresultcount.md)
- [업데이트 확인](/ko/publishing/xstore-commerce/xstore-checking-updates.md)
- [XStore](/ko/reference/system/xstore/xstore_members.md)
- [XStoreQueryGameAndDlcPackageUpdatesAsync](/ko/reference/system/xstore/functions/xstorequerygameanddlcpackageupdatesasync.md)
