MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: MmLockFile.VBS[Next]: Sample MsiDiff Output - comcat.msm (merge module)
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Tools->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:

  1. Sample MsiDiff Output - comcat.msm (merge module)
  2. How to Post Process MSIDIFF Output
  3. UpgradeCode, Simple Tool to dump MSI codes


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.


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 v08.233: Dumps MSI differences in "MakeMsi" format |
; |      (C)opyright Dennis Bareis 2003-2008. All rights reserved. |
; |        |
; []--------------------------------------------------------------[]

Invalid arguments
The switch "/?" is unknown!

cscript.exe [path\]MsiDiff[.VBS]  [MsiBefore]  Msi  [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.


Known limitations are:

  1. Does not show database code page differences.

  2. Does not show any "_Storages" table differences.

  3. Does not show any "_Streams" table differences. If the stream was created via another table (such as the "Binary" table) it will pick it up but the output value is text describing the value rather than the contents of the file (or a link to the file).

  4. If the MSIs has two tables with different schema a compare will not be possible. This is a limitation which is unlikely to be removed as it is a Windows Installer restriction. The compare functionaility is in any case mainly useful for comparing similar databases built using the same tools.

    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.

  5. Summary items longer than 259 characters can't be retrieved (therefore compared). Apparently this Windows Installer bug has been fixed in "Windows Server 2003 and later versions", why the fix can't be addressed for all other operating systems is unknown...

    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.

Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: MmLockFile.VBS[Next]: Sample MsiDiff Output - comcat.msm (merge module)

MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.