RtlQueryPackageClaims - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H
#if (PHNT_VERSION >= PHNT_WINDOWS_10)

/**
 * The RtlQueryPackageClaims routine retrieves the package claims associated with a token, including the package full name, application identifier, and attributes.
 *
 * \param TokenHandle A handle to the token to query.
 * \param PackageFullName An optional buffer that receives the package full name.
 * \param PackageSize An optional pointer to the size, in bytes, of the PackageFullName buffer; updated with the required or written size.
 * \param AppId An optional buffer that receives the application identifier.
 * \param AppIdSize An optional pointer to the size, in bytes, of the AppId buffer; updated with the required or written size.
 * \param DynamicId An optional pointer to a variable that receives the dynamic package identifier.
 * \param PkgClaim An optional pointer to a PS_PKG_CLAIM structure that receives the package claim.
 * \param AttributesPresent An optional pointer to a variable that receives the mask of attributes present.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSAPI
NTSTATUS
NTAPI
RtlQueryPackageClaims(
    _In_ HANDLE TokenHandle,
    _Out_writes_bytes_to_opt_(*PackageSize, *PackageSize) PWSTR PackageFullName,
    _Inout_opt_ PSIZE_T PackageSize,
    _Out_writes_bytes_to_opt_(*AppIdSize, *AppIdSize) PWSTR AppId,
    _Inout_opt_ PSIZE_T AppIdSize,
    _Out_opt_ PGUID DynamicId,
    _Out_opt_ PPS_PKG_CLAIM PkgClaim,
    _Out_opt_ PULONG64 AttributesPresent
    );

#endif
#endif

View code on GitHub

NtDoc

Queries package identity and claim information for a token.

Parameters

Pseudo-handles

This function supports the following pseudo-handle values:

Notable return values

Implementation details

This function calls NtQuerySecurityAttributesToken and reads the values of the WIN://SYSAPPID and WIN://PKG attributes. When the caller request the list of present attributes, it also checks for the presence of WP://SKUID and XBOX://LI.

Remarks

Alternatively to using NtQuerySecurityAttributesToken, you can also enumerate all security attributes via NtQueryInformationToken with TokenSecurityAttributes and retrieve the values from there.

Required OS version

This function was introduced in Windows 10 TH1 (1507).

See also