I want to configure it to install only if the dll file version matches a pre-defined file version. How should I write a script?
GetDllVersion "$INSTDIR\MyDLL.dll" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5"
!include LogicLib.nsh
Section
SetOutPath $INSTDIR
GetDllVersion "$INSTDIR\MyDLL.dll" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5"
${If} "$0" == "1.2.3.4"
# ${OrIfNot} ${FileExists} "$INSTDIR\MyDLL.dll" ; Uncomment this if you want to install it if not present
File "myfiles\MyDLL.dll"
${EndIf}
SectionEnd
If you want to get the version you compare with from your own system, you can use GetDLLVersionLocal
.
If you need to compare version ranges, use ${VersionCompare}
in WordFunc.nsh.