GetDllVersion Command Explained: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
No edit summary |
||
Line 10: | Line 10: | ||
<highlight-nsis> | <highlight-nsis> | ||
GetDLLVersion "MyApp.exe" $R0 $R1 | GetDLLVersion "MyApp.exe" $R0 $R1 | ||
IntOp $R2 $R0 | IntOp $R2 $R0 >> 16 | ||
IntOp $R2 $R2 & 0x0000FFFF ; $R2 now contains major version | |||
IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version | IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version | ||
IntOp $R4 $R1 | IntOp $R4 $R1 >> 16 | ||
IntOp $R4 $R4 & 0x0000FFFF ; $R4 now contains release | |||
IntOp $R5 $R1 & 0x0000FFFF ; $R5 now contains build | IntOp $R5 $R1 & 0x0000FFFF ; $R5 now contains build | ||
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" |
Revision as of 17:44, 26 June 2007
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 >> 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"