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]: Overriding & Remembering the Installation Directory[Next]: Printer
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Patch Creation

Patch Creation

For now I am going to base this page on the "Patch Creation - Julian Onions" section and the code installed by MAKEMSI. This is a work in progress and may not be the best way of doing things.

This is what I had to do:

  1. Copied these files from the Windows Installer SDK:

    1. TEMPLATE.PCP
    2. MsiMsp.Exe
    3. mspatchc.dll
    4. PatchWiz.dll

  2. I copied "Patch.mmh".

  3. Created two versions of "TryMe.MM" and "TryMe.VER" to create two versions of the MSI.

  4. Used the "MSI MENU..." to create two uncompressed adminstrative images of the MSIs produced above.

  5. I fixed this part of julian's code to support directory trees whose names contain spaces:
    ;--- Make the full patch file ------------
    call Info "Building the patch file from <$MAKEMSI_OUT_MSI_DIR><??@@PatchName>.<$MAKEMSI_PATCHCTLFILE_SUFFIX>...";
    call Say  "";
    @@Cmd = 'Msimsp.exe -s "<$MAKEMSI_OUT_MSI_DIR><??@@PatchName>.<$MAKEMSI_PATCHCTLFILE_SUFFIX>" -p "<$MAKEMSI_OUT_MSI_DIR>\<??@@PatchName>.<$MAKEMSI_PATCHFILE_SUFFIX>" -l "<$MAKEMSI_OUT_LOG_DIR>patch.log"';
    @@Rc = AddressCmd(@@Cmd);
    if  @@Rc <> 0 then;
     error("Failed to build the patch - see <$MAKEMSI_OUT_LOG_DIR>patch.log",,'Failed Executing:',@@Cmd);
    call Info "Patch file built in <$MAKEMSI_OUT_MSI_DIR><??@@PatchName>.<$MAKEMSI_PATCHFILE_SUFFIX>";

  6. Created a "TestPatch.MM" file which looks like:
    #define? PATCH_URL  http://cantBeBlankBug.htm
    #include "patch.mmh"
    
    <$Patch "MyPatch">
        #define Family  MyFamily
        <$PatchFamily  Family="<$Family>">
        <$PatchImage   Key="MyOrig"  SrcMsi="out.1\AdminInstall\TryMe.msi" Upgraded="MyPatch">
        <$PatchUpgrade Key="MyPatch" NewMsi="out.2\AdminInstall\TryMe.msi" Family="<$Family>">
    ;    <$PatchSequence Family="<$Family>" Version="1.0.1">
    
        ;Logged MSG: Stop: ERROR: Since MSI 3.0 will block installation of major upgrade patches with sequencing information, creation of such patches is blocked.
        <$PatchProperty "SEQUENCE_DATA_GENERATION_DISABLED" Value="1">
        <$TableDelete "PatchSequence">
    <$/Patch>

    I had to add the last two statements to remove sequence information otherwise the patch wouldn't build and I'd get an error message "Failed to create patch. Error code: 0xC00E5182".

  7. Note that you can load the original MSI in "ORCA" and then view the patch.

  8. To Test the patch first install the "original MSI", then install the patch with the following command line:
    msiexec.exe /p MyPatch.msp /l*vx ApplyPatch.log

    However it only works if the MSI #1 is installed using the adminstrative image used in the patch creation above. If its installed by the original (compressed) MSI then I get a "2356" failure.

Update from Julian

Some comments on the patch creation:

I had to make admin installs for it to work at all.
It works OK provided you are just adding/deleting files,
or modifying text or .EXE files - it seems to deal with those ok.
Its not good on binary files though - and it takes a very long time to do
differences of anything significant (as in 4-5 hours).

Some comments on the patch application:

Also found patching can be very difficult to apply if any of the files
are changed by the user. Its also quite easy to mess up the MSI DB and
have the whole thing get corrupt! You then have to use an MS tool to
remove the installation and start again. So not as smooth a change as I'd
hoped.

Some comments on switching to using PocketSoft's "RTPatch":

We switched to pocketsoft's commercial RtPatch product,
which can make MSP compatible patches much faster and smaller.

However we found a number of bad interactions with the MSI files when
trying to apply patches to patches and stuff like that, so eventually
we switched to their native format patching - as it was the only pragmatic
way we could solve our problems.

Other Free Patch Tools

Some free patch tools include:


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]: Overriding & Remembering the Installation Directory[Next]: Printer


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