Skip to content

Commit 2268276

Browse files
committed
chore: add debug information to identify install problems
Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
1 parent 906eae5 commit 2268276

File tree

1 file changed

+79
-7
lines changed

1 file changed

+79
-7
lines changed

.github/workflows/test-ci-windows.yml

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,43 +170,115 @@ jobs:
170170
- name: Install VC++ 2019 Redistributables (Prerequisites)
171171
shell: pwsh
172172
run: |
173-
Write-Host "Installing Visual C++ 2019 Redistributable (x64)..."
173+
Write-Host "=== Checking Pre-Existing VC++ Installations ==="
174+
Get-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" -ErrorAction SilentlyContinue |
175+
Where-Object { $_.DisplayName -like "*Visual C++*" -or $_.DisplayName -like "*Microsoft Visual Studio*Runtime*" } |
176+
Select-Object DisplayName, DisplayVersion, PSChildName |
177+
Format-Table -AutoSize
178+
179+
Write-Host "`n=== Installing Visual C++ 2019 Redistributable (x64) ==="
174180
$vc_x64_url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
175181
$vc_x64_installer = "${{ github.workspace }}\vc_redist.x64.exe"
176182
Invoke-WebRequest -Uri $vc_x64_url -OutFile $vc_x64_installer
177-
Start-Process -FilePath $vc_x64_installer -ArgumentList "/install", "/quiet", "/norestart" -Wait
183+
$x64Process = Start-Process -FilePath $vc_x64_installer -ArgumentList "/install", "/quiet", "/norestart" -Wait -PassThru
184+
Write-Host "VC++ x64 installer exit code: $($x64Process.ExitCode)"
185+
# Exit codes: 0 = success, 1638 = already installed (newer version), 3010 = success (reboot required)
186+
if ($x64Process.ExitCode -notin @(0, 1638, 3010)) {
187+
Write-Error "VC++ x64 installation failed with exit code $($x64Process.ExitCode)"
188+
exit 1
189+
}
178190
179-
Write-Host "Installing Visual C++ 2019 Redistributable (x86)..."
191+
Write-Host "`n=== Installing Visual C++ 2019 Redistributable (x86) ==="
180192
$vc_x86_url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
181193
$vc_x86_installer = "${{ github.workspace }}\vc_redist.x86.exe"
182194
Invoke-WebRequest -Uri $vc_x86_url -OutFile $vc_x86_installer
183-
Start-Process -FilePath $vc_x86_installer -ArgumentList "/install", "/quiet", "/norestart" -Wait
195+
$x86Process = Start-Process -FilePath $vc_x86_installer -ArgumentList "/install", "/quiet", "/norestart" -Wait -PassThru
196+
Write-Host "VC++ x86 installer exit code: $($x86Process.ExitCode)"
197+
# Exit codes: 0 = success, 1638 = already installed (newer version), 3010 = success (reboot required)
198+
if ($x86Process.ExitCode -notin @(0, 1638, 3010)) {
199+
Write-Error "VC++ x86 installation failed with exit code $($x86Process.ExitCode)"
200+
exit 1
201+
}
184202
185203
Write-Host "VC++ 2019 Redistributables installed successfully"
186204
205+
# Verify installations
206+
Write-Host "`nVerifying VC++ installations in registry..."
207+
$vc142x64 = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" -Name "Installed" -ErrorAction SilentlyContinue).Installed
208+
$vc142x86 = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" -Name "Installed" -ErrorAction SilentlyContinue).Installed
209+
Write-Host "VC++ 2019 x64 in registry: $vc142x64"
210+
Write-Host "VC++ 2019 x86 in registry: $vc142x86"
211+
212+
if (-not $vc142x64 -or -not $vc142x86) {
213+
Write-Error "VC++ redistributables not properly registered. x64=$vc142x64, x86=$vc142x86"
214+
exit 1
215+
}
216+
187217
- name: Install MSI
188218
shell: pwsh
189219
run: |
220+
Write-Host "=== Pre-Installation Debug Info ==="
221+
222+
# Check MSI file
190223
$msiPath = "${{ github.workspace }}\modsecurityiis.msi"
191224
if (-not (Test-Path $msiPath)) {
192225
Write-Error "MSI file not found at $msiPath"
193226
exit 1
194227
}
228+
Write-Host "MSI file found: $msiPath"
229+
Write-Host "MSI file size: $((Get-Item $msiPath).Length) bytes"
195230
196-
# Install with logging for debugging
231+
# Check IIS version
232+
$iisVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\InetStp" -Name "MajorVersion" -ErrorAction SilentlyContinue).MajorVersion
233+
Write-Host "IIS Version: $iisVersion"
234+
235+
# Check VC++ redistributables
236+
$vc142x64 = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" -Name "Installed" -ErrorAction SilentlyContinue).Installed
237+
$vc142x86 = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" -Name "Installed" -ErrorAction SilentlyContinue).Installed
238+
Write-Host "VC++ 2019 x64 installed: $vc142x64"
239+
Write-Host "VC++ 2019 x86 installed: $vc142x86"
240+
241+
Write-Host "`n=== Starting MSI Installation ==="
242+
243+
# Install with verbose logging
197244
$installLog = "${{ github.workspace }}\install.log"
198245
$installResult = Start-Process -FilePath "msiexec.exe" -ArgumentList @(
199246
"/i", "`"$msiPath`"",
200247
"/qn",
201248
"/norestart",
202-
"/l*", "`"$installLog`""
249+
"/l*vx", "`"$installLog`""
203250
) -Wait -PassThru
204251
252+
Write-Host "Installation process completed with exit code: $($installResult.ExitCode)"
253+
254+
# Check if log file was created
255+
if (Test-Path $installLog) {
256+
$logSize = (Get-Item $installLog).Length
257+
Write-Host "Install log created: $installLog ($logSize bytes)"
258+
259+
Write-Host "`n=== Installation Log Contents ==="
260+
if ($logSize -gt 0) {
261+
Get-Content $installLog -Raw | Write-Host
262+
} else {
263+
Write-Host "WARNING: Log file is empty!"
264+
}
265+
} else {
266+
Write-Host "WARNING: Install log was not created at $installLog"
267+
}
268+
205269
if ($installResult.ExitCode -ne 0) {
270+
Write-Host "`n=== Installation Failed ==="
271+
Write-Host "Exit code: $($installResult.ExitCode)"
272+
Write-Host "Common MSI error codes:"
273+
Write-Host " 1603 - Fatal error during installation"
274+
Write-Host " 1619 - Package could not be opened"
275+
Write-Host " 1620 - Package could not be opened (corrupt)"
276+
Write-Host " 1633 - Platform not supported"
206277
Write-Error "MSI installation failed with exit code $($installResult.ExitCode)"
207-
Get-Content $installLog | Write-Host
208278
exit 1
209279
}
280+
281+
Write-Host "`n=== Installation Successful ==="
210282
211283
$installDir = "C:\Program Files\ModSecurity IIS"
212284
$requiredFiles = @(

0 commit comments

Comments
 (0)