Archive: Feature request: compare DLLs version


Feature request: compare DLLs version
The only thing I miss in NSIS is DLL version checking. Currently I have to use following code:

IfFileExists "$SYSDIR\futuris.bpl" CheckVersion CopyDLL
CheckVersion:
GetDLLVersion "$SYSDIR\futuris.bpl" $5 $6
GetDLLVersionLocal "..\runtime\futuris.bpl" $7 $8
IntCmp $5 $7 CheckBuild CopyDLL NoAbort
CheckBuild:
IntCmp $6 $8 NoAbort CopyDLL NoAbort
; copying required DLL
CopyDLL:

But it all can be changed to:

CompareDLLver "$SYSDIR\futuris.bpl" "..\runtime\futuris.bpl" /
CopyDLL SkipCopying


I belive at one time this function was in nsis but i belive justin removed it cause he could get the same functionality out of small functions in the exehead and doing more work in the script. The same reason why the Netscape plugin and some otehr commands where removed cause they could be done by the script.. here is a nice macro that might make it easier for you to update files.. this is gotten out of the functions.htm file in your NSIS Program Dir.


;------------------------------------------------------------------------------
; UpgradeDLL (macro)
;
; Updates a DLL (or executable) based on version resource information.
;
; Input: ${DLL_NAME} = input source file.
; top of stack = full path on system to install file to.
;
; Output: none (removes full path from stack)
;
; Usage:
;
; Push "$SYSDIR\atl.dll"
; !define DLL_NAME atl.dll
; !insertmacro UpgradeDLL
;

!macro UpgradeDLL
Exch $0
Push $1
Push $2
Push $3
Push $4
ClearErrors
GetDLLVersionLocal ${DLL_NAME} $1 $2
GetDLLVersion $0 $3 $4
IfErrors upgrade_${DLL_NAME}
IntCmpU $1 $3 noupgrade_${DLL_NAME} noupgrade_${DLL_NAME} upgrade_${DLL_NAME}
IntCmpU $2 $4 noupgrade_${DLL_NAME} noupgrade_${DLL_NAME}
upgrade_${DLL_NAME}:
UnRegDLL $0
File /oname=$0 ${DLL_NAME}
RegDLL $0
noupgrade_${DLL_NAME}:
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!undef DLL_NAME
!macroend

Is it really required to Unreg a DLL first before registering it again?