Función GetCurrentPackageFullName (appmodel.h)

Obtiene el nombre completo del paquete para el proceso de llamada.

Sintaxis

LONG GetCurrentPackageFullName(
  [in, out]       UINT32 *packageFullNameLength,
  [out, optional] PWSTR  packageFullName
);

Parámetros

[in, out] packageFullNameLength

Tipo: UINT32*

En la entrada, el tamaño del búfer packageFullName , en caracteres. En la salida, se devuelve el tamaño del nombre completo del paquete, en caracteres, incluido el terminador NULL.

[out, optional] packageFullName

Tipo: PWSTR

Nombre completo del paquete.

Valor devuelto

Tipo: LONG

Si la función se realiza correctamente, devuelve ERROR_SUCCESS. De lo contrario, la función devuelve un código de error. Los posibles códigos de error incluyen lo siguiente.

Código devuelto Descripción
APPMODEL_ERROR_NO_PACKAGE
El proceso no tiene ninguna identidad de paquete.
ERROR_INSUFFICIENT_BUFFER
El búfer no es lo suficientemente grande como para contener los datos. El tamaño necesario se especifica mediante packageFullNameLength.

Comentarios

Para obtener información sobre los límites de tamaño de cadena, consulte Constantes de identidad.

Ejemplos

#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;
}

Requisitos

Requisito Value
Cliente mínimo compatible Windows 8 [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows Server 2012 [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado appmodel.h
Library Kernel32.lib
Archivo DLL Kernel32.dll

Vea también

GetCurrentPackageFamilyName

GetCurrentPackageId

GetCurrentPackageInfo

GetCurrentPackagePath

GetPackageFullName

PackageFullNameFromId