Commit Graph

15 Commits

Author SHA1 Message Date
Simon Rozman
b79703bba8 vcxproj: swap configuration and platform subfolder hierarchy
This should allow wintun.dll to simplify referencing same configuration
but different platform wintun.dll for WoW64 support.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00
Simon Rozman
5925f914e4 api: add support for WoW64
Some functions of SetupAPI only work when invoked from a native process.
Registry and filesystem reflection makes them fail on WoW64. For WoW64
processes, a minimum set of rundll32 functions are provided.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:59 +01:00
Simon Rozman
0ef8578c81 api: add skeleton for wintun.dll
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
Simon Rozman
00efaa79fa installer: ignore light.exe internal error
Wix Toolset introduced an issue beginning with the v3.14.0.3827 release.
When linking merge module, the light.exe displays an internal error:

```
WixLink:
  "C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe"  -nologo -b o
  utput_dir="..\amd64\Release" -spdb -sw1076 -sw1079 -out "..\dist\wintu
  n-amd64-0.8.msm" "..\amd64\Release\installer-intermediate\installer.wi
  xobj"
light.exe : error LGHT0204: ICEM10: The property 'ProductCode' is not al
lowed in a Merge Module [C:\Users\Simon\Projekti\wintun\installer\instal
ler.vcxproj]
C:\Users\Simon\AppData\Local\Temp\xdyw3dnt\wintun-amd64-0.8.msm : error
LGHT0204: ICE03: Table: Component Column: _IceM05Mark Missing specificat
ions in _Validation Table (or Old Database) [C:\Users\Simon\Projekti\win
tun\installer\installer.vcxproj]
C:\Users\Simon\AppData\Local\Temp\xdyw3dnt\wintun-amd64-0.8.msm : error
LGHT0204: ICE03: Table: File Column: _ICEM07CAB Missing specifications i
n _Validation Table (or Old Database) [C:\Users\Simon\Projekti\wintun\in
staller\installer.vcxproj]
light.exe : error LGHT0217: Error executing ICE action 'ICE103'. The mos
t common cause of this kind of ICE failure is an incorrectly registered
scripting engine. See http://wixtoolset.org/documentation/error217/ for
details and how to solve this problem. The following string format was n
ot expected by the external UI message logger: "There is a problem with
this Windows Installer package. A DLL required for this install to compl
ete could not be run. Contact your support personnel or package vendor.
 ". [C:\Users\Simon\Projekti\wintun\installer\installer.vcxproj]
  The command ""C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe"
   -nologo -b output_dir="..\amd64\Release" -spdb -sw1076 -sw1079 -out "
  ..\dist\wintun-amd64-0.8.msm" "..\amd64\Release\installer-intermediate
  \installer.wixobj"" exited with code 217.
```

This error is not a direct consequence of anything being wrong in our
source code. Fortunately, the utility still produces identical MSM file
as previous WiX Toolset versions do. Unfortunately, it exits with code
217.

However, we need recent v3.14 for ARM64 support.

I know this is a huge issue for our build system, masking out any other
potential true error, but the light.exe exit code has been temporarily
ignored.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
Simon Rozman
bca23da5bf installer: ARM64 requires msiexec version >=500
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
Simon Rozman
6a65b11231 installer: ARM64 is always Windows 10
ARM64 support was introduced in Windows 10. There is no need to pack the
EV signed ARM64 driver for older Windows releases.

The only use-case we do want to pack an EV signed ARM64 driver (or test
signed) in the installer.dll is when we are doing the rundll32.exe
tests. Therefore, the Debug version still packs it.

If there is no driver available to pack, fail at compile time - rather
than build an installer.dll that would fail at runtime.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:50:58 +01:00
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
Jason A. Donenfeld
53332cd078 installer: improve resource freeing flow
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-04 08:52:58 +00:00
Simon Rozman
af580a57af Stop timestamping test-signed binaries
WDK doesn't timestamp test-signed drivers. Neither should we.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-09-02 10:10:03 +02:00
Simon Rozman
fa715c4863 Use WiX directly rather than via WiX's MSBuild
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-05 17:14:27 +02:00
Jason A. Donenfeld
03f356c492 Dynamically gather signtool full path
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-05 14:08:06 +02:00
Simon Rozman
810d2ac73a Unify XML empty-element spacing
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-08-05 09:45:52 +02:00
Jason A. Donenfeld
bc22e2dd25 GetCurrentProcessToken() is Win8+, so open our own token
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-03 08:46:21 +00:00
Jason A. Donenfeld
fb68232f16 Free interface list when aborting in installer
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02 13:24:21 +02:00
Jason A. Donenfeld
22e2da002d Rewrite installer logic in C
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-08-02 09:43:32 +00:00