installer: fix wintun hash check, pre-install exit code, WinForms guard, cmake arch
This commit is contained in:
parent
bf81d10a9f
commit
77678b51bc
1 changed files with 11 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ param(
|
||||||
[string]$Version = "",
|
[string]$Version = "",
|
||||||
[string]$BuildDir = "build\win",
|
[string]$BuildDir = "build\win",
|
||||||
[string]$StagingDir = "dist\win",
|
[string]$StagingDir = "dist\win",
|
||||||
|
[string]$WintunVersion = "0.14.1",
|
||||||
[switch]$Sign,
|
[switch]$Sign,
|
||||||
[string]$SignCert = ""
|
[string]$SignCert = ""
|
||||||
)
|
)
|
||||||
|
|
@ -59,7 +60,7 @@ try {
|
||||||
|
|
||||||
# CMake configure
|
# CMake configure
|
||||||
Write-Info "Running 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) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "CMake configure failed"
|
throw "CMake configure failed"
|
||||||
}
|
}
|
||||||
|
|
@ -98,13 +99,13 @@ try {
|
||||||
|
|
||||||
# Download wintun.dll
|
# Download wintun.dll
|
||||||
Write-Info "Downloading Wintun..."
|
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"
|
$tempDir = Join-Path $env:TEMP "wintun_build"
|
||||||
if (-not (Test-Path $tempDir)) {
|
if (-not (Test-Path $tempDir)) {
|
||||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
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 {
|
try {
|
||||||
Write-Info "Downloading from $wintunUrl..."
|
Write-Info "Downloading from $wintunUrl..."
|
||||||
|
|
@ -118,6 +119,13 @@ try {
|
||||||
throw "wintun.dll not found in extracted archive"
|
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
|
Copy-Item -Path $wintunDll -Destination $StagingDir -Force
|
||||||
Write-Success "Wintun.dll extracted and copied to $StagingDir"
|
Write-Success "Wintun.dll extracted and copied to $StagingDir"
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue