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]: UISAMPLE.MSI[Next]: Invoking MSI Update Via Batch File
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->MAKEMSI Installs...->Available Frameworks->Making changes to existing databases

Making changes to existing databases

This section deals mainly with making changes to existing Windows Installer databases. The same process could be used to build a complete Windows Installer database from scratch but this is basically covered under the section "Preferred MSI Interface for Building a Complete MSI" as you would wish to create some sort of "wrapper" to take care of common requirements such as what do you begin with (a "template" MSI etc) and common requirements such as setting package GUIDs.

You could use a batch file running multiple "WiRunSql.VBS" commands, the main advantage of this is that it will be much quicker, the downsides include that errors are difficult to test for, its harder to create the correct commands and its not as easy to understand. The "MsiDiff.VBS" tool can generate the correct MAKEMSI code for you.

These are the main "basic" macros you would likely wish to use as they basically supply mosty of what "ORCA" does:

  1. MSI and /MSI
  2. Row and /Row
  3. RowsDelete
  4. RowsDeleteAll
  5. Table and /Table
  6. TableCreate
  7. TableDefinition and /TableDefinition
  8. TableExportToIdt
  9. TableImportFromIdt

Of course there is no reason most of the many higher level commands can't be used if you wish.

The "OpenMsi.MMH" header should be included rather than "MAKEMSI.MMH".

Note that if you use the file macros the files will not be "compiled" in as "pass 2" processing is disabled.

EXAMPLE - Basic

;--- Include MAKEMSI Support ------------------------------------------------
#include "OpenMsi.MMH"

;--- Do the work ------------------------------------------------------------
<$Msi "out\TestMsi.mm\Msi\After.msi" template="out\TestMsi.mm\Msi\Before.msi">
   ;--- A simple change to an existing MSI ----------------------------------
   <$Property "ABCDEFG" VALUE="C:\">
<$/Msi>

EXAMPLE - Perhaps a Smarter Way...

The previous example directly included the "OPENMSI.MMH" header file, while this is OK you probably also wish to do other "standard" things when you change and MSI (or you may wish to in the future).

Its a good idea if you create your own header file even if it doesn't do much more than include "OpenMSI.MMH", that way you can add to the header at any time and the changes will be included in any future updates you do without the need to retrofit anything.

The most obvious thing you may wish to do when updating an MSI is to to update the author information. You can make any application of "standards" optional to handle any instances where you may not be able to apply the updates. You may also wish to require the user (probably you!) to specifically refer to macros you create in this header, whatever you do have a think about how you like to work and how you can maximise your flexibility.

The following is one example of such a header file (called "MyMsiUpdate.MMH").

;--- Include the standard MAKEMSI "update" header ---------------------------
#include "OpenMsi.MMH"

;--- Start the Update process -----------------------------------------------
<$Msi "<$UPDATE_TO>" template="<$UPDATE_FROM>">

;--- Schedule the update termination after all your changes -----------------
#OnExit #100 <$ExecutedAfterAllUserUpdates>
#(
    #define ExecutedAfterAllUserUpdates

    ;--- Record Details about who is making the change ----------------------
    <$Summary "LastAuthor" VALUE="<$MAKEMSI_USERNAME>">
    <$Summary "EDITTIME"   VALUE="now()">

    ;--- Now finish off the "MSI" nesting -----------------------------------
    <$/Msi>
#)

As you hopefully noticed, the header requires the "includer" to define some standard definitions which contains the "before" and "after" database information and also removes the need for the "MSI" and "/MSI" commands in the including code.

The following shows the changes to the original sample to include the header:

;--- Include My MAKEMSI Update Support --------------------------------------
#define  UPDATE_FROM         out\TestMsi.mm\Msi\Before.msi
#define  UPDATE_TO           out\TestMsi.mm\Msi\After.msi
#include "MyMsiUpdate.MMH"   ;;Include header and do "standard" things

;--- A simple change to an existing MSI ----------------------------------
<$Property "ABCDEFG" VALUE="C:\">

Note that the "before" and "after" macros could be passed on the invoking command line (with the PPWIZARD "/Define" switch) or via environment variables (see the "Invoking MSI Update Via Batch File" section for an example of this).


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]: UISAMPLE.MSI[Next]: Invoking MSI Update Via Batch File


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday August 13 2017 at 2:39pm
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.