Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GetStagedPackageOrigin function

Gets the origin of the specified package.

Syntax


LONG WINAPI GetStagedPackageOrigin(
  _In_  PCWSTR        packageFullName,
  _Out_ PackageOrigin *origin
);

Parameters

packageFullName [in]

Type: PCWSTR

The full name of the package.

origin [out]

Type: PackageOrigin*

A pointer to a variable that receives a PackageOrigin-typed value that indicates the origin of the package specified by packageFullName.

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
ERROR_INVALID_PARAMETER

The packageFullName parameter isn't valid.

 

Examples


#define _UNICODE 1
#define UNICODE 1

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

int ShowUsage();
void GetOrigin(__in PCWSTR fullName);
void ShowOrigin(__in const PackageOrigin origin);

int ShowUsage()
{
    wprintf(L"Usage: GetStagedPackageOrigin <fullname> [<fullname>...]\n");
    return 1;
}

int __cdecl wmain(__in int argc, __in_ecount(argc) WCHAR * argv[])
{
    if (argc <= 1)
        return ShowUsage();

    for (int i=1; i<argc; ++i)
    {
        GetOrigin(argv[i]);
    }

    return 0;
}

void GetOrigin(__in PCWSTR fullName)
{
    wprintf(L"FullName: %s\n", fullName);
    PackageOrigin origin;
    LONG rc = GetStagedPackageOrigin(fullName, &origin);
    if (rc != ERROR_SUCCESS)
        wprintf(L"Error %d retrieving package origin\n", rc);
    else
        ShowOrigin(origin);
}

void ShowOrigin(__in const PackageOrigin origin)
{
    static PCWSTR originAsString[] = {
        L"Unknown",
        L"Unsigned",
        L"Inbox",
        L"Store",
        L"DeveloperUnsigned",
        L"DeveloperSigned",
        L"LineOfBusiness"
    };
    PCWSTR string = origin >= ARRAYSIZE(originAsString) ? L"?" : originAsString[origin];
    wprintf(L"    Origin: %s (%d)\n", string, origin);
}


Requirements

Minimum supported client

Windows 8.1 [desktop apps only]

Minimum supported server

Windows Server 2012 R2 [desktop apps only]

Header

AppModel.h

Library

Kernel32.lib

DLL

Kernel32.dll

 

 

Show:
© 2017 Microsoft