Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

GetCurrentPackageFullName function

Gets the package full name for the calling process.

Syntax


LONG WINAPI GetCurrentPackageFullName(
  _Inout_    UINT32 *packageFullNameLength,
  _Out_opt_  PWSTR packageFullName
);

Parameters

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.

packageFullName [out, optional]

Type: PWSTR

The package full name.

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 codeDescription
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"GetCurrentPackageFullName failed with error %d\n", rc);
        return 1;
    }

    PWSTR fullName = (PWSTR) malloc(length * sizeof(*fullName));
    if (fullName == NULL)
    {
        wprintf(L"Memory allocation failed\n");
        return 2;
    }

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

    free(fullName);

    return 0;
}

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

AppModel.h

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetCurrentPackageFamilyName
GetCurrentPackageId
GetCurrentPackageInfo
GetCurrentPackagePath
GetPackageFullName
PackageFullNameFromId

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.