MSM: Explicitly version driver files

wintun.inf and wintun.cat have no version resource. WiX linker cannot
determine their versions and the MSM will use file sizes and hashes for
update logic. By setting explicit file version and language, the version
will always be used to determine which version is newer on updates.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-04-17 13:25:55 +02:00
parent 361dd60a04
commit bfa3b3f6cc
2 changed files with 22 additions and 11 deletions

View File

@ -8,7 +8,7 @@
WINTUN_VERSION_MAJ=0
WINTUN_VERSION_MIN=0
WINTUN_VERSION_REV=2019
WINTUN_VERSION_BUILD=0128
WINTUN_VERSION_BUILD=128
!IFNDEF CFG
CFG=Release
@ -33,12 +33,8 @@ PLAT_WIX=arm64 # TODO: Follow WiX ARM64 support.
!ENDIF
OUTPUT_DIR=$(PLAT)\$(CFG)
MSBUILD_FLAGS=/p:Configuration="$(CFG)" /p:Platform="$(PLAT_MSBUILD)" /m /v:minimal /nologo
WIX_CANDLE_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -arch "$(PLAT_WIX)" \
-dWINTUN_VERSION_MAJ="$(WINTUN_VERSION_MAJ)" \
-dWINTUN_VERSION_MIN="$(WINTUN_VERSION_MIN)" \
-dWINTUN_VERSION_REV="$(WINTUN_VERSION_REV)" \
-dWINTUN_VERSION_BUILD="$(WINTUN_VERSION_BUILD)"
WIX_LIGHT_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -b output_dir="$(OUTPUT_DIR)"
WIX_CANDLE_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -arch "$(PLAT_WIX)" -dWINTUN_VERSION="$(WINTUN_VERSION_MAJ).$(WINTUN_VERSION_MIN).$(WINTUN_VERSION_REV).$(WINTUN_VERSION_BUILD)"
WIX_LIGHT_FLAGS=-nologo -ext WixDifxAppExtension -ext WixIIsExtension -b output_dir="$(OUTPUT_DIR)" -sw1103
build ::
msbuild.exe "wintun.vcxproj" /t:Build $(MSBUILD_FLAGS)

View File

@ -8,7 +8,7 @@
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_MAJ).$(var.WINTUN_VERSION_MIN).$(var.WINTUN_VERSION_REV).$(var.WINTUN_VERSION_BUILD)">
<Module Id="wintun" Language="0" Version="$(var.WINTUN_VERSION)">
<Package
Id="c28309d9-1954-4f2d-a7d1-228850092460"
Description="Wintun Userspace Tunnel"
@ -23,7 +23,12 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MergeRedirectFolder">
<Component Id="wintun.cat" Guid="41fbe711-a1af-4b83-8b5d-fc1b112969c1">
<File Id="wintun.cat" Name="wintun.cat" Source="!(bindpath.output_dir)wintun\wintun.cat"/>
<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"
@ -36,10 +41,20 @@
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"/>
<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" Guid="d0fde4a4-d228-4803-b57e-76bd8b16cf42">
<File Id="wintun.sys" Name="wintun.sys" Source="!(bindpath.output_dir)wintun\wintun.sys"/>
<File
Id="wintun.sys"
Name="wintun.sys"
Source="!(bindpath.output_dir)wintun\wintun.sys"
DefaultVersion="$(var.WINTUN_VERSION)"
DefaultLanguage="0"/>
</Component>
</Directory>
</Directory>