From 711141893c3a2944dbd024ca8d9a3ae42a4d11c2 Mon Sep 17 00:00:00 2001 From: Stefan Pirvulescu Date: Fri, 5 Sep 2025 13:44:50 +0300 Subject: [PATCH 1/4] add advinstExe in enums --- src/WingetCreateCore/Common/PackageParser.cs | 1 + src/WingetCreateCore/Models/InstallerManifestModels.cs | 6 ++++++ src/WingetCreateCore/Models/SingletonManifestModels.cs | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 984650c2..88d3b260 100644 --- a/src/WingetCreateCore/Common/PackageParser.cs +++ b/src/WingetCreateCore/Common/PackageParser.cs @@ -804,6 +804,7 @@ private static CompatibilitySet GetCompatibilitySet(InstallerType type) case InstallerType.Nullsoft: case InstallerType.Exe: case InstallerType.Burn: + case InstallerType.AdvinstExe: // Portable is included as a compatible installer type since // they are detected as 'exe' installers. This is to ensure // updating a portable manifest is supported. diff --git a/src/WingetCreateCore/Models/InstallerManifestModels.cs b/src/WingetCreateCore/Models/InstallerManifestModels.cs index 03aaa420..fcdb3af5 100644 --- a/src/WingetCreateCore/Models/InstallerManifestModels.cs +++ b/src/WingetCreateCore/Models/InstallerManifestModels.cs @@ -59,6 +59,9 @@ public enum InstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 11, + } @@ -104,6 +107,9 @@ public enum NestedInstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 8, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 9, + } diff --git a/src/WingetCreateCore/Models/SingletonManifestModels.cs b/src/WingetCreateCore/Models/SingletonManifestModels.cs index 1b6ee467..a2844a4a 100644 --- a/src/WingetCreateCore/Models/SingletonManifestModels.cs +++ b/src/WingetCreateCore/Models/SingletonManifestModels.cs @@ -182,6 +182,9 @@ public enum InstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 11, + } @@ -227,6 +230,9 @@ public enum NestedInstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 8, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 9, + } From 54e86a409913de4357a0b4dd085eb9d77a6f8940 Mon Sep 17 00:00:00 2001 From: Stefan Pirvulescu Date: Tue, 9 Sep 2025 11:38:42 +0300 Subject: [PATCH 2/4] detect exe made by advinst --- src/WingetCreateCore/Common/PackageParser.cs | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 88d3b260..7f4d6da4 100644 --- a/src/WingetCreateCore/Common/PackageParser.cs +++ b/src/WingetCreateCore/Common/PackageParser.cs @@ -843,6 +843,10 @@ private static bool ParseExeInstallerType(string path, Installer baseInstaller, // See https://github.com/microsoft/winget-create/issues/26, a Burn installer is an exe-installer produced by the WiX toolset. installerTypeEnum = InstallerType.Burn; } + else if (IsAdvinstExe(path)) + { + installerTypeEnum = InstallerType.AdvinstExe; + } else if (KnownInstallerResourceNames.Contains(installerType)) { // If it's a known exe installer type, set as appropriately @@ -900,6 +904,27 @@ private static bool IsWix(QDatabase installer) installer.SummaryInfo.CreatingApp.ToLower().Contains("windows installer xml"); } + private static bool IsAdvinstExe(string path) + { + try + { + string extractLocation = Directory.CreateTempSubdirectory().ToString(); + + Process.Start(new ProcessStartInfo + { + FileName = path, + Arguments = $"/extract \"{extractLocation}\"", + CreateNoWindow = true, + }).WaitForExit(); + + return Directory.EnumerateFiles(extractLocation, "*.msi").Any(); + } + catch (Win32Exception) + { + return false; + } + } + private static bool ParseMsi(string path, Installer baseInstaller, Manifests manifests, List newInstallers) { DefaultLocaleManifest defaultLocaleManifest = manifests?.DefaultLocaleManifest; From 92583970e893ef59a90eefaa914b81c6d7f91e81 Mon Sep 17 00:00:00 2001 From: Stefan Pirvulescu Date: Tue, 9 Sep 2025 15:25:27 +0300 Subject: [PATCH 3/4] add advinstMsi enum and detection --- src/WingetCreateCore/Common/PackageParser.cs | 12 +++++++++--- .../Models/InstallerManifestModels.cs | 10 ++++++++++ .../Models/SingletonManifestModels.cs | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 7f4d6da4..2a66ecfd 100644 --- a/src/WingetCreateCore/Common/PackageParser.cs +++ b/src/WingetCreateCore/Common/PackageParser.cs @@ -925,6 +925,11 @@ private static bool IsAdvinstExe(string path) } } + private static bool IsAdvinstMsi(QDatabase installer) + { + return installer.Properties.AsEnumerable().Any(property => property.Property.StartsWith("AI_")); + } + private static bool ParseMsi(string path, Installer baseInstaller, Manifests manifests, List newInstallers) { DefaultLocaleManifest defaultLocaleManifest = manifests?.DefaultLocaleManifest; @@ -933,9 +938,10 @@ private static bool ParseMsi(string path, Installer baseInstaller, Manifests man { using (var database = new QDatabase(path, Deployment.WindowsInstaller.DatabaseOpenMode.ReadOnly)) { - InstallerType installerType = IsWix(database) - ? InstallerType.Wix - : InstallerType.Msi; + InstallerType installerType = IsAdvinstMsi(database) ? InstallerType.AdvinstMsi : + IsWix(database) ? InstallerType.Wix : + InstallerType.Msi; + SetInstallerType(baseInstaller, installerType); var properties = database.Properties.ToList(); diff --git a/src/WingetCreateCore/Models/InstallerManifestModels.cs b/src/WingetCreateCore/Models/InstallerManifestModels.cs index fcdb3af5..a801775e 100644 --- a/src/WingetCreateCore/Models/InstallerManifestModels.cs +++ b/src/WingetCreateCore/Models/InstallerManifestModels.cs @@ -59,10 +59,15 @@ public enum InstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] AdvinstExe = 11, + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 12, + + } /// @@ -107,10 +112,15 @@ public enum NestedInstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 8, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] AdvinstExe = 9, + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 10, + + } /// diff --git a/src/WingetCreateCore/Models/SingletonManifestModels.cs b/src/WingetCreateCore/Models/SingletonManifestModels.cs index a2844a4a..4a95ce98 100644 --- a/src/WingetCreateCore/Models/SingletonManifestModels.cs +++ b/src/WingetCreateCore/Models/SingletonManifestModels.cs @@ -182,10 +182,15 @@ public enum InstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] AdvinstExe = 11, + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 12, + + } /// @@ -230,10 +235,15 @@ public enum NestedInstallerType [System.Runtime.Serialization.EnumMember(Value = @"portable")] Portable = 8, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] AdvinstExe = 9, + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 10, + + } /// From d75a7ceb1a4c2da7317e4e5d14d8811f65e92d14 Mon Sep 17 00:00:00 2001 From: Stefan Pirvulescu Date: Tue, 9 Sep 2025 15:29:03 +0300 Subject: [PATCH 4/4] add advinstMsi case --- src/WingetCreateCore/Common/PackageParser.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 2a66ecfd..c6d7e454 100644 --- a/src/WingetCreateCore/Common/PackageParser.cs +++ b/src/WingetCreateCore/Common/PackageParser.cs @@ -812,6 +812,7 @@ private static CompatibilitySet GetCompatibilitySet(InstallerType type) return CompatibilitySet.Exe; case InstallerType.Wix: case InstallerType.Msi: + case InstallerType.AdvinstMsi: return CompatibilitySet.Msi; case InstallerType.Msix: case InstallerType.Appx: