Archive: How d'ya get the exact minor ver of Winamp?


How d'ya get the exact minor ver of Winamp?
I want to verify that a user has installed a specific version of Winamp. Namely, the latest 2.x version, 2.81.

The code below, which uses GetDLLVersion, returns "2.8.0.0"
The Winamp.exe file it was run on IS the desired version (2.81).
What can I use to get the exact minor version?
I can see the string "2.81" within the .exe file, but how do I retrieve it with NSIS?


;-----------------
Function GetDLLVer
;-----------------
; Returns DLL version of specified .exe file (e.g. Winamp.exe)
; Adapted from:
; http://www.clantpa.co.uk/nsis/wiki/i...mmandExplained
; Inputs: Stack 0 = Full pathname of .exe file
; Output: Stack 0 = string of form "1.2.0.192" (major.minor.release.build)
; Usage:
; Push $0 ; (where $0 contains pathname of .exe file)
; Call GetDLLVer
; Pop $0 ; (now contains version string)

Exch $0 ; $0 now has pathname of .exe file
Push $R0
Push $R1
Push $1
Push $2
Push $3
Push $4

GetDllVersion "$0" $R0 $R1
IntOp $1 $R0 / 0x00010000 ; $1 now = major version
IntOp $2 $R0 & 0x0000FFFF ; $2 now = minor version
IntOp $3 $R1 / 0x00010000 ; $3 now = release
IntOp $4 $R1 & 0x0000FFFF ; $4 now = build
StrCpy $0 "$1.$2.$3.$4" ; $0 now = string of form "1.2.0.192"

Pop $4
Pop $3
Pop $2
Pop $1
Pop $R1
Pop $R0
Exch $0 ; result is now in stack 0
FunctionEnd ; (GetDLLVer) =============

Answer?
Ok. So maybe I can answer my own question here. I now think the function posted above IS returning the correct information, it's just that the .exe file contains the "wrong" values. I think Nullsoft forgot to update the minor version number when compiling 2.81 and left it as 2.80. If anyone knows better, please say so, but I infer this from having examined the property sheet of the .exe file.

If I was really fussy about it, I suppose there are "dirtier" ways to tell the difference between the two versions. One way that suggests itself is reading the .exe file, seeking to the offset where the string "Winamp 2.81" appears (as part of the credits) and retrieving the relevant bytes. It may not be worth the effort though. If anyone knows a simpler way, all suggestions are welcome.

(BTW, a correction to the above function. Not the code itself, just the commenting. Of course it doesn't just apply to an .EXE but also to .DLL files -- Duhhhh!)


I second that, Winamp 2.81 is versioned 2.80 :D

You can read the whatsnew.txt file, it contains the right version. Not the best way around, but it works ;)


manage the getdllversion..
Hey !!!

Montel !!!

I read you code about detect the version of a exe or dll.

But do yoy know the code, for example, if the version is lower then 6.0.0.0, prompt a messagebox telling the user that needs and update for that file...

Thanks


Sorry is Mottel :)


That's v-tal's code. The best way to do what you ask is get the number represnting 6.0.0.0 and compare it with what you get from GetDLLVersion. You can get this number from an existing DLL with this version or create it yourself according to the explanation in that link above. If you don't want to find out what it is you can always use this code and just compare $1 to 6 using IntCmp.

And please edit your message next time if there just one little thing you want to change/add right after you wrote it (like this addition).