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

# XStoreQueryPackageIdentifier

> XStoreQueryPackageIdentifier

# XStoreQueryPackageIdentifier

检索指定应用商店 ID 的包标识符。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
HRESULT XStoreQueryPackageIdentifier(
         const char* storeId,
         size_t size,
         char* packageIdentifier
)
```

<a id="parametersSection" />

### 参数

*storeId*   \_In\_z\_\
类型：char\*

包含包的产品在应用商店中的 ID。

*size*   \_In\_\
类型：size\_t

包标识符中的字符数。此大小必须至少为 XPACKAGE\_IDENTIFIER\_MAX\_LENGTH (33)。

*packageIdentifier*   \_Out\_writes\_z\_(size)\
类型：char\*

成功时，包含包标识符。有关包标识符的详细信息，请参阅[管理和授权可下载内容 (DLC)](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages)。

<a id="retvalSection" />

### 返回值

类型：HRESULT

成功时返回 **S\_OK**，否则返回错误代码。

| 错误代码                      | 说明                  |
| ------------------------- | ------------------- |
| 0x80070057 `E_INVALIDARG` | 没有对应于该应用商店 ID 的已安装包 |

<a id="remarksSection" />

## 备注

要下载并安装指定的应用商店包，请调用 [XStoreDownloadAndInstallPackagesAsync](/reference/system/xstore/functions/xstoredownloadandinstallpackagesasync)。

要获取对 `XStoreDownloadAndInstallPackagesAsync` 调用的结果，请调用 [XStoreDownloadAndInstallPackagesResult](/reference/system/xstore/functions/xstoredownloadandinstallpackagesresult)。

要获取由 `XStoreDownloadAndInstallPackagesResult` 返回的结果中的项数，请调用 [XStoreDownloadAndInstallPackagesResultCount](/reference/system/xstore/functions/xstoredownloadandinstallpackagesresultcount)。

<a id="requirementsSection" />

## 要求

**头文件：** XStore.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[XStore](/reference/system/xstore/xstore_members)


## Related topics

- [XStore](/zh-CN/reference/system/xstore/xstore_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XStoreQueryPackageUpdatesAsync](/zh-CN/reference/system/xstore/functions/xstorequerypackageupdatesasync.md)
- [XStoreQueryProductForPackageAsync](/zh-CN/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)
- [XStoreQueryProductForPackageResult](/zh-CN/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)
