Add vstor redist and signature check

This commit is contained in:
Calyx Hikari 2025-07-01 11:21:47 +08:00
parent cabd291242
commit 34551e59f2
4 changed files with 107 additions and 0 deletions

23
dx
View file

@ -104,6 +104,29 @@ function Main {
Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait
}
# --- Check Signature ---
foreach ($item in $downloads) {
$outFile = Join-Path $tempDir $item.Name
Write-Host "Verifying signature of $($item.Name)..."
$signature = Get-AuthenticodeSignature $outFile
if ($signature.SignerCertificate.Subject -like "*CN=Microsoft Corporation*" -and $signature.Status -eq "Valid") {
Write-Host "✅ Valid Microsoft signature found from $($item.Name)."
}
else {
Write-Warning "⚠️ $($item.Name) is not signed by Microsoft. The download may get corrupted or your PC is infected with virus."
$response = Read-Host -Prompt "Would you like to proceed anyway? (Y/N)"
if ($response -eq 'Y' -or $response -eq 'y') {
continue
}
elseif ($response -eq 'N' -or $response -eq 'n') {
return 1
}
else {
Write-Host "Invalid input. Please enter Y or N."
}
}
}
# --- Install DirectX ---
Write-Host "Installing DirectX..."
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait