Patch Files Extractor

Patch Files Extractor

Rate This
  • Comments 13

Previously I discussed conceptually how to extract files from a patch, mentioning that the transforms contained within patches are stored as sub-storages and the cabinets that contain the files are stored as sub-streams. I've had a tool for a while that extracts the transforms and cabinets from a .msp file and wanted to share the slightly modified source for public consumption. This tool can extract transforms and binary streams from other Windows Installer file types such as .msi and .msm files, as well as other compound storage documents.

You can download the source and a release binary that programmatically does what I previously explained. This does not expand the files into the target directory structure, which is best handled by patching an administrative installation. What's nice about extracting the cabinet file is that you get all files for all target products if the patch targets multiple products, which is common for Developer Division.

Extracting the transforms - both the patch transform and the non-administrative transform - can be handy in determine which transform transforms what data. For example, in identifying a patch applied to an administrative transform, I need to write a property to the non-administrative transform. To check this, I can extract the transforms and apply the non-administrative transform to the target product in Orca. If I simply applied the patch in Orca, I'd see both transforms applied and couldn't be sure which transform wrote the property to help identify the patch as a client patch.

Download the tool

Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
  • Thanks for posting the tool. I tried it out. In my case it extracted a CAB file from an MSP.

    Am I right in thinking that the files contained in the CAB will be used to patch the original installed binaries. If so would it be possible to figure out how they will be applied? i.e. could I figure out if a file in the CAB will replace another binary or just patch it?
  • Chris, this tool will extract the CAB which contains all files for all transforms in the patch. That's one advantage or what you're requesting, which is to apply a patch to an administrative installation for one single product, since a patch might patch more than one product and, thus, contain additional files.

    What I recommend is opening the product in question in Orca (part of the Windows Installer SDK, and a most invaluable tool!) then click on Transforms->View Patch and apply the patch. Look in the File table for any green rows or cells for the changes the patch *might* make, assuming newer versions of files are present on the system.

    In order to actually see what files will install you should verbosely log installation of the patch. A tool could be written that would go through based on flags (similar to REINSTALLMODE) and figure out if files would actually be patched, but is beyond the scope of this particular tool.

    For more information about determining which files are being patched see my linked post at http://blogs.msdn.com/heaths/archive/2006/03/24/560467.aspx.
  • Thanks Heath - this takes us a lot closer with what we talking about! I've just re-visted the issue, and stumbled over this page!

    http://blogs.msdn.com/heaths/archive/2006/02/14/532200.aspx

  • Hi Heath, when using the tool with a random msp (office sp2), it extracted a number of mst files and a cab which appears to contain complete files. Are the MST files likely to be partial binarys or just other installer actions?

    Thanks
  • Ian, an MSP contains MSTs; it's really not much more than a container for MSTs and CAB(s). Please read http://blogs.msdn.com/heaths/archive/2005/09/01/459561.aspx for more information.
  • An MSP contains MSTs; it's really not much more than a container for MSTs and CAB(s). Please read http://blogs.msdn.com/heaths/archive/2005/09/01/459561.aspx for more information.
  • Digitally signing files helps protect against changes to a file (or any data, really) by validating that...
  • PingBack from http://blog.ze-games.net/fahrenheit-pc-game-e-o-windows-vista-64-bits-so-com-maracutaia/

  • PingBack from http://www.it-psycho.de/2008/05/02/0xc06d007e-2/

  • PingBack from http://www.bitfrickler.de/2008/07/bootcamp-treiber-unter-vista/

  • Thanks!!!! You've saved me a TON of time with this.

  • Heath, Thanks for the blog, it is indeed very informative.

    I tried "What I recommend is opening the product in question in Orca (part of the Windows Installer SDK, and a most invaluable tool!) then click on Transforms->View Patch and apply the patch. Look in the File table for any green rows or cells for the changes the patch *might* make, assuming newer versions of files are present on the system"

    but OCRA threw an error saying the "This patch can not be applied to the packages with the current product code" Further exploring the MSP using OCRA I realized that  the Product Code column under the MsiPatchSequence Table is empty. I am sure that the MSI and MSP point to the same product, but I am not sure how the MSP was generated. Is there any other way of linking the two together instead of the product code?

    Thanks,

    Dhruv

  • @Dhruv Sakalley, the ProductCode column of the MsiPatchSequence table isn't required nor recommended (if you need it, your patching solution is too complicated). The target ProductCode is encoded first and foremost in the embedded transforms. They may be listed in the patch's summary information stream, but that's also not required nor always definitive.

    If you want to see what ProductCodes the patch targets via its transforms, you can use http://psmsi.codeplex.com using the get-msisummaryinfo cmdlets on the MSP with the -includetransforms switch parameter.

Page 1 of 1 (13 items)