GetDllVersion Command Explained: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
m (Added category links.)
Line 18: Line 18:
StrCpy $0 "$R2.$R3.$R4.$R5" ; $0 now contains string like "1.2.0.192"
StrCpy $0 "$R2.$R3.$R4.$R5" ; $0 now contains string like "1.2.0.192"
</highlight-nsis>
</highlight-nsis>
[[{{ns:14}}:Tutorials]]

Revision as of 20:44, 30 April 2005

Author: sunjammer (talk, contrib)


Description

GetDllVersion is a tricky command to get used to. It's one of the built-in commands in NSIS, I'm not sure what version it was introduced in (email me if you know). There is a download link at the bottom to a text file containing this example. v-tal's explanation went like this :-

About numbers GetDllVersion. First 16 bit of first number is major version. Second 16 bit of first number is minor version. First 16 bit of second number is release version. Second 16 bit of second number is build version.

Example

So, try something like this:

GetDLLVersion "MyApp.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000 ; $R2 now contains major version
IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version
IntOp $R4 $R1 / 0x00010000 ; $R4 now contains release
IntOp $R5 $R1 & 0x0000FFFF ; $R5 now contains build
StrCpy $0 "$R2.$R3.$R4.$R5" ; $0 now contains string like "1.2.0.192"