improved hook dll retry, fails silently now since there's not much the user can do, and we're not planning to change the dll significantly any time soon so it won't matter if it isn't replaced.

This commit is contained in:
Nick Bolton 2012-07-05 22:35:15 +00:00
parent fbc4a89653
commit b921d9c916
1 changed files with 16 additions and 15 deletions

View File

@ -58,31 +58,26 @@ InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${product}" ""
!define ID ${__LINE__} !define ID ${__LINE__}
; some programs hang on to the hook library, wait until they're done. StrCpy $R0 0 ; count
StrCpy $R0 0 StrCpy $R1 20 ; max
retry${ID}: retry${ID}:
${If} ${FileExists} "${dir}\synrgyhk.dll" ${If} ${FileExists} "${dir}\synrgyhk.dll"
IntOp $R0 $R0 + 1 IntOp $R0 $R0 + 1
${If} $R0 < 60 ${If} $R0 <= $R1
; wait for handle on file to be released. why so long? i've noticed ; wait for handle on file to be released. why so long? i've noticed
; that dropbox can take up to a 1-2 mins to let go of it, even with ; that dropbox can take up to a 1-2 mins to let go of it, even with
; a graceful shutdown (plenty of other programs release it, ugh). ; a graceful shutdown (plenty of other programs release it, ugh).
Sleep 2000 DetailPrint "Trying to delete synrgyhk.dll (attempt $R0 of $R1)"
DetailPrint "Trying to delete synrgyhk.dll (attempt $R0)"
Delete "${dir}\synrgyhk.dll" Delete "${dir}\synrgyhk.dll"
Goto retry${ID}
${Else} ${If} ${FileExists} "${dir}\synrgyhk.dll"
messageBox MB_OK \ Sleep 3000
"The file synrgyhk.dll could not be removed, as it is being used by \ Goto retry${ID}
another program. The setup may fail when trying to install the file, \ ${EndIf}
but you can safely retry this when prompted. If the problem persists, \
please restart your computer and re-run the setup."
Goto end${ID}
${EndIf} ${EndIf}
${Else} ${Else}
FileClose $R0 FileClose $R0
${EndIf} ${EndIf}
end${ID}:
!undef ID !undef ID
@ -165,7 +160,13 @@ Section "Server and Client" core
File "${binDir}\Release\synergys.exe" File "${binDir}\Release\synergys.exe"
File "${binDir}\Release\synergyc.exe" File "${binDir}\Release\synergyc.exe"
File "${binDir}\Release\synergyd.exe" File "${binDir}\Release\synergyd.exe"
File "${binDir}\Release\synrgyhk.dll"
; if the hook file exists, assume we couldn't delete
${If} ${FileExists} "synrgyhk.dll"
DetailPrint "Skipping synrgyhk.dll, file in use."
${Else}
File "${binDir}\Release\synrgyhk.dll"
${EndIf}
; install and run the service ; install and run the service
ExecWait "$INSTDIR\synergyd.exe /install" ExecWait "$INSTDIR\synergyd.exe /install"