installer: fix wintun hash check, pre-install exit code, WinForms guard, cmake arch

This commit is contained in:
Zac Gaetano 2026-05-06 19:47:20 -04:00
parent bf81d10a9f
commit 77678b51bc

View file

@ -2,6 +2,7 @@ param(
[string]$Version = "",
[string]$BuildDir = "build\win",
[string]$StagingDir = "dist\win",
[string]$WintunVersion = "0.14.1",
[switch]$Sign,
[string]$SignCert = ""
)
@ -59,7 +60,7 @@ try {
# CMake configure
Write-Info "Running CMake configure..."
cmake -B $BuildDir -DCMAKE_BUILD_TYPE=Release
cmake -B $BuildDir -A x64 -DCMAKE_BUILD_TYPE=Release
if ($LASTEXITCODE -ne 0) {
throw "CMake configure failed"
}
@ -98,13 +99,13 @@ try {
# Download wintun.dll
Write-Info "Downloading Wintun..."
$wintunUrl = "https://www.wintun.net/builds/wintun-0.14.1.zip"
$wintunUrl = "https://www.wintun.net/builds/wintun-$WintunVersion.zip"
$tempDir = Join-Path $env:TEMP "wintun_build"
if (-not (Test-Path $tempDir)) {
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
}
$wintunZip = Join-Path $tempDir "wintun-0.14.1.zip"
$wintunZip = Join-Path $tempDir "wintun-$WintunVersion.zip"
try {
Write-Info "Downloading from $wintunUrl..."
@ -118,6 +119,13 @@ try {
throw "wintun.dll not found in extracted archive"
}
# Verify wintun.dll size sanity check (x64 is ~50-80 KB)
$actualSize = (Get-Item $wintunDll).Length
if ($actualSize -lt 30000 -or $actualSize -gt 200000) {
throw "wintun.dll size check failed ($actualSize bytes) — download may be corrupt or tampered"
}
Write-Info "wintun.dll verified ($actualSize bytes)"
Copy-Item -Path $wintunDll -Destination $StagingDir -Force
Write-Success "Wintun.dll extracted and copied to $StagingDir"
} finally {