diff options
author | Gerald Combs <gerald@wireshark.org> | 2007-11-06 20:32:30 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2007-11-06 20:32:30 +0000 |
commit | 6e207e3f34c40277bb73acd135c87f7f18f2f30f (patch) | |
tree | 88031d9a44da0baf3d49d84e3741b894154e181a /packaging/nsis/VersionCompare.nsh | |
parent | e0937a59921ad7332d0751b7f4b1dc7e75aa8ac3 (diff) |
When checking to see if we should install WinPcap, check the installed
version directly instead of trying to divine it from its name.
svn path=/trunk/; revision=23385
Diffstat (limited to 'packaging/nsis/VersionCompare.nsh')
-rw-r--r-- | packaging/nsis/VersionCompare.nsh | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/packaging/nsis/VersionCompare.nsh b/packaging/nsis/VersionCompare.nsh new file mode 100644 index 0000000000..d2cfe75b8b --- /dev/null +++ b/packaging/nsis/VersionCompare.nsh @@ -0,0 +1,91 @@ +; +; VersionCompare - Compare Windows version numbers +; +; Copied from http://nsis.sourceforge.net/VersionCompare +; +; By Instructor (http://nsis.sourceforge.net/User:Instructor) + +Function VersionCompare + !define VersionCompare `!insertmacro VersionCompareCall` + + !macro VersionCompareCall _VER1 _VER2 _RESULT + Push `${_VER1}` + Push `${_VER2}` + Call VersionCompare + Pop ${_RESULT} + !macroend + + Exch $1 + Exch + Exch $0 + Exch + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + Push $7 + + begin: + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $0 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $4 $0 $2 + IntOp $2 $2 + 1 + StrCpy $0 $0 '' $2 + + StrCpy $2 -1 + IntOp $2 $2 + 1 + StrCpy $3 $1 1 $2 + StrCmp $3 '' +2 + StrCmp $3 '.' 0 -3 + StrCpy $5 $1 $2 + IntOp $2 $2 + 1 + StrCpy $1 $1 '' $2 + + StrCmp $4$5 '' equal + + StrCpy $6 -1 + IntOp $6 $6 + 1 + StrCpy $3 $4 1 $6 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $4 0 + + StrCpy $7 -1 + IntOp $7 $7 + 1 + StrCpy $3 $5 1 $7 + StrCmp $3 '0' -2 + StrCmp $3 '' 0 +2 + StrCpy $5 0 + + StrCmp $4 0 0 +2 + StrCmp $5 0 begin newer2 + StrCmp $5 0 newer1 + IntCmp $6 $7 0 newer1 newer2 + + StrCpy $4 '1$4' + StrCpy $5 '1$5' + IntCmp $4 $5 begin newer2 newer1 + + equal: + StrCpy $0 0 + goto end + newer1: + StrCpy $0 1 + goto end + newer2: + StrCpy $0 2 + + end: + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Exch $0 +FunctionEnd |