’
-1 version1 < version2
’
0 version1 = version2
’
’ Special cases:
’ RESULT
version 1
version 2
’
0
empty
empty
’
1
validString
empty
’
-1
empty
validString
’
’ NOTE: This function should eventually move to common_functions.vbs
function versionCompare(ver1, ver2)
WScript.echo "Comparing [" & ver1 & "] to [" & ver2 & "]"
Const UNASSIGNED = "*UNASSIGNED*"
Dim v1Default, v2Default
’ Handle special cases:
if (IsEmpty(ver1) and IsEmpty(ver2)) Then
versionCompare = 0
exit function
end if
if (IsEmpty(ver1) and not IsEmpty(ver2)) Then
versionCompare = -1
exit function
end if
if (not IsEmpty(ver1) and IsEmpty(ver2)) Then
versionCompare = 1
exit function
end if
Dim ver1Parts, ver2Parts
’ Versions are not empty.
Break into parts and compare numbers
ver1Parts = Split(ver1,".")
ver2Parts = Split(ver2,".")
Dim v1Size, v2Size
v1Size = ubound(ver1Parts)
v2Size = ubound(ver2Parts)
’ If last version part is "*", treat all missing parts as "*"
’(so 2.* matches 2.1.3, for example)
if (v1Size > v2Size) Then
Redim Preserve ver2Parts(v1Size)
if (ver2Parts(v2Size)="*") Then
for i = v2Size to v1Size
ver2Parts(i) = "*"
next
end if
elseif (v2Size > v1Size) Then
Redim Preserve ver1Parts(v2Size)
if (ver1Parts(v1Size)="*") Then
for i = v1Size to v2Size
ver1Parts(i) = "*"
next
end if
end if
Dim i
i = 0
Do While (i<=ubound(ver1Parts) or i<=ubound(ver2Parts))
Dim v1, v2, v1Str, v2Str
v1Str = UNASSIGNED
v2Str = UNASSIGNED
Chapter 3. Extending Prerequisite Scanner
55
Summary of Contents for Prerequisite Scanner
Page 1: ...Prerequisite Scanner Version 1 1 1 10 User s Guide ...
Page 2: ......
Page 3: ...Prerequisite Scanner Version 1 1 1 10 User s Guide ...
Page 8: ...vi Prerequisite Scanner User s Guide ...
Page 10: ...viii Prerequisite Scanner User s Guide ...
Page 40: ...Figure 6 result txt file on Windows systems 30 Prerequisite Scanner User s Guide ...
Page 46: ...36 Prerequisite Scanner User s Guide ...
Page 68: ...58 Prerequisite Scanner User s Guide ...
Page 78: ...Figure 11 precheck log file with the debug data 68 Prerequisite Scanner User s Guide ...
Page 84: ...74 Prerequisite Scanner User s Guide ...
Page 88: ...78 Prerequisite Scanner User s Guide ...
Page 92: ...82 Prerequisite Scanner User s Guide ...
Page 116: ...106 Prerequisite Scanner User s Guide ...
Page 122: ...112 Prerequisite Scanner User s Guide ...
Page 136: ...126 Prerequisite Scanner User s Guide ...
Page 138: ...128 Prerequisite Scanner User s Guide ...
Page 140: ...130 Prerequisite Scanner User s Guide ...
Page 158: ...148 Prerequisite Scanner User s Guide ...
Page 164: ...154 Prerequisite Scanner User s Guide ...
Page 166: ...156 Prerequisite Scanner User s Guide ...
Page 170: ...160 Prerequisite Scanner User s Guide ...
Page 171: ......
Page 172: ... Printed in USA ...