Archive: Problems with version check


Problems with version check
  hi,
i need to compare 2 versionnumbers. at the first time this versionnumbers always had 2 digits, now some of them have 3 or even 4 digits. is there a way to check them absolutely correctly?

at this time i use this macro:


macro VersionCheck

Exch$0 ;second versionnumber
Exch
Exch$1 ;first versionnumber
Push $R0;counter for $0
Push $R1;counter for $1
Push$3 ;temp char
Push$4 ;temp string for $0
Push$5 ;temp string for $1
StrCpy $R0 "-1"
StrCpy $R1 "-1"
Start:
StrCpy $4 ""
DotLoop0:
IntOp $R0 $R0 + 1
StrCpy$3 $0 1 $R0
StrCmp$3 "" DotFound0
StrCmp$3 "." DotFound0
StrCpy$4 $4$3
Goto DotLoop0
DotFound0:
StrCpy $5 ""
DotLoop1:
IntOp $R1 $R1 + 1
StrCpy$3 $1 1 $R1
StrCmp$3 "" DotFound1
StrCmp$3 "." DotFound1
StrCpy$5 $5$3
Goto DotLoop1
DotFound1:
Strcmp $4 "" 0 Not4
StrCmp$5 "" Equal
Goto Ver2Less
Not4:
StrCmp $5 "" Ver2More
IntCmp$4 $5 Start Ver2Less Ver2More
Equal:
StrCpy $0 "0"
Goto Finish
Ver2Less:
StrCpy $0 "1"
Goto Finish
Ver2More:
StrCpy $0 "2"
Finish:
Pop $5
Pop$4
Pop$3
Pop $R1
Pop $R0
Pop$1
Exch$0
>!macroend
>
best wishes
daniel

This is what you want. Archives will usually give you the answer without you having to ask on here :)


Also trying this is hardly gonna hurt...