Skip to content

Commit 7bd7abb

Browse files
committed
updated installer to prevent install on wrong type of OS
1 parent 0c1b427 commit 7bd7abb

File tree

9 files changed

+40
-39
lines changed

9 files changed

+40
-39
lines changed

CloudVeilInstaller/Bundle.wxs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
33
<Bundle DisableRepair="yes" Name="CloudVeil for Windows" Version="2.4.3" Manufacturer="CloudVeil Technology, Inc." UpgradeCode="f034362e-0800-43d6-be30-721747f8a948" IconSourceFile="..\CloudVeilGUI\appicon.ico">
4+
5+
<Variable Name="MsiPlatform" Type="string" Value="$(var.MsiPlatform)" Persisted="yes"/>
46
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
57
<PayloadGroupRef Id="InstallerPayload" />
68
</BootstrapperApplicationRef>
@@ -10,6 +12,7 @@
1012
<ExePackage Compressed="yes" PerMachine="yes" Cache="always" Id="InstallerCheckPackageCache_UnInstall" InstallCondition="0" DetectCondition="1" SourceFile="..\InstallerCheckPackageCache\bin\Release\InstallerCheckPackageCache.exe" />
1113
<MsiPackage DisplayInternalUI="no" ForcePerMachine="yes" Visible="no" Id="CloudVeilForWindows" Cache="yes" Compressed="yes" Vital="yes" Name="CloudVeil.msi" SourceFile="..\Installers\SetupProjects\Release\Setup $(var.MsiPlatform).msi" />
1214
</Chain>
15+
1316
</Bundle>
1417
<!-- The following snippet (and the rest of this file) are covered by the following licenses -->
1518
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. -->
@@ -24,6 +27,7 @@
2427
<?define NetFx472WebLink = http://go.microsoft.com/fwlink/?LinkId=863262 ?>
2528
<?define NetFx472RedistLink = http://go.microsoft.com/fwlink/?LinkId=863265 ?>
2629
<?define NetFx472EulaLink = http://referencesource.microsoft.com/license.html ?>
30+
2731
<Fragment>
2832
<PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
2933
<Property Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" Secure="yes" />

CloudVeilInstallerUI/Bundle.wxs

Lines changed: 0 additions & 33 deletions
This file was deleted.

CloudVeilInstallerUI/CloudVeilInstallerUI.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
<None Include="BootstrapperCore.config">
175175
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
176176
</None>
177-
<None Include="Bundle.wxs" />
178177
<None Include="Properties\Settings.settings">
179178
<Generator>SettingsSingleFileGenerator</Generator>
180179
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

CloudVeilInstallerUI/Models/ApplyStatus.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ public class ApplyStatus
1111
public const int FAIL_NOACTION_REBOOT = -2147024546;
1212
public const int FAIL_PIPE_NO_DATA = -2147024664;
1313
public const int FAIL_GENERIC_ERROR = -2147023293;
14+
public const uint FAIL_UNSUPPORTED_ARCH = 0x80070661;
1415
}
1516
}

CloudVeilInstallerUI/ViewModels/InstallerViewModel.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using CloudVeilInstallerUI.Models;
1+
using CloudVeilInstallerUI.IPC;
2+
using CloudVeilInstallerUI.Models;
23
using InstallerCheckPackageCache;
34
using Microsoft.Deployment.WindowsInstaller;
45
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
@@ -10,6 +11,7 @@
1011
using System.IO;
1112
using System.Net;
1213
using System.Runtime.InteropServices;
14+
using System.Runtime.Remoting.Messaging;
1315
using System.Threading.Tasks;
1416
using System.Windows.Threading;
1517
using CVInstallType = CloudVeilInstallerUI.Models.InstallType;
@@ -478,6 +480,14 @@ private void DetectComplete(object sender, DetectCompleteEventArgs e)
478480
return;
479481
}
480482

483+
var msiPlatform = ba.Engine.StringVariables["MsiPlatform"];
484+
485+
if (msiPlatform != null && msiPlatform.ToLower() != RuntimeInformation.OSArchitecture.ToString().ToLower())
486+
{
487+
TriggerFailed($"Failed to {installTypeVerb} CloudVeil for Windows because this type of Windows ({RuntimeInformation.OSArchitecture}) is not supported.");
488+
return;
489+
}
490+
481491
LaunchAction desiredPlan = ba.Command.Action;
482492

483493
switch (ba.Command.Display)
@@ -727,7 +737,16 @@ private void ApplyComplete(object sender, ApplyCompleteEventArgs e)
727737
string message = null;
728738
bool needsRestart = false;
729739

730-
message = $"Failed to {installTypeVerb} CloudVeil for Windows with error code {(uint)e.Status:x}. Please restart your computer and try again. If the issue persists, please contact support.";
740+
741+
uint ustatus = (uint)e.Status;
742+
if (ustatus == ApplyStatus.FAIL_UNSUPPORTED_ARCH)
743+
{
744+
message = $"Failed to {installTypeVerb} CloudVeil for Windows because this type of Windows ({RuntimeInformation.OSArchitecture}) is not supported.";
745+
}
746+
else
747+
{
748+
message = $"Failed to {installTypeVerb} CloudVeil for Windows with error code {(uint)e.Status:x}. Please restart your computer and try again. If the issue persists, please contact support.";
749+
}
731750

732751
if ((installType == CVInstallType.Update || installType == CVInstallType.Uninstall) && failedPackageId == "CloudVeilForWindows")
733752
{

Installers/SetupProjects/Product-arm64.wxs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
1717
<Launch Condition="Installed OR WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" Message="This setup requires the .NET Framework version v4.6.1. Please install the .NET Framework and run this setup again." />
1818
<Launch Condition="Installed OR (VersionNT &gt;= 603) OR (VersionNT64 &gt;= 603)" Message="Required OS is Win10 or higher" />
19+
<Launch Condition="WIX_NATIVE_MACHINE=43690" Message="Required arm64 OS" />
1920
<Icon Id="_D1707FE3B808" SourceFile="..\..\CloudVeilGUI\appicon.ico" />
2021
<Binary Id="B.CustomInstallerActions" SourceFile="..\..\InstallerCustomActions\bin\$(var.Configuration)\InstallerCustomActions.CA.dll" />
2122
<!-- The directory tree of the installation package. -->

Installers/SetupProjects/Product-x64.wxs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<!-- ignore-file:..\..\CloudVeilGUI\bin\Release x64\Warden.exe -->
44
<!-- ignore-file:..\..\CloudVeilGUI\bin\Release x64\Sentinel.exe -->
55
<Package Name="CloudVeil For Windows" Language="1033" Version="2.4.3" Manufacturer="CloudVeil" UpgradeCode="{57058EEC-162C-4D48-993E-4AE6095F66CA}" Codepage="1252" InstallerVersion="405" ShortNames="no" ProductCode="*">
6+
67
<SummaryInformation Description="CloudVeil For Windows Setup" Keywords="internet content filter" Manufacturer="CloudVeil" />
78
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
89
<Property Id="DiskPrompt" Value="CloudVeil For Windows Installation [1]" />
@@ -15,7 +16,8 @@
1516
<!-- The '.NET Framework' launch condition. -->
1617
<PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
1718
<Launch Condition="Installed OR WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" Message="This setup requires the .NET Framework version v4.6.1. Please install the .NET Framework and run this setup again." />
18-
<Launch Condition="Installed OR (VersionNT &gt;= 603) OR (VersionNT64 &gt;= 603)" Message="Required OS is Win10 or higher" />
19+
<Launch Condition="Installed OR (VersionNT64 &gt;= 603)" Message="Required OS is Win10 or higher" />
20+
<Launch Condition="VersionNT64" Message="Required x64 OS" />
1921
<Icon Id="_D1707FE3B808" SourceFile="..\..\CloudVeilGUI\appicon.ico" />
2022
<Binary Id="B.CustomInstallerActions" SourceFile="..\..\InstallerCustomActions\bin\x64\$(var.Configuration)\InstallerCustomActions.CA.dll" />
2123
<!-- The directory tree of the installation package. -->

Installers/SetupProjects/Product-x86.wxs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
1717
<Launch Condition="Installed OR WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" Message="This setup requires the .NET Framework version v4.6.1. Please install the .NET Framework and run this setup again." />
1818
<Launch Condition="Installed OR (VersionNT &gt;= 603) OR (VersionNT64 &gt;= 603)" Message="Required OS is Win10 or higher" />
19+
<Launch Condition="NOT VersionNT64" Message="Required x86 OS" />
1920
<Icon Id="_D1707FE3B808" SourceFile="..\..\CloudVeilGUI\appicon.ico" />
2021
<Binary Id="B.CustomInstallerActions" SourceFile="..\..\InstallerCustomActions\bin\x86\$(var.Configuration)\InstallerCustomActions.CA.dll" />
2122
<!-- The directory tree of the installation package. -->

build-installer.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
Function Find-MsBuild([int] $MaxVersion = 2022)
2-
{
1+
Function Find-MsBuild([int] $MaxVersion = 2026)
2+
{
3+
$communityPath18 = "${Env:programfiles}\Microsoft Visual Studio\18\Community\Msbuild\Current\Bin\MSBuild.exe"
4+
$devPath18 = "${Env:programfiles(x86)}\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
5+
$proPath18 = "${Env:programfiles(x86)}\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin\MSBuild.exe"
36
$communityPath2022 = "${Env:programfiles}\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe"
47
$devPath2022 = "${Env:programfiles(x86)}\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
58
$proPath2022 = "${Env:programfiles(x86)}\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
@@ -15,6 +18,10 @@ Function Find-MsBuild([int] $MaxVersion = 2022)
1518
$fallback2013Path = "${Env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild.exe"
1619
$fallbackPath = "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
1720

21+
If ((2026 -le $MaxVersion) -And (Test-Path $communityPath18)) { return $communityPath18 }
22+
If ((2026 -le $MaxVersion) -And (Test-Path $devPath18)) { return $devPath18 }
23+
If ((2026 -le $MaxVersion) -And (Test-Path $proPath18)) { return $proPath18 }
24+
1825
If ((2022 -le $MaxVersion) -And (Test-Path $communityPath2022)) { return $communityPath2022 }
1926
If ((2022 -le $MaxVersion) -And (Test-Path $devPath2022)) { return $devPath2022 }
2027
If ((2022 -le $MaxVersion) -And (Test-Path $proPath2022)) { return $proPath2022 }

0 commit comments

Comments
 (0)