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

# XPackageGetPackageKind

> XPackageGetPackageKind

# XPackageGetPackageKind

返回由包标识符标识的安装包的类型。

## 语法

```cpp theme={null}
HRESULT XPackageGetPackageKind(  
         _In_z_ const char* packageIdentifier,  
         _Out_ XPackageKind* kind  
)
```

### 参数

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

唯一标识磁盘上已安装包的字符串。有关包标识符的详细信息，请参阅[管理可下载内容 (DLC) 并授予许可](/zh-CN/publishing/xstore-commerce/xstore-dlc)。

*kind*   \_Out\_\
类型：[XPackageKind](/zh-CN/reference/system/xpackage/enums/xpackagekind)\*

返回时，包含描述该包的 [XPackageKind](/zh-CN/reference/system/xpackage/enums/xpackagekind) 值。

### 返回值

类型：HRESULT

成功时返回 `S_OK`，否则返回错误代码。

## 备注

如果你有一个包标识符，并且需要确定它引用的是游戏、可下载内容 (DLC) 包还是发布者内容包，请使用 `XPackageGetPackageKind`。如果你已经知道要使用的类型，最好将相应的 [XPackageKind](/zh-CN/reference/system/xpackage/enums/xpackagekind) 值传递给 [XPackageEnumeratePackages](/zh-CN/reference/system/xpackage/functions/xpackageenumeratepackages)，以便枚举仅返回匹配的包。

请参阅以下代码示例。

```cpp theme={null}
XPackageKind kind;
HRESULT hr = XPackageGetPackageKind(packageIdentifier, &kind);
if (SUCCEEDED(hr) && kind == XPackageKind::PublisherContent)
{
    // Handle Publisher Content.
}
```

## 要求

**头文件：** XPackage.h

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

## 另请参阅

[XPackage](/zh-CN/reference/system/xpackage/xpackage_members)\
[XPackageKind](/zh-CN/reference/system/xpackage/enums/xpackagekind)\
[XPackageEnumeratePackages](/zh-CN/reference/system/xpackage/functions/xpackageenumeratepackages)\
[发布者内容包](/zh-CN/build/core-features/common/packaging/packaging-publisher-content)


## Related topics

- [发布者内容包](/zh-CN/build/core-features/common/packaging/packaging-publisher-content.md)
- [XPackage](/zh-CN/reference/system/xpackage/xpackage_members.md)
- [XPackageKind](/zh-CN/reference/system/xpackage/enums/xpackagekind.md)
- [XPackageGetCurrentProcessPackageIdentifier](/zh-CN/reference/system/xpackage/functions/xpackagegetcurrentprocesspackageidentifier.md)
- [XPackageGetInstallationProgress](/zh-CN/reference/system/xpackage/functions/xpackagegetinstallationprogress.md)
