Archive: GetDLLVersion returning a negative release version


GetDLLVersion returning a negative release version
I'm getting back a negative release value after using GetDLLVersion.


ReadRegStr $0 HKLM Software\Microsoft\.NETFramework InstallRoot
StrCpy $0 "$0\v2.0.50727\System.dll"
GetDllVersion "$0" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
MessageBox MB_OK "$R0 $R1 $R2 $R3 $R4 $R5"
IntCmpU $R4 50727 +3
MessageBox MB_OK "Not equal"
Goto +2
MessageBox MB_OK "It's equal!"


The actual version for System.dll is 2.0.50727.42.

After the call to GetDLLVersion,

$R0 = 131072
$R1 = -970522582
$R2 = 2
$R3 = 0
$R4 = -14808
$R5 = 42


Notice that $R4 is negative.

Curiously enough, -14808 is the difference between 2^16-1 (65535) and 50727.

As a sanity test, I included the IntCmpU check. Following that, the "Not equal" messagebox is displayed.

stupid nsis sign extension, try

intop $R4 $R1 >> 16
intop $R4 $R4 & 0xFFFF


Oh I get it. Perfect.

Thanks Anders.