Talk:GetDllVersion Command Explained

From NSIS Wiki
Jump to navigationJump to search

Here is a macro that does the string-assembly work -- my sense is that most people just want to get to the x.x.x.x format and don't care about the individual dwords. Tell me what you think; if you like it feel free to post it to the main page...

;	GetDllVersionString
;		Uses GetDllVersion to return just the x.x.x.x formatted string.
;
;	Usage:
;		${GetDllVersionString} "someFile.exe" $someReturnVar
 
!define GetDllVersionString "!insertmacro GetDllVersionString"
 
!macro GetDllVersionString FilePathName ReturnString
	GetDllVersion ${FilePathName} $R0 $R1
	IntOp $R2 $R0 / 0x00010000
	IntOp $R3 $R0 & 0x0000FFFF
	IntOp $R4 $R1 / 0x00010000
	IntOp $R5 $R1 & 0x0000FFFF
	StrCpy ${ReturnString} "$R2.$R3.$R4.$R5"
!macroend