GetPackageId function (appmodel.h)

Gets the package identifier (ID) for the specified process.

Syntax

LONG GetPackageId(
  [in]            HANDLE hProcess,
  [in, out]       UINT32 *bufferLength,
  [out, optional] BYTE   *buffer
);

Parameters

[in] hProcess

Type: HANDLE

A handle to the process that has the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.

[in, out] bufferLength

Type: UINT32*

On input, the size of buffer, in bytes. On output, the size of the structure returned, in bytes.

[out, optional] buffer

Type: BYTE*

The package ID, represented as a PACKAGE_ID structure.

Return value

Type: LONG

If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code. The possible error codes include the following.

Return code Description
APPMODEL_ERROR_NO_PACKAGE
The process has no package identity.
ERROR_INSUFFICIENT_BUFFER
The buffer is not large enough to hold the data. The required size is specified by bufferLength.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header appmodel.h
Library Kernel32.lib
DLL Kernel32.dll

See also

GetCurrentPackageId

GetPackageFamilyName

GetPackageFullName