From ca9f629427e42133918f9a233ddb744fea1f90f0 Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Fri, 19 Oct 2018 10:32:17 +0900 Subject: [PATCH] Add an option to reinstall the driver. --- winbuild/regress.ps1 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/winbuild/regress.ps1 b/winbuild/regress.ps1 index d9d5360..63799dc 100644 --- a/winbuild/regress.ps1 +++ b/winbuild/regress.ps1 @@ -32,6 +32,8 @@ Specify the configuration xml file name if you want to use the configuration file other than standard one. The relative path is relative to the current directory. +.PARAMETER ReinstallDriver + Reinstall the driver in any case. .EXAMPLE > .\regress Build with default or automatically selected parameters @@ -75,7 +77,8 @@ Param( [string]$BuildConfigPath, [ValidateSet("off", "on", "both")] [string]$DeclareFetch="on", -[string]$SpecificDsn +[string]$SpecificDsn, +[switch]$ReinstallDriver ) @@ -267,6 +270,7 @@ function SpecialDsn($testdsn, $testdriver) return "SERVER=${server}|DATABASE=${database}|PORT=${port}|UID=${uid}|PWD=${passwd}" } + $reinst = $ReinstallDriver $regProgram = "./RegisterRegdsn.exe" & $regProgram "check_dsn" $testdsn switch ($LastExitCode) { @@ -280,14 +284,20 @@ function SpecialDsn($testdsn, $testdriver) } } -2 { - Write-Host "`tReinstalling Driver=$testdriver" - $proc = Start-Process $regProgram -Verb runas -Wait -PassThru -ArgumentList "reinstall_driver $testdriver `"$dlldir`" Driver=${dllname}|Setup=${setup}" + $reinst = $true + <# Write-Host "`tReinstalling Driver=$testdriver" + $proc = Start-Process $regProgram -Verb runas -Wait -PassThru -ArgumentList "reinstall_driver $testdriver `"$dlldir`" Driver=${dllname}|Setup=${setup}" #> } 0 {} default { throw "$regProgram error" } } + if ($reinst) { + Write-Host "`tReinstalling Driver=$testdriver" + $proc = Start-Process $regProgram -Verb runas -Wait -PassThru -ArgumentList "reinstall_driver $testdriver `"$dlldir`" Driver=${dllname}|Setup=${setup}" + + } } $scriptPath = (Split-Path $MyInvocation.MyCommand.Path) -- 2.39.5