MSIDIFF.VBS |
This is a tool I have written to dump the contents of an MSI or to compare two databases and dump the differences (an "MSI to TEXT" utility). Either way the output is a set of MAKEMSI commands which can be executed to apply the modifications. I recommend that you also have a look at the "Using ORCA and MSIDIFF to Automate MSI Updates" section.
This program can actually process any Windows installer database types (for example ".msm" merge modules) and not just MSI files. Patch files can also be processed. Even transforms (undocumented binary format) are supported via the "/transform" switch.
MSIDIFF installs the following Explorer based options (see image below) as an alternative way of invoking this command line based tool:
This could be very useful if you have a GUI based MSI tool which does "something" you wish to automate. Simply create a "before" snapshot and make a single change and save the result as the "after" version. You can then dump the changes and see what changes were made to the MSI. The "Control Removal" tip in the MAKEMSI manual demonstrates this.
The code this program generates is simplistic and it is typically best to touch it up, for example where a columns value changed from 3 to 2 what may actually have happened is that a particular bit was reset. It might be best to recode it that way yourself (using any constants that may apply)...
Some other MSIDIFF pages:
BEFORE IMAGE / TEMPLATE |
While you can dump a complete MSI this is typically not what you really wish to do.
Typically you want to know what makes the MSI you are interested in different from any other, for this reason it is a good idea to create a "blank" MSI which basically does nothing.
With a GUI tool such as Wise for Windows PRO you might ask it to create an empty MSI and save this, with MAKEMSI you could either use the template MSI (probably "uisample.msi") or ask MAKEMSI to create an MSI with whatever minimal information you require.
Now when you dump your MSI (comparing with the template) only the changes will be dumped so constant "Dialog" or "_Validation" table information etc will not get dumped.
SYNTAX |
MsiDiff[.VBS] [MsiBefore] MsiNow [+MsiTable] [-MsiTable] /File FileName /Transform FileName /NoConsole /Column
By default this command dumps all tables, the "+" and "-" commands can be used to alter this. MSI table names are of course case sensitive.
To dump all tables you should not pass a value for "MsiBefore", it will then create an "empty" database and compare against that.
One or more "+" commands are used to specify the table(s) to be included (for example "+File +Shortcut"), in this case only the listed tables are dumped or compared.
The "-" command is used to specify tables that should not be processed, it is not valid (as it does not make sense) to use a "-" command if any "+" commands have been used.
The "/Transform" option allows you to dump a ".MST" (transform) file. The transform is applied to "MsiNow" and compared to the original "MsiNow" (without the transform). A transform can not be dumped directly as it is in not a windows installer database (it is an undocumented binary format), you can only dump the "effect" of applying the transform.
The "/File" option allows you to create a file containing the results (without having to use operating system redirection).
The "/NoConsole" option turns off output to the screen to speed up the generation (when large amounts of output are generated). You would have used the "/File" option otherwise it makes no sense to use this switch!
The "/Column" shows you the columns being created when a table is created. Normally these are not shown as they generally don't provide a lot of information for standard tables, however if custom tables have been created (or you suspect the schema may have changed) it may be useful. You will need to "translate" the column information before you could define the tables yourself (using the MAKEMSI "TableDefinition" command).
MSIDIFF.VBS /? |
; []--------------------------------------------------------------[] ; | MSIDIFF.VBS v08.233: Dumps MSI differences in "MakeMsi" format | ; | (C)opyright Dennis Bareis 2003-2008. All rights reserved. | ; | http://dennisbareis.com/index.htm | ; []--------------------------------------------------------------[] Invalid arguments ~~~~~~~~~~~~~~~~~ The switch "/?" is unknown! CORRECT SYNTAX ~~~~~~~~~~~~~~ cscript.exe [path\]MsiDiff[.VBS] [MsiBefore] Msi [Options] OPTIONS ~~~~~~~ +Table : A table to include in output (or "Summary") -Table : A table to exclude from output (or "Summary") /File : Output to the specified file (next parameter). /Transform: Apply transform (next parameter) to MSI then dump differences. /NoConsole: Don't output (much) to console (you used /file). /Column : Show Column Inserts. Only useful if custom tables are included. /NoSort : Don't sort table rows (row order significant?). /JustTableData : Only output TABLE and ROW macros. /NoComments : Remove all lines starting with semicolon. /MacroPrefix : Next parameter prefixes all macro names. You should also handle the special "MsiDiffError" macro! If "MsiBefore" is supplied then a compare between the 2 databases is performed, otherwise the complete database is dumped. Note that any Windows Installer file (such as merge modules) can also be dumped and compared. The output can also be redirected.
LIMITATIONS (current) |
Known limitations are:
If you still want to compare them you could remove the offending table or update its schema but you could also dump both MSIs separately and use "WinMerge.EXE" to compare.
This restriction now only applies if the program "MsiSummRead.exe" is not located in the same directory as MSIDIFF.
If we could not find any differences and the databases have the same file size then they are compared by MD5 (contents), if these match then there is absolutely no doubt that the databases are identical. The MD5 can only be calculated on machines which have Windows Installer version 2.0+ installed.