diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 984650c2..c6d7e454 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. @@ -811,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: @@ -842,6 +844,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 @@ -899,6 +905,32 @@ 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 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; @@ -907,9 +939,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 03aaa420..a801775e 100644 --- a/src/WingetCreateCore/Models/InstallerManifestModels.cs +++ b/src/WingetCreateCore/Models/InstallerManifestModels.cs @@ -60,6 +60,14 @@ public enum InstallerType Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 11, + + + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 12, + + } /// @@ -105,6 +113,14 @@ public enum NestedInstallerType 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 1b6ee467..4a95ce98 100644 --- a/src/WingetCreateCore/Models/SingletonManifestModels.cs +++ b/src/WingetCreateCore/Models/SingletonManifestModels.cs @@ -183,6 +183,14 @@ public enum InstallerType Portable = 10, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 11, + + + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 12, + + } /// @@ -228,6 +236,14 @@ public enum NestedInstallerType Portable = 8, + [System.Runtime.Serialization.EnumMember(Value = @"advinstExe")] + AdvinstExe = 9, + + + [System.Runtime.Serialization.EnumMember(Value = @"advinstMsi")] + AdvinstMsi = 10, + + } ///