Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions src/WingetCreateCore/Common/PackageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -804,13 +804,15 @@ 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.
case InstallerType.Portable:
return CompatibilitySet.Exe;
case InstallerType.Wix:
case InstallerType.Msi:
case InstallerType.AdvinstMsi:
return CompatibilitySet.Msi;
case InstallerType.Msix:
case InstallerType.Appx:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<Installer> newInstallers)
{
DefaultLocaleManifest defaultLocaleManifest = manifests?.DefaultLocaleManifest;
Expand All @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions src/WingetCreateCore/Models/InstallerManifestModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,


}

/// <summary>
Expand Down Expand Up @@ -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,


}

/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions src/WingetCreateCore/Models/SingletonManifestModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,


}

/// <summary>
Expand Down Expand Up @@ -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,


}

/// <summary>
Expand Down