@echo off REM REM Save the current %LKBIN%\cygwin1.dll to %LKBIN%\cygwin1.dll- REM Copy \cygwin0.dll to %LKBIN%\cygwin1.dll REM REM - Retrieve version from registry. The reg command output will look like this: REM REM HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BD249CE-4648-11D5-B82C-000102474A5A} REM Version REG_DWORD 0x8080000 REM REM so find the line containing "0x" REM cd /d %~dp0 echo Checking LifeKeeper version set LK_UNINSTALL_REG_KEY="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BD249CE-4648-11D5-B82C-000102474A5A}" reg query %LK_UNINSTALL_REG_KEY% /v Version /reg:32 | findstr 0x > ver.txt REM With tokens=2 and delims=x we will get the numeric value after "0x". for /F "tokens=2 usebackq delims=x" %%x in ("ver.txt") do set VER=%%x if "%VER%" == "" ( set ERRMSG=Unable to determine current LifeKeeper version - installation terminating goto Error ) REM Convert hex version to pretty string (ex: 8060003 to 8.6.3) set PRETTYVER=%VER:~0,1%.%VER:~2,1%.%VER:~-1,1% echo Found LifeKeeper version %PRETTYVER% if %VER% LSS 8060000 ( set ERRMSG=LifeKeeper version %PRETTYVER% is less than 8.6.0 - this patch applies to 8.6.0 and later. Install terminating. goto Error ) set PATCHDIR=%~dp0 timeout /t 1 > NUL: 2>&1 echo. echo Updating cygwin DLL. REM pushd saves the current directory on a "stack" and cd's to the path given. To return here, run popd pushd %LKBIN% REM Save the old cygwin1.dll move /Y cygwin1.dll cygwin1.dll-%PRETTYVER% if not %errorlevel%==0 ( set ERRMSG=Failed to move %LKBIN%\cygwin1.dll. Make sure that LifeKeeper is stopped, and that there is no LK GUI running, then retry goto Error ) copy %PATCHDIR%\cygwin0.dll cygwin1.dll if not %errorlevel%==0 ( set ERRMSG=Failed to copy %PATCHDIR%\cygwin0.dll to %LKBIN%\cygwin1.dll. Unexpected failure. copy cygwin1.dll-%PRETTYVER% cygwin1.dll goto Error ) popd echo. echo SUCCESSFUL PATCH INSTALLATION pause exit /b 0 :Error echo. echo %ERRMSG% pause exit /b 1