|
set unique_tokens = CreateObject("Scripting.Dictionary") |
|
Set wi = CreateObject("WindowsInstaller.Installer") |
|
|
|
msi_file = WScript.Arguments(0) |
|
|
|
WScript.Echo "** Searching for possible public properties in " & msi_file |
|
WScript.Echo "" |
|
|
|
Const open_database_mode_read_only = 0 |
|
Set db = wi.OpenDatabase(msi_file, open_database_mode_read_only) |
|
|
|
find_public_properties("select Condition from AdminExecuteSequence") |
|
find_public_properties("select Condition from AdminUISequence") |
|
find_public_properties("select Condition from AdvtExecuteSequence") |
|
find_public_properties("select Condition from Condition") |
|
find_public_properties("select Condition from ControlCondition") |
|
find_public_properties("select Condition from ControlEvent") |
|
find_public_properties("select Condition from InstallExecuteSequence") |
|
find_public_properties("select Condition from InstallUISequence") |
|
find_public_properties("select Condition from LaunchCondition") |
|
|
|
For Each key In unique_tokens.Keys |
|
WScript.Echo key |
|
Next |
|
|
|
Sub find_public_properties(sql) |
|
Set v = db.OpenView(sql) |
|
v.Execute |
|
Do |
|
Set rec = v.Fetch |
|
If rec Is Nothing Then |
|
Exit Do |
|
End If |
|
data = rec.StringData(1) |
|
data = Replace(data, "(", " ") |
|
data = Replace(data, ")", " ") |
|
data = Replace(data, "=", " ") |
|
data = Replace(data, "<", " ") |
|
data = Replace(data, ">", " ") |
|
tokens = Split(data) |
|
For Each token In tokens |
|
If is_public_property(token) Then |
|
If Not unique_tokens.Exists(token) Then |
|
unique_tokens.Add token, "" |
|
End If |
|
End If |
|
Next |
|
Loop |
|
End Sub |
|
|
|
Function is_public_property(p) |
|
If Len(p) = 0 Then |
|
is_public_property = False |
|
Exit Function |
|
End If |
|
For i = 1 To Len(p) |
|
char = Mid(p, i, 1) |
|
If Not is_valid_char(char) Then |
|
is_public_property = False |
|
Exit Function |
|
End If |
|
Next |
|
first_char = Asc(p) |
|
If first_char = 46 Or (first_char > 47 And first_char < 58) Then |
|
is_public_property = False |
|
Exit Function |
|
End If |
|
If p = "AND" Or p = "NOT" Or p = "OR" Then |
|
is_public_property = False |
|
Exit Function |
|
End If |
|
is_public_property = True |
|
End Function |
|
|
|
Function is_valid_char(c) |
|
a = Asc(c) |
|
If a = 46 Or a = 95 Or (a > 47 And a < 58) Or (a > 64 And a < 91) Then |
|
is_valid_char = True |
|
Else |
|
is_valid_char = False |
|
End If |
|
End Function |