aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.wxs
blob: db57721053b8c174cf70235397685caa95bfe4b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8"?>
<!--
	SPDX-License-Identifier: GPL-2.0

	Copyright (C) 2018-2019 WireGuard LLC. All Rights Reserved.
-->
<?if $(var.Platform) = "x86"?>
	<?define PlatformProgramFilesFolder = "ProgramFilesFolder"?>
<?else?>
	<?define PlatformProgramFilesFolder = "ProgramFiles64Folder"?>
<?endif?>
<Wix
	xmlns="http://schemas.microsoft.com/wix/2006/wi"
	xmlns:diffx="http://schemas.microsoft.com/wix/DifxAppExtension"
	xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
	<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"/>

		<Binary Id="wintun.cer" SourceFile="!(bindpath.output_dir)wintun.cer"/>

		<Property Id="WINDOWS10_VER_MAJ">
			<RegistrySearch Id="Windows10VersionMaj" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="CurrentMajorVersionNumber" Type="raw"/>
		</Property>

		<Directory Id="TARGETDIR" Name="SourceDir">
			<Directory Id="WintunFolder">
				<Component Id="wintun.cat.whql" Guid="2f17bc6d-0006-47c4-8ba3-f055d1852558">
					<Condition><![CDATA[WINDOWS10_VER_MAJ]]></Condition>
					<File
						Id="wintun.cat.whql"
						Name="wintun.cat"
						Source="!(bindpath.whwl_dir)wintun.cat"
						DefaultVersion="$(var.WINTUN_VERSION)"
						DefaultLanguage="0"/>
					<diffx:Driver
						AddRemovePrograms="no"
						PlugAndPlayPrompt="no"/>
				</Component>
				<Component Id="wintun.cat" Guid="41fbe711-a1af-4b83-8b5d-fc1b112969c1">
					<Condition><![CDATA[NOT WINDOWS10_VER_MAJ]]></Condition>
					<File
						Id="wintun.cat"
						Name="wintun.cat"
						Source="!(bindpath.output_dir)wintun\wintun.cat"
						DefaultVersion="$(var.WINTUN_VERSION)"
						DefaultLanguage="0"/>
					<iis:Certificate
						Id="wintun.cer"
						Name="WireGuard LLC"
						StoreLocation="localMachine"
						StoreName="trustedPublisher"
						BinaryKey="wintun.cer"
						Request="no"/>
					<diffx:Driver
						AddRemovePrograms="no"
						PlugAndPlayPrompt="no"/>
				</Component>

				<Component Id="wintun.inf" Guid="c58122b3-c7ba-4207-b68d-a236e371f9ed">
					<File
						Id="wintun.inf"
						Name="wintun.inf"
						Source="!(bindpath.output_dir)wintun\wintun.inf"
						DefaultVersion="$(var.WINTUN_VERSION)"
						DefaultLanguage="0"/>
				</Component>

				<Component Id="wintun.sys.whql" Guid="039baa6d-b16b-4dc2-8b86-8bb500f78de0">
					<Condition><![CDATA[WINDOWS10_VER_MAJ]]></Condition>
					<File
						Id="wintun.sys.whql"
						Name="wintun.sys"
						Source="!(bindpath.whwl_dir)wintun.sys"
						DefaultVersion="$(var.WINTUN_VERSION)"
						DefaultLanguage="0"/>
				</Component>
				<Component Id="wintun.sys" Guid="d0fde4a4-d228-4803-b57e-76bd8b16cf42">
					<Condition><![CDATA[NOT WINDOWS10_VER_MAJ]]></Condition>
					<File
						Id="wintun.sys"
						Name="wintun.sys"
						Source="!(bindpath.output_dir)wintun\wintun.sys"
						DefaultVersion="$(var.WINTUN_VERSION)"
						DefaultLanguage="0"/>
				</Component>
			</Directory>
		</Directory>

		<!--
			The WintunFolder is relocated inside product folder when our module is merged.
			To avoid this, set WintunFolder property to [ProgramFilesFolder]\Wintun explicitly
			in each installer sequence.
		-->
		<Property Id="$(var.PlatformProgramFilesFolder)" SuppressModularization="yes"/><!-- This will produce CNDL1006 and CNDL1086 warnings, but it prevents "[ProgramFiles(64)Folder]" from being modularized to "[ProgramFiles(64)Folder.C28309D9_1954_4F2D_A7D1_228850092460]". -->
		<CustomAction Id="WintunFolder" Property="WintunFolder" Value="[$(var.PlatformProgramFilesFolder)]\Wintun"/>
		<AdminExecuteSequence>
			<Custom Action="WintunFolder" Before="CostInitialize"/>
		</AdminExecuteSequence>
		<AdminUISequence>
			<Custom Action="WintunFolder" Before="CostInitialize"/>
		</AdminUISequence>
		<AdvertiseExecuteSequence>
			<Custom Action="WintunFolder" Before="CostInitialize"/>
		</AdvertiseExecuteSequence>
		<InstallExecuteSequence>
			<Custom Action="WintunFolder" Before="CostInitialize"/>
		</InstallExecuteSequence>
		<InstallUISequence>
			<Custom Action="WintunFolder" Before="CostInitialize"/>
		</InstallUISequence>

		<!--
			Prevent WoW64 installations.
		-->
		<?if $(var.Platform) = "x86"?>
			<CustomAction Id="WoW64Unsupported" Error="You are attempting to install the 32-bit variant of [ProductName] on a 64-bit operating system. 32-bit variant will not work with your operating system. The installation of the 64-bit variant is recommended."/>
			<InstallExecuteSequence>
				<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>
			</InstallExecuteSequence>
			<InstallUISequence>
				<Custom Action="WoW64Unsupported" After="LaunchConditions"><![CDATA[VersionNT64]]></Custom>
			</InstallUISequence>
		<?endif?>
	</Module>
</Wix>