Archive: Problems installing DLL files


I have an application that needs certain dll files and I can't get NSIS to check if the DLL already exists on the client computer, ifexists then check the dll version, and copy it to the $SYSDIR. Here's what I had for the code:

IfFileExists "$SYSDIR\iphlpapi.dll" lbl_compare1 lbl_update1 lbl_compare1:
CompareDLLVersions "$SYSDIR\iphlpapi.dll" "F:\my documents\app\iphlpapi.dll" Next1 lbl_update1
lbl_update1:
SetOutPath $SYSDIR
File "F:\my documents\app\iphlpapi.dll"
RegDLL "F:\my documents\app\iphlpapi.dll"
Next1:
;DetailPrint "......iphlpapi.dll is up to date"

It doesn't copy the files if it doesn't exists and doesn't seem to check version correctly, but AFAIK the code is correct. Can anyone help?


This seems to work for me:

IfFileExists $SYSDIR\Mscomctl.ocx next1 inst1
next1:
CompareDLLVersions /STOREFROM prgfiles\Mscomctl.ocx $SYSDIR\Mscomctl.ocx inst1 skip1
goto skip1
inst1:
File prgfiles\Mscomctl.ocx
skip1:
nop

Maybe you must use the switch /STOREFROM ?
From documentation:

The /STOREFROM switch tells the compiler that dll1 is a file on the build system, at which the compiler will look to get the version information (if /STOREFROM is not specified, dll1 is a path on the target installing system).
Note: this command uses the win32 version resource to do its comparison - if either file lacks a version resource, the function will fail (no goto, error flag set).

/arune