Skip to content

Commit dd47aab

Browse files
author
Santosh Chintalapati
committed
Installer should FindPackages By FamilyName that are of Main and Framework PackageTypes ONLY.
1 parent 9d287d5 commit dd47aab

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

installer/dev/InstallActivityContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace WindowsAppRuntimeInstaller::InstallActivity
3939
GUID m_deploymentErrorActivityId{};
4040
WindowsAppRuntimeInstaller_TraceLogger::Install m_activity;
4141
WilFailure m_lastFailure{};
42-
HANDLE m_hEventLog;
42+
HANDLE m_hEventLog{};
4343
bool m_isLocalSystemUser{ Security::User::IsLocalSystem() };
4444
winrt::hstring m_existingPackageIfHigherVersion;
4545

installer/dev/console.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void WindowsAppRuntimeInstaller::Console::DisplayHeader()
99
{
1010
std::wcout << L"WindowsAppRuntimeInstaller -- Installs the Microsoft Windows App SDK runtime"
1111
<< "version: " << WINDOWSAPPSDK_RELEASE_VERSION;
12-
if (CompareStringOrdinal(WINDOWSAPPSDK_RELEASE_CHANNEL_W, static_cast<int>(sizeof(WINDOWSAPPSDK_RELEASE_CHANNEL_W)), L"", static_cast<int>(sizeof(L"")), TRUE) == CSTR_EQUAL)
12+
if (CompareStringOrdinal(WINDOWSAPPSDK_RELEASE_CHANNEL_W, -1, L"", -1, TRUE) == CSTR_EQUAL)
1313
{
1414
std::wcout << "-" << WINDOWSAPPSDK_RELEASE_CHANNEL_W;
1515
}

installer/dev/install.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ namespace WindowsAppRuntimeInstaller
281281
// Check if a higher version of the package is already installed.
282282
PackageManager packageManager;
283283
winrt::hstring currentUserSID;
284-
const auto installedPackages = packageManager.FindPackagesForUser(currentUserSID, packageProperties->familyName.get());
284+
auto installedPackages{ packageManager.FindPackagesForUserWithPackageTypes(currentUserSID, packageProperties->familyName.get(),
285+
::Windows::Management::Deployment::PackageTypes::Framework |
286+
::Windows::Management::Deployment::PackageTypes::Main) };
285287
bool isPackageInstalledAndIsPackageStatusOK{};
286288

287289
// installedPackages can contain only one version of the packagefamily across all servicing revisions of a WindowsAppSDK version.
@@ -291,11 +293,7 @@ namespace WindowsAppRuntimeInstaller
291293
// For the already installed package of same WindowsAppSDK Major.Minor version with matching architecture, compare version
292294
if (installedPackage.Id().Architecture() == packageProperties->architecture)
293295
{
294-
UINT64 installedPackageVersion = ((static_cast<UINT64>(installedPackage.Id().Version().Major) << 48) +
295-
(static_cast<UINT64>(installedPackage.Id().Version().Minor) << 32) +
296-
(static_cast<UINT64>(installedPackage.Id().Version().Build) << 16) +
297-
static_cast<UINT64>(installedPackage.Id().Version().Revision));
298-
296+
const auto installedPackageVersion{ AppModel::Package::ToPackageVersion(installedPackage.Id().Version()).Version };
299297
if (installedPackageVersion > packageProperties->version)
300298
{
301299
installActivityContext.SetExistingPackageIfHigherVersion(installedPackage.Id().FullName());

installer/dev/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <Security.IntegrityLevel.h>
3333
#include <Security.User.h>
3434
#include <PushNotifications-Constants.h>
35+
#include <AppModel.Package.h>
3536

3637
#include "tracelogging.h"
3738
#include "InstallActivityContext.h"

0 commit comments

Comments
 (0)