Skip to content

Latest commit

 

History

History
183 lines (136 loc) · 4.2 KB

nf-appmodel-getcurrentpackagefullname.md

File metadata and controls

183 lines (136 loc) · 4.2 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:appmodel.GetCurrentPackageFullName
GetCurrentPackageFullName function (appmodel.h)
Gets the package full name for the calling process.
GetCurrentPackageFullName
GetCurrentPackageFullName function [App packaging and management]
appmodel/GetCurrentPackageFullName
appxpkg.getcurrentpackagefullname
appxpkg\getcurrentpackagefullname.htm
appxpkg
D5B00C53-1FBF-4245-92D1-FA39713A9EE7
12/05/2018
GetCurrentPackageFullName, GetCurrentPackageFullName function [App packaging and management], appmodel/GetCurrentPackageFullName, appxpkg.getcurrentpackagefullname
appmodel.h
Windows
Windows 8 [desktop apps only]
Windows Server 2012 [desktop apps only]
Kernel32.lib
Kernel32.dll
Windows
19H1
GetCurrentPackageFullName
appmodel/GetCurrentPackageFullName
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-AppModel-Runtime-l1-1-0.dll
kernel32legacy.dll
Kernel.AppCore.dll
API-MS-Win-AppModel-RunTime-l1-1-1.dll
API-MS-Win-AppModel-Runtime-L1-1-2.dll
GetCurrentPackageFullName

GetCurrentPackageFullName function

-description

Gets the package full name for the calling process.

-parameters

-param packageFullNameLength [in, out]

Type: UINT32*

On input, the size of the packageFullName buffer, in characters. On output, the size of the package full name returned, in characters, including the null terminator.

-param packageFullName [out, optional]

Type: PWSTR

The package full name.

-returns

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

-remarks

For info about string size limits, see Identity constants.

Examples

#define _UNICODE 1
#define UNICODE 1

#include <Windows.h>
#include <appmodel.h>
#include <malloc.h>
#include <stdio.h>

int __cdecl wmain()
{
    UINT32 length = 0;
    LONG rc = GetCurrentPackageFullName(&length, NULL);
    if (rc != ERROR_INSUFFICIENT_BUFFER)
    {
        if (rc == APPMODEL_ERROR_NO_PACKAGE)
            wprintf(L"Process has no package identity\n");
        else
            wprintf(L"Error %d in GetCurrentPackageFullName\n", rc);
        return 1;
    }

    PWSTR fullName = (PWSTR) malloc(length * sizeof(*fullName));
    if (fullName == NULL)
    {
        wprintf(L"Error allocating memory\n");
        return 2;
    }

    rc = GetCurrentPackageFullName(&length, fullName);
    if (rc != ERROR_SUCCESS)
    {
        wprintf(L"Error %d retrieving PackageFullName\n", rc);
        return 3;
    }
    wprintf(L"%s\n", fullName);

    free(fullName);

    return 0;
}

-see-also

GetCurrentPackageFamilyName

GetCurrentPackageId

GetCurrentPackageInfo

GetCurrentPackagePath

GetPackageFullName

PackageFullNameFromId