GetDllVersion Command Explained: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(→Description: Added struct link) |
||
Line 4: | Line 4: | ||
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 :- | 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. | 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. These numbers are extracted from the [https://docs.microsoft.com/en-us/windows/win32/api/VerRsrc/ns-verrsrc-vs_fixedfileinfo VS_FIXEDFILEINFO header] in the version resource. | ||
== Example == | == Example == |
Revision as of 23:53, 20 November 2021
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. These numbers are extracted from the VS_FIXEDFILEINFO header in the version resource.
Example
So, try something like this:
GetDLLVersion "MyApp.exe" $R0 $R1 IntOp $R2 $R0 >> 16 IntOp $R2 $R2 & 0x0000FFFF ; $R2 now contains major version IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version IntOp $R4 $R1 >> 16 IntOp $R4 $R4 & 0x0000FFFF ; $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"