wintun/installer/installer.wxs
Simon Rozman 6d6e219080 Reschedule EvaluateWintun between InstallInitialize and InstallFinalize
WireGuard is always doing so-called "minor" upgrade. This makes it
enough to run EvaluateWintun only once - somewhere after CostFinalize.
The component state we bind our driver install/remove logic to will be a
singleton: either be installed,  left alone, or uninstalled. One single
action for install product session and RemoveExistingProducts session.

Other applications using Wintun might use the so-called "major" upgrade.
In this scenario the existing product is completely uninstalled first.
Including Wintun. The EvaluateWintun was called only once and it
determined that Wintun driver should be uninstalled. Since the MSI did
not execute EvaluateWintun again when installing the new product later,
the Wintun remained uninstalled.

In the case of major upgrades, the Wintun requires two separate action
logics: what to do with Wintun on uninstall of the old product, and what
to do with it when new product is installed.

Therefore, EvaluateWintun has been moved between InstallInitialize and
InstallFinalize to have MSI execute it in install and uninstall
sessions.

Reported-by: Dmitry Smirnov <dmitry.smirnov@netprotect.com>
Tested-by: Simon Rozman <simon@rozman.si>
Signed-off-by: Simon Rozman <simon@rozman.si>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-02-29 19:39:11 +08:00

52 lines
2.2 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-License-Identifier: GPL-2.0
Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Module Id="wintun" Language="0" Version="$(var.WINTUN_VERSION)">
<Package
Id="c28309d9-1954-4f2d-a7d1-228850092460"
Description="Wintun Userspace Tunnel"
Manufacturer="WireGuard LLC"
InstallerVersion="200"
InstallPrivileges="elevated"
InstallScope="perMachine"
ReadOnly="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Guid="b668d4c7-abb3-485a-b8df-d34200489a43">
<RegistryValue
Root="HKLM"
Key="SOFTWARE\Wintun"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</Directory>
<Property Id="WintunInstallerHash" Value="$(var.INSTALLER_LIBRARY_HASH)" SuppressModularization="yes" />
<Property Id="WintunInstallerBuildtime" Value="$(var.INSTALLER_LIBRARY_TIME)" SuppressModularization="yes" />
<Property Id="WintunVersion" Value="$(var.WINTUN_VERSION)" SuppressModularization="yes" />
<Binary Id="installer.dll" SourceFile="!(bindpath.output_dir)installer.dll" />
<CustomAction Id="EvaluateWintun" SuppressModularization="yes" BinaryKey="installer.dll" DllEntry="MsiEvaluate" Execute="immediate" />
<CustomAction Id="ProcessWintun" SuppressModularization="yes" BinaryKey="installer.dll" DllEntry="MsiProcess" Execute="deferred" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="EvaluateWintun" Before="ProcessWintun" />
<Custom Action="ProcessWintun" After="InstallFiles" />
</InstallExecuteSequence>
<?if $(var.WINTUN_PLATFORM) = "x86"?>
<CustomAction Id="WoW64Unsupported" Error="You are attempting to install the 32-bit variant of [ProductName] on a 64-bit operating system, which is not supported. Please install the 64-bit variant instead." />
<InstallExecuteSequence>
<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>
</InstallUISequence>
<?endif?>
</Module>
</Wix>