diff --git a/packages/npcap.vm/npcap.vm.nuspec b/packages/npcap.vm/npcap.vm.nuspec index df978aab..abad1b2c 100644 --- a/packages/npcap.vm/npcap.vm.nuspec +++ b/packages/npcap.vm/npcap.vm.nuspec @@ -2,7 +2,7 @@ npcap.vm - 1.80 + 1.80.20241216 Nmap Project Npcap is an architecture for packet capture and network analysis for Windows operating systems, consisting of a software library and a network driver. diff --git a/packages/npcap.vm/tools/chocolateyinstall.ps1 b/packages/npcap.vm/tools/chocolateyinstall.ps1 index 7dc1d043..c9259339 100644 --- a/packages/npcap.vm/tools/chocolateyinstall.ps1 +++ b/packages/npcap.vm/tools/chocolateyinstall.ps1 @@ -17,8 +17,11 @@ try { VM-Assert-Path $packageArgs.fileFullPath $ahkInstaller = Join-Path $(Split-Path $MyInvocation.MyCommand.Definition) "install.ahk" -Resolve - $rc = (Start-Process -FilePath $ahkInstaller -ArgumentList $packageArgs.fileFullPath -PassThru -Wait).ExitCode - if ($rc -eq 1) { + $process = Start-Process -FilePath $ahkInstaller -ArgumentList $packageArgs.fileFullPath -PassThru + # Wait for the AutoHotKey script to finish. We need a max time as if something goes wrong + # (for example the installation takes longer than exception), it will never finish. + $process.WaitForExit(60000) + if ($process.ExitCode -eq 1) { throw "AutoHotKey returned a failure exit code ($rc) for: ${Env:ChocolateyPackageName}" } else { VM-Assert-Path $(Join-Path ${Env:PROGRAMFILES} "Npcap\npcap.cat") diff --git a/packages/npcap.vm/tools/install.ahk b/packages/npcap.vm/tools/install.ahk index 54939be5..3f4aeb5a 100644 --- a/packages/npcap.vm/tools/install.ahk +++ b/packages/npcap.vm/tools/install.ahk @@ -13,7 +13,7 @@ WinWait, %installerTitle%,,20 WinActivate exitCode := 1 -loop, 20 +loop, 50 { if WinExist(installerTitle, "i).*license agreement.*") { @@ -27,7 +27,7 @@ loop, 20 } if WinExist(installerTitle, "i).*installing.*") { - Sleep, 5000 + Sleep, 10000 } if WinExist(installerTitle, "i).*installation complete.*") { @@ -51,6 +51,6 @@ loop, 20 exitCode := 0 break } - Sleep 1000 + Sleep, 1000 } -ExitApp %exitCode% \ No newline at end of file +ExitApp %exitCode%