From 0cfc90f4cd912a44610abf5298debeaadb158ce1 Mon Sep 17 00:00:00 2001 From: Stefan Pirvulescu Date: Thu, 19 Dec 2024 14:56:28 +0200 Subject: [PATCH] add advinstMsi installer type --- .../v1.10.0/manifest.installer.1.10.0.json | 6 ++-- .../v1.10.0/manifest.singleton.1.10.0.json | 6 ++-- .../Workflows/DownloadFlow.cpp | 3 ++ .../Workflows/InstallFlow.cpp | 3 ++ .../Workflows/RepairFlow.cpp | 2 ++ .../Workflows/UninstallFlow.cpp | 2 ++ .../Manifest/ManifestCommon.cpp | 28 ++++++++++++++++--- .../Public/winget/ManifestCommon.h | 1 + .../1_0/Json/ManifestDeserializer_1_0.cpp | 4 +++ .../Converters.cpp | 6 +++- .../PackageManager.idl | 2 ++ 11 files changed, 54 insertions(+), 9 deletions(-) diff --git a/schemas/JSON/manifests/v1.10.0/manifest.installer.1.10.0.json b/schemas/JSON/manifests/v1.10.0/manifest.installer.1.10.0.json index 5c0ec2c5d0..f8dccbfeab 100644 --- a/schemas/JSON/manifests/v1.10.0/manifest.installer.1.10.0.json +++ b/schemas/JSON/manifests/v1.10.0/manifest.installer.1.10.0.json @@ -66,7 +66,8 @@ "burn", "pwa", "portable", - "advinstExe" + "advinstExe", + "advinstMsi" ], "description": "Enumeration of supported installer types. InstallerType is required in either root level or individual Installer level" }, @@ -82,7 +83,8 @@ "wix", "burn", "portable", - "advinstExe" + "advinstExe", + "advinstMsi" ], "description": "Enumeration of supported nested installer types contained inside an archive file" }, diff --git a/schemas/JSON/manifests/v1.10.0/manifest.singleton.1.10.0.json b/schemas/JSON/manifests/v1.10.0/manifest.singleton.1.10.0.json index 8b1947af89..a7ab1a177e 100644 --- a/schemas/JSON/manifests/v1.10.0/manifest.singleton.1.10.0.json +++ b/schemas/JSON/manifests/v1.10.0/manifest.singleton.1.10.0.json @@ -168,7 +168,8 @@ "burn", "pwa", "portable", - "advinstExe" + "advinstExe", + "advinstMsi" ], "description": "Enumeration of supported installer types. InstallerType is required in either root level or individual Installer level" }, @@ -184,7 +185,8 @@ "wix", "burn", "portable", - "advinstExe" + "advinstExe", + "advinstMsi" ], "description": "Enumeration of supported nested installer types contained inside an archive file" }, diff --git a/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp b/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp index c8ede97107..18664e8eac 100644 --- a/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp @@ -52,6 +52,7 @@ namespace AppInstaller::CLI::Workflow return L".exe"sv; case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: return L".msi"sv; case InstallerTypeEnum::Msix: // Note: We may need to distinguish between .msix and .msixbundle in the future. @@ -224,6 +225,8 @@ namespace AppInstaller::CLI::Workflow case InstallerTypeEnum::Portable: case InstallerTypeEnum::Wix: case InstallerTypeEnum::Zip: + case InstallerTypeEnum::AdvinstExe: + case InstallerTypeEnum::AdvinstMsi: context << DownloadInstallerFile; break; case InstallerTypeEnum::Msix: diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp index e8a720ca14..2f33f516cb 100644 --- a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -53,6 +53,7 @@ namespace AppInstaller::CLI::Workflow case InstallerTypeEnum::Nullsoft: case InstallerTypeEnum::Wix: case InstallerTypeEnum::AdvinstExe: + case InstallerTypeEnum::AdvinstMsi: return true; default: return false; @@ -65,6 +66,7 @@ namespace AppInstaller::CLI::Workflow { case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: return isSilentInstall || ExperimentalFeature::IsEnabled(ExperimentalFeature::Feature::DirectMSI); default: return false; @@ -408,6 +410,7 @@ namespace AppInstaller::CLI::Workflow case InstallerTypeEnum::Nullsoft: case InstallerTypeEnum::Wix: case InstallerTypeEnum::AdvinstExe: + case InstallerTypeEnum::AdvinstMsi: if (doUninstallPrevious) { context << diff --git a/src/AppInstallerCLICore/Workflows/RepairFlow.cpp b/src/AppInstallerCLICore/Workflows/RepairFlow.cpp index 81a984fd2d..8ee05dbc14 100644 --- a/src/AppInstallerCLICore/Workflows/RepairFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/RepairFlow.cpp @@ -345,6 +345,7 @@ namespace AppInstaller::CLI::Workflow break; case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: { context << RepairMsiBasedInstaller; @@ -389,6 +390,7 @@ namespace AppInstaller::CLI::Workflow // MSI based installers, for installed package all gets mapped to msi extension. case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: { context << SetProductCodesInContext; diff --git a/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp b/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp index 0fb010f686..061d52a99c 100644 --- a/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp @@ -246,6 +246,7 @@ namespace AppInstaller::CLI::Workflow } case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: { // Uninstall strings for MSI don't include UI level (/q) needed to avoid interactivity, // so we handle them differently. @@ -337,6 +338,7 @@ namespace AppInstaller::CLI::Workflow break; case InstallerTypeEnum::Msi: case InstallerTypeEnum::Wix: + case InstallerTypeEnum::AdvinstMsi: context << Workflow::ShellExecuteMsiExecUninstall << ReportUninstallerResult("MsiExec", APPINSTALLER_CLI_ERROR_EXEC_UNINSTALL_COMMAND_FAILED); diff --git a/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp b/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp index 1928825861..af84fff530 100644 --- a/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp +++ b/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp @@ -28,6 +28,7 @@ namespace AppInstaller::Manifest return CompatibilitySet::Exe; case InstallerTypeEnum::Wix: case InstallerTypeEnum::Msi: + case InstallerTypeEnum::AdvinstMsi: return CompatibilitySet::Msi; case InstallerTypeEnum::Msix: case InstallerTypeEnum::MSStore: @@ -167,6 +168,10 @@ namespace AppInstaller::Manifest { result = InstallerTypeEnum::AdvinstExe; } + else if (inStrLower == "advinstmsi") + { + result = InstallerTypeEnum::AdvinstMsi; + } return result; } @@ -590,6 +595,8 @@ namespace AppInstaller::Manifest return "portable"sv; case InstallerTypeEnum::AdvinstExe: return "advinstexe"sv; + case InstallerTypeEnum::AdvinstMsi: + return "advinstmsi"sv; } return "unknown"sv; @@ -896,7 +903,8 @@ namespace AppInstaller::Manifest installerType == InstallerTypeEnum::Wix || installerType == InstallerTypeEnum::Burn || installerType == InstallerTypeEnum::Portable || - installerType == InstallerTypeEnum::AdvinstExe + installerType == InstallerTypeEnum::AdvinstExe || + installerType == InstallerTypeEnum::AdvinstMsi ); } @@ -910,7 +918,8 @@ namespace AppInstaller::Manifest installerType == InstallerTypeEnum::Wix || installerType == InstallerTypeEnum::Burn || installerType == InstallerTypeEnum::Portable || - installerType == InstallerTypeEnum::AdvinstExe + installerType == InstallerTypeEnum::AdvinstExe || + installerType == InstallerTypeEnum::AdvinstMsi ); } @@ -923,7 +932,8 @@ namespace AppInstaller::Manifest installerType == InstallerTypeEnum::Nullsoft || installerType == InstallerTypeEnum::Wix || installerType == InstallerTypeEnum::Burn || - installerType == InstallerTypeEnum::AdvinstExe + installerType == InstallerTypeEnum::AdvinstExe || + installerType == InstallerTypeEnum::AdvinstMsi ); } @@ -974,7 +984,8 @@ namespace AppInstaller::Manifest nestedInstallerType == InstallerTypeEnum::Burn || nestedInstallerType == InstallerTypeEnum::Portable || nestedInstallerType == InstallerTypeEnum::Msix || - nestedInstallerType == InstallerTypeEnum::AdvinstExe + nestedInstallerType == InstallerTypeEnum::AdvinstExe || + nestedInstallerType == InstallerTypeEnum::AdvinstMsi ); } @@ -1041,6 +1052,14 @@ namespace AppInstaller::Manifest {InstallerSwitchType::Log, ManifestInstaller::string_t("/l*v \"" + std::string(ARG_TOKEN_LOGPATH) + "\"")}, {InstallerSwitchType::InstallLocation, ManifestInstaller::string_t("APPDIR=\"" + std::string(ARG_TOKEN_INSTALLPATH) + "\"")} }; + case InstallerTypeEnum::AdvinstMsi: + return + { + {InstallerSwitchType::Silent, ManifestInstaller::string_t("/quiet /norestart")}, + {InstallerSwitchType::SilentWithProgress, ManifestInstaller::string_t("/passive /norestart")}, + {InstallerSwitchType::Log, ManifestInstaller::string_t("/log \"" + std::string(ARG_TOKEN_LOGPATH) + "\"")}, + {InstallerSwitchType::InstallLocation, ManifestInstaller::string_t("APPDIR=\"" + std::string(ARG_TOKEN_INSTALLPATH) + "\"")} + }; default: return {}; } @@ -1075,6 +1094,7 @@ namespace AppInstaller::Manifest case InstallerTypeEnum::Wix: case InstallerTypeEnum::Msi: case InstallerTypeEnum::AdvinstExe: + case InstallerTypeEnum::AdvinstMsi: // See https://docs.microsoft.com/windows/win32/msi/error-codes return { diff --git a/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h b/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h index 41fb0013d3..d4af2c1344 100644 --- a/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h +++ b/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h @@ -101,6 +101,7 @@ namespace AppInstaller::Manifest MSStore, Portable, AdvinstExe, + AdvinstMsi }; enum class UpdateBehaviorEnum diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer_1_0.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer_1_0.cpp index 6ef21e0374..8549de7281 100644 --- a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer_1_0.cpp +++ b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer_1_0.cpp @@ -535,6 +535,10 @@ namespace AppInstaller::Repository::Rest::Schema::V1_0::Json { return InstallerTypeEnum::AdvinstExe; } + else if (inStrLower == "advinstmsi") + { + return InstallerTypeEnum::AdvinstMsi; + } return InstallerTypeEnum::Unknown; } diff --git a/src/Microsoft.Management.Deployment/Converters.cpp b/src/Microsoft.Management.Deployment/Converters.cpp index 6ce24133ac..46de01ea9a 100644 --- a/src/Microsoft.Management.Deployment/Converters.cpp +++ b/src/Microsoft.Management.Deployment/Converters.cpp @@ -286,7 +286,9 @@ namespace winrt::Microsoft::Management::Deployment::implementation case ::AppInstaller::Manifest::InstallerTypeEnum::Zip: return Microsoft::Management::Deployment::PackageInstallerType::Zip; case ::AppInstaller::Manifest::InstallerTypeEnum::AdvinstExe: - return Microsoft::Management::Deployment::PackageInstallerType::AdvinstExe; + return Microsoft::Management::Deployment::PackageInstallerType::AdvinstExe; + case ::AppInstaller::Manifest::InstallerTypeEnum::AdvinstMsi: + return Microsoft::Management::Deployment::PackageInstallerType::AdvinstMsi; case ::AppInstaller::Manifest::InstallerTypeEnum::Unknown: return Microsoft::Management::Deployment::PackageInstallerType::Unknown; } @@ -320,6 +322,8 @@ namespace winrt::Microsoft::Management::Deployment::implementation return ::AppInstaller::Manifest::InstallerTypeEnum::Zip; case Microsoft::Management::Deployment::PackageInstallerType::AdvinstExe: return ::AppInstaller::Manifest::InstallerTypeEnum::AdvinstExe; + case Microsoft::Management::Deployment::PackageInstallerType::AdvinstMsi: + return ::AppInstaller::Manifest::InstallerTypeEnum::AdvinstMsi; case Microsoft::Management::Deployment::PackageInstallerType::Unknown: return ::AppInstaller::Manifest::InstallerTypeEnum::Unknown; } diff --git a/src/Microsoft.Management.Deployment/PackageManager.idl b/src/Microsoft.Management.Deployment/PackageManager.idl index 1cbde5809e..124e3e8416 100644 --- a/src/Microsoft.Management.Deployment/PackageManager.idl +++ b/src/Microsoft.Management.Deployment/PackageManager.idl @@ -469,6 +469,8 @@ namespace Microsoft.Management.Deployment Portable, /// AdvancedInstaller exe type. AdvinstExe, + /// AdvancedInstaller msi type. + AdvinstMsi, }; /// The package installer scope.