VBScript to resolve ICE 33 & 57 error
Hi all,
Is anyone having the script to resolve ICE 33 & 57 errors in a package?
The script needs to be embedded in the package and it should automatically resolve the errors mentioned above.Please help us with your valuable insights as it is required quite urgently.
Is anyone having the script to resolve ICE 33 & 57 errors in a package?
The script needs to be embedded in the package and it should automatically resolve the errors mentioned above.Please help us with your valuable insights as it is required quite urgently.
0 Comments
[ + ] Show comments
Answers (15)
Please log in to answer
Posted by:
anonymous_9363
16 years ago
Do you understand what ICE errors are? I'm not sure you'd be asking the question if you did. A script isn't the way to resolve*any* ICE errors since they are connected with the MSI itself, not the target machine/user.
Typically, packagers ignore ICE33s because the perceived wisdom is that they're next to impossible to fix. However, IMV, the majority can be avoided by proper use of the COM tables.
ICE57s can be simply fixed by splitting the offending component into user and machine parts.
Typically, packagers ignore ICE33s because the perceived wisdom is that they're next to impossible to fix. However, IMV, the majority can be avoided by proper use of the COM tables.
ICE57s can be simply fixed by splitting the offending component into user and machine parts.
Posted by:
sapto123
16 years ago
Posted by:
sapto123
16 years ago
Posted by:
anonymous_9363
16 years ago
ORIGINAL: sapto123No, sorry, I don't. However, since your ICE30 script already queries components and adjusts tables, it should be a snap to alter it to cater for the others. For 33s, just find the DLL concerned, run a COM info-extraction tool (e.g. Wise's WiseComCapture) over it and import the .REG into your project. For 57s, create a new component using the filename or registry value name and move the entry to that. Easy.
So like this,do you have any solution for the stated errors?
Posted by:
captain_planet
16 years ago
I generally find that Wise does a decent(ish) job of using the COM tables when a package is created or registry is imported via a .reg. I agree with VBScab that solving 57s should be easy via a script, but an ICE 33 script will take a lot, lot longer to write. There are multiple ICE33 errors (due to CLSIDs (inprocservers, localservers etc), TYPELIBs, PROGIDs, APPIDs, VERBs etc etc etc). Then you've got to fully test it (because you could seriously knacker the app)......lot's of regular expressions lie ahead...[;)]
Posted by:
pgiesbergen
16 years ago
Captain_planet,
you are right that an ICE33 script will take a lot of time to write. I know because I did that [:@] There are so many combinations of regkeys (and vendor screwups) to search for. However if you are using Wise, then there's good chance you can't fix the warnings as Wise does a good job, but some hkcr keys are still dumped in the wrong components.
The Ice57 script is a lot easier:
you are right that an ICE33 script will take a lot of time to write. I know because I did that [:@] There are so many combinations of regkeys (and vendor screwups) to search for. However if you are using Wise, then there's good chance you can't fix the warnings as Wise does a good job, but some hkcr keys are still dumped in the wrong components.
The Ice57 script is a lot easier:
Option Explicit
Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransAct = 1
Const ForAppending = 8
Const ForReading = 1
Const ForWriting = 2
Dim database
Dim databasepath
Dim objFS : Set ObjFS = createobject("scripting.filesystemobject")
Dim logfile : logfile = "logfile.txt"
Dim argCount:argCount = Wscript.Arguments.Count
If argcount=0 Then
msgbox "no file to process!"
wscript.quit
End If
databasePath = Wscript.Arguments(0)
If (Not objFS.FileExists(databasePath)) Then
msgbox "File " &databasepath &" does Not exist"
wscript.quit
End If
Dim installer : Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase(databasepath, msiOpenDatabaseModeTransAct)
ice57
msgbox "Ready"
Sub Ice57()
On Error Resume Next
Dim i, Registry, component, prevcomponent, argument, waarde, directory, result, pos, controle, ice57_lijst
Dim Regkey, CU_Exists
'distinct removed from query
result = querydb("Select Registry.Registry, Registry.Value, Directory_, Component.Component FROM File, Component, Registry WHERE File.Component_=Component.Component And Registry.Component_=Component.Component And Registry.Root=1 And (Component.KeyPath=File.File Or Component.KeyPath =')Order by Component")
ice57_lijst = Split(result, vbCrLf)
CU_Exists = 0
For i = 0 To UBound(ice57_lijst)
' ice57line=split(ice57_lijst(i))
'no split to keep it readable ;)
parse_string ice57_lijst(i), Regkey, Registry, vbTab
parse_string Registry, Registry, directory, vbTab
parse_string directory, directory, component, vbTab
fprintf "Ice57: Component " & component & " contains both per-machine and per-user data", logfile
waarde = Registry
stripvalues Registry, component
If CU_Exists = 0 Then
result = querydb("select Component from Component where Component='CurrentUser'")
If result = Empty Then
new_component "CurrentUser", "", "", 4
fprintf " Created new component CurrentUser", logfile
CU_Exists = 2
Else
CU_Exists = 1
End If
End If
update_database "Update Registry Set Value='" & Registry & "', Component_='CurrentUser' where Root=1 and Component_='" & component & "' and Value='" & waarde & "'"
If waarde <> Registry Then
fprintf " CurrentUser key with value " & waarde & " changed to " & Registry & ", moved to component CurrentUser", logfile
Else
fprintf " CurrentUser key with value " & waarde & " moved to component CurrentUser", logfile
End If
If CU_Exists = 2 Then
update_database ("update Component set KeyPath='" & Regkey & "' where Component='CurrentUser'")
fprintf " Set keypath for component CurrentUser to " & Regkey, logfile
CU_Exists = 1
End If
Next
End Sub
Sub parse_string(input,out1,out2,pattern)
Dim teller,inputlen, file1, file2, patlen
teller=instr(input, pattern)
inputlen=len(input)
patlen=len(pattern)
If teller<>0 Then
file1=left(input,teller-1)
file2=right(input,inputlen-teller-patlen+1)
Else
file1=input
file2=""
End If
out1=file1
out2=file2
End Sub
Sub fprintf(regel, filenaam)
Dim tempfile
Set tempfile=objFS.OpenTextFile(filenaam, ForAppending, True)
tempfile.writeline(regel)
tempfile.close
End Sub
Function querydb(sql)
Dim record, view, columnCount, delim, column, rowdata
Set view = database.openview(sql)
querydb = Empty
view.Execute
Do
Set record = view.fetch
If record Is Nothing Then Exit Do
delim = vbTab
columnCount = record.FieldCount
For column = 1 To columnCount
If column = columnCount Then delim = vbCrLf
rowdata = rowdata & record.stringdata(column) & delim
Next
Loop
view.Close
If rowdata <> Empty Then
querydb = Left(rowdata, Len(rowdata) - 2)
Else
querydb = Empty
End If
End Function
Sub stripvalues(filepad, component)
Dim pre, after, after2, newfilepad, tempfilepad, result, kar, dir, file, pos, root
tempfilepad = filepad
Do
parse_string tempfilepad, pre, after, "["
newfilepad = newfilepad & pre
If after <> Empty Then
parse_string after, tempfilepad, after2, "]"
If after <> tempfilepad Then
kar = Left(tempfilepad, 1)
If kar = "$" Then
'get the directory
result = querydb("select `Directory_` from `Component` where `Component`='" & Right(tempfilepad, Len(tempfilepad) - 1) & "'")
newfilepad = newfilepad & "[" & result & "]"
Else
If kar = "!" Or kar = "#" Then
'directory erbij halen
result = querydb("select `Component`.`Directory_`, `File`.`FileName` from Component, File where `Component`.`Component`= `File`.`Component_` and `File`.`File`='" & Right(tempfilepad, Len(tempfilepad) - 1) & "'")
parse_string result, dir, file, vbTab
pos = InStr(file, "|")
If pos > 0 Then
file = Right(file, Len(file) - pos)
End If
newfilepad = newfilepad & "[" & dir & "]" & file
Else
newfilepad = newfilepad & "[" & tempfilepad & "]"
End If
End If
tempfilepad = after2
Else
newfilepad = newfilepad & "[" & tempfilepad
Exit Do
End If
Else
Exit Do
End If
Loop
If newfilepad <> Empty Then
filepad = newfilepad
End If
End Sub
Sub new_component(Componentnaam, directory, Feature, Attrib)
Dim newGUID
createguid newGUID
If directory = Empty Then directory = "TARGETDIR"
If Feature = Empty Then Feature = "Complete"
update_database "Insert into Component (Component, ComponentId, Directory_, Attributes) Values ('" & Componentnaam & "', '" & newGUID & "', '" & directory & "', " & Attrib & ")"
update_database "Insert Into FeatureComponents (Feature_, Component_) Values ('" & Feature & "','" & Componentnaam & "')"
End Sub
Sub createguid(newGUID)
Dim typelib
Set typelib = CreateObject("Scriptlet.TypeLib")
newGUID = typelib.Guid
newGUID = Left(newGUID, Len(newGUID) - 2)
End Sub
Sub update_database(sql)
On Error Resume Next
Dim record, view
Set view = database.openview(sql)
view.Execute
view.Close
If err.number<>0 Then
err.clear
msgbox "Error updating database: " & vbCrlf & sql
fprintf "Error updating database: " & vbCrlf & sql, logfile
err.clear
Else
database.commit
End If
End Sub
Posted by:
sami.msi
16 years ago
Hi Guys ,
Can i have your attention please As you were discussing about the ICE Errors i thought its an intersting topic to talk about as you told how to resolve ICE 33 & 57 error using VB Script. It true that you could do any to installer database or msi data base using Script as per as the ICE errors are concerned. I dont Think its better option to go far scripting rather you can resolve manually with no efforts. So why to make you applicaiton so comples for simpler thing isn't it first off all thing you must know what ICE stand for what. Here i am providing a list of all ICE go through it and you automatically understand what remediation should be taken to resolve the particular errors.Please find the below mentioned list for your better understanding on ICE and its Reference. I hope it would Help every Body
An ICE is used to validate installation packages.
ICE33
Checks the registry table for entries that belong in other tables.
ICE34
Validates that every group of radio buttons has a default.
ICE35
Validates that any files from a cabinet file cannot be set to run from the source.
ICE36
Validates that icons listed in the Icon table are used in the Class, ProgID, or Shortcut tables.
ICE38
Validates that components installed under the user's profile use a registry key under HKCU as their key path.
ICE39
Validates the Summary Information stream of the database.
ICE40
Performs various miscellaneous checks.
ICE41
Validates that entries in the Extension and Class tables refer to components belonging to the referenced feature.
ICE42
Checks that Class table entries do not have .exe files set as InProc values, and that only LocalServer contexts have arguments and DefInProc values.
ICE43
Checks that non-advertised shortcuts are in components with HKCU registry keys as the key paths.
ICE44
Checks that dialog events in the ControlEvent table (NewDialog, SpawnDialog, SpawnWaitDialog) reference valid Dialogs in the Dialog table.
ICE45
Checks for reserved bits that are set.
ICE46
Checks for custom properties that only differ from defined properties by their case.
ICE47
Checks for features with more than 1600 components per feature..
ICE48
Checks for directories that are hard-coded to local paths.
ICE49
Checks for non-REG_SZ default values in the registry table.
ICE50
Checks that advertised shortcuts have correct icons and context menus.
ICE51
Checks that TTC/TTF fonts do not have titles, but that all other fonts do.
ICE52
Checks for non-public properties in the AppSearch table.
ICE53
Checks for registry entries that write private installer information or policy values.
ICE54
Checks for components using companion files as their key path file.
ICE55
Checks that Lock Permission objects exist and have valid permissions.
ICE56
Validates that the directory structure of the .msi file has a single valid root.
ICE57
Validates that individual components do not mix per-machine and per-user data.
Thanks
Sami.
+91 9986014573
Can i have your attention please As you were discussing about the ICE Errors i thought its an intersting topic to talk about as you told how to resolve ICE 33 & 57 error using VB Script. It true that you could do any to installer database or msi data base using Script as per as the ICE errors are concerned. I dont Think its better option to go far scripting rather you can resolve manually with no efforts. So why to make you applicaiton so comples for simpler thing isn't it first off all thing you must know what ICE stand for what. Here i am providing a list of all ICE go through it and you automatically understand what remediation should be taken to resolve the particular errors.Please find the below mentioned list for your better understanding on ICE and its Reference. I hope it would Help every Body
An ICE is used to validate installation packages.
ICE33
Checks the registry table for entries that belong in other tables.
ICE34
Validates that every group of radio buttons has a default.
ICE35
Validates that any files from a cabinet file cannot be set to run from the source.
ICE36
Validates that icons listed in the Icon table are used in the Class, ProgID, or Shortcut tables.
ICE38
Validates that components installed under the user's profile use a registry key under HKCU as their key path.
ICE39
Validates the Summary Information stream of the database.
ICE40
Performs various miscellaneous checks.
ICE41
Validates that entries in the Extension and Class tables refer to components belonging to the referenced feature.
ICE42
Checks that Class table entries do not have .exe files set as InProc values, and that only LocalServer contexts have arguments and DefInProc values.
ICE43
Checks that non-advertised shortcuts are in components with HKCU registry keys as the key paths.
ICE44
Checks that dialog events in the ControlEvent table (NewDialog, SpawnDialog, SpawnWaitDialog) reference valid Dialogs in the Dialog table.
ICE45
Checks for reserved bits that are set.
ICE46
Checks for custom properties that only differ from defined properties by their case.
ICE47
Checks for features with more than 1600 components per feature..
ICE48
Checks for directories that are hard-coded to local paths.
ICE49
Checks for non-REG_SZ default values in the registry table.
ICE50
Checks that advertised shortcuts have correct icons and context menus.
ICE51
Checks that TTC/TTF fonts do not have titles, but that all other fonts do.
ICE52
Checks for non-public properties in the AppSearch table.
ICE53
Checks for registry entries that write private installer information or policy values.
ICE54
Checks for components using companion files as their key path file.
ICE55
Checks that Lock Permission objects exist and have valid permissions.
ICE56
Validates that the directory structure of the .msi file has a single valid root.
ICE57
Validates that individual components do not mix per-machine and per-user data.
Thanks
Sami.
+91 9986014573
Posted by:
anonymous_9363
16 years ago
Posted by:
pgiesbergen
16 years ago
Sami.msi,
you get me confused here. Are you telling us here that we should not use scripts to fix ICE errors because you have to understand why there is an ICE error? I dont think I need a better understanding of ICE errors. After fixing things hundreds of times one might consider using a script you know. On the other hand, if you disagree with the solution in the script we can discuss it here if you like.
you get me confused here. Are you telling us here that we should not use scripts to fix ICE errors because you have to understand why there is an ICE error? I dont think I need a better understanding of ICE errors. After fixing things hundreds of times one might consider using a script you know. On the other hand, if you disagree with the solution in the script we can discuss it here if you like.
Posted by:
sami.msi
16 years ago
Hi Pgiesbergen,
I am totally agree with you i am not denying that you cant fixed the errors by scripting , but there are some expectional cases where you need to go for scripting too. Some time it happen like when you try to resolve one ICE it will generates some other error relating to that in that cases. you can ignore the error. ICE is basically not an error which would harm your application funcationality i suppose. What i probably think or ( Packager point of view ) You got to make a package as simple as you can.
Sami..
I am totally agree with you i am not denying that you cant fixed the errors by scripting , but there are some expectional cases where you need to go for scripting too. Some time it happen like when you try to resolve one ICE it will generates some other error relating to that in that cases. you can ignore the error. ICE is basically not an error which would harm your application funcationality i suppose. What i probably think or ( Packager point of view ) You got to make a package as simple as you can.
Sami..
Posted by:
anonymous_9363
15 years ago
Try this one:
Option Explicit
Public blnResult
Public blnAnyoneResponded
Public blnReadMSDN
Public blnFoundOutWhatICE30ActuallyMeans
Public blnThoughtProcessAbandoned
If Not blnAnyoneResponded Then
blnResult = ReadMSDNArticle("ICE30")
If blnResult Then
blnReadMSDN = True
If blnFoundOutWhatICE30ActuallyMeans Then
WScript.Quit(True)
Else
'// You may need a For...Next or Do...While loop here
blnResult = ReadMSDNArticle("ICE30")
If blnResult Then
blnThoughtProcessAbandoned = True
End If
End If
End If
End If
Function ReadMSDNArticle(ByVal strArticleKeyword)
'// http://msdn.microsoft.com/en-us/library/aa368954(VS.85).aspx
End Function
Posted by:
pgiesbergen
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.