Archive: Installing DLLs to the system directory


is it possible to extract DLL files to the system directory, but only if they don't already exist?


Originally posted by soup-a-stu
is it possible to extract DLL files to the system directory, but only if they don't already exist?

1) IfFileExists $SYSDIR\target.dll CheckVer InstNewVer
2) CheckVer:
CompareDLLVersions source.dll $SYSDIR\target.dll InstNewVer SkipInst
3) InstNewVer:
SetOverwrite try
SetOutPath $SYSDIR
File source.dll
4) SkipInst:


1) if target.dll existed? goto CheckVer, else goto InstNewVer.
2) Compare DLL Version.
3) Install new version.
4) exit.

My trick... :)


That actually won't work, because CompareDLLVersions compares two DLLs on the _target_ system.

What you have to do is this:


; will update $SYSDIR\target.dll with my_updated_target.dll
SetOutPath $TEMP
File my_updated_target.dll
IfFileExists $SYSDIR\target.dll CheckVer InstNewVer
CheckVer:
CompareDLLVersions $TEMP\my_updated_target.dll $SYSDIR\target.dll InstNewVer
Goto SkipInst
InstNewVer:
Rename /REBOOTOK $TEMP\my_updated_target.dll $SYSDIR\target.dll
Goto End
SkipInst:
Delete $TEMP\my_updated_target.dll
End: