-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathAppInstallerDeployment.h
More file actions
77 lines (65 loc) · 3.53 KB
/
AppInstallerDeployment.h
File metadata and controls
77 lines (65 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include <AppInstallerProgress.h>
#include <optional>
#include <string>
#include <string_view>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Management.Deployment.h>
namespace AppInstaller::Deployment
{
// A set of optional values useful across many of the deployment functions.
struct Options
{
Options() = default;
explicit Options(bool skipReputationCheck) : SkipReputationCheck(skipReputationCheck) {}
// Avoid using APIs that make a reputation check.
bool SkipReputationCheck = false;
// The pairs of URI+Digest to enforce.
std::vector<std::pair<std::string, std::wstring>> ExpectedDigests;
};
// Calls winrt::Windows::Management::Deployment::PackageManager::AddPackageAsync if skipSmartScreen is true,
// Otherwise, calls winrt::Windows::Management::Deployment::PackageManager::RequestAddPackageAsync
void AddPackage(
const winrt::Windows::Foundation::Uri& uri,
const Options& options,
IProgressCallback& callback);
// Calls winrt::Windows::Management::Deployment::PackageManager::AddPackageAsync if skipSmartScreen is true,
// Otherwise, calls winrt::Windows::Management::Deployment::PackageManager::RequestAddPackageAsync.
// If the Add function fails due to the package being in use, we fall back to stage and register, which allows
// a deferred registration.
// Returns true if the registration was deferred; false if not.
bool AddPackageWithDeferredFallback(
std::string_view uri,
const Options& options,
IProgressCallback& callback);
// Calls winrt::Windows::Management::Deployment::PackageManager::RemovePackageAsync
void RemovePackage(
std::string_view packageFullName,
winrt::Windows::Management::Deployment::RemovalOptions options,
IProgressCallback& callback);
// Calls winrt::Windows::Management::Deployment::PackageManager::StagePackageAsync
// winrt::Windows::Management::Deployment::PackageManager::ProvisionPackageForAllUsersAsync
// winrt::Windows::Management::Deployment::PackageManager::RegisterPackageByFullNameAsync if not running as system
bool AddPackageMachineScope(
std::string_view uri,
const Options& options,
IProgressCallback& callback);
// Calls winrt::Windows::Management::Deployment::PackageManager::DeprovisionPackageForAllUsersAsync
// winrt::Windows::Management::Deployment::PackageManager::RemovePackageAsync with RemoveForAllUsers
void RemovePackageMachineScope(
std::string_view packageFamilyName,
std::string_view packageFullName,
IProgressCallback& callback);
// Calls winrt::Windows::Management::Deployment::PackageManager::FindPackagesForUser
bool IsRegistered(std::string_view packageFamilyName);
// Returns the version string (major.minor.build.revision) for the first package found for the family name, if any.
std::optional<std::string> GetInstalledVersionStringForFamilyName(std::string_view packageFamilyName);
// Calls winrt::Windows::Management::Deployment::PackageManager::RegisterPackageByFamilyNameAsync
void RegisterPackage(
std::string_view packageFamilyName,
IProgressCallback& callback);
// Determines if the ExpectedDigests property (and thus feture) is supported on the current version of Windows.
bool IsExpectedDigestsSupported();
}