Skip to content
⌘ NSIS Forum Archive

GetDllVersionLocal and files from subfolders

5 posts

voyteckst#

GetDllVersionLocal and files from subfolders

I have problems with using GetDllVersionLocal. When trying to do that (in Section) I got error reading file. Probably problem is that file fo which I want to check version is (when building installer) in subfolder. If it is in the same folder as .nsi it is ok.
Is there any way to do that?
pengyou#
It would help if you showed the code that does not work for you.

A quick test program which used this code (based upon the example in the manual)
  GetDllVersionLocal "test\ChromeSetup.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5"
DetailPrint "'test\ChromeSetup.exe' version = $0"

GetDllVersionLocal "..\game\SETUP.EXE" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5"
DetailPrint "'..\game\SETUP.EXE' version = $0"
produced this output
'test\ChromeSetup.exe' version = 1.2.183.13
'..\game\SETUP.EXE' version = 5.10.130.0
voyteckst#
It's following code, where dir is directory from which when building installer app.exe is copied.


SetOverwrite on
IfFileExists "$INSTDIR\app.exe" stex stnoex
stex:
GetDllVersionLocal "dir\app.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5"
${GetFileVersion} "$INSTDIR\app.exe" $1
DetailPrint $0
DetailPrint $1
DetailPrint $version_status
pengyou#
What is the exact error message you are getting?

When I copied your code into my example script it compiled without errors and the resulting program worked OK. Here is the relevant part of the compiler log:
SetOverwrite: on
IfFileExists: "$INSTDIR\app.exe" ? stex : stnoex
GetDLLVersionLocal: dir\app.exe (327690,8519680)->($R0,$R1)
IntOp: $R2=$R0/0x00010000
IntOp: $R3=$R0&0x0000FFFF
IntOp: $R4=$R1/0x00010000
IntOp: $R5=$R1&0x0000FFFF
StrCpy $0 "$R2.$R3.$R4.$R5" () ()
!insertmacro: GetFileVersionCall
!insertmacro: end of GetFileVersionCall
DetailPrint: "$0"
DetailPrint: "$1"
voyteckst#
[SOLVED] GetDllVersionLocal and files from subfolders

Sh...t our developers forgot to put version to this app. That's why I had problem - it was on the first place and I didn't saw it...