Some Patch Detection Designer Pointers for a MSI Newbie

Questions

MSP Patch detection questions from a MSI newbie:

  1. Is there any API which directly consumes the Patch XML Blob and intimates if it is applicable/Installed on the target system as the whole set of information is already available in the XML blob?
  2. Do we have to retrieve the target product code from the blob and pass it separately to the API?
  3. Is there a way to just pass the MSP meta data XML to an API and get applicability status?
  4. For the MsiDeterminePatchSequence API, do we have to pass the first argument (szProductCode) to the function, since the XML blob contains target product codes?

Answers

Here are the pointers you may find useful

  1. See the MSDN topic Patching Initial Installations. It tells you which API’s you can pass the XML blob to in order to determine applicability.

  2. same as above

  3. Have a look at the MSI sequencing API. You have two choices:

     MsiDetermineApplicablePatches
    MsiDeterminePatchSequence
    

    Both take a PMSIPATCHSEQUENCEINFO parameter which allows for an array of structs. Each struct has two files. A string and a type. The type indicates if it's a path to a patch file, a path to an XML file, or a path to an XML blob.

    You can simply take the output from the XML extraction API and then pass it to the sequencing API.

  4. The szProductCode parameter is required. It is not listed as optional. Therefore, yes you do have to provide it.

    Normally you already have publishing data associated with a MSP that your applying and are directed to patch a particular product. Therefore you can evaluate for that product, what set of patches to be downloaded.

    If you aren't mapping patches already to product codes, then yes, you have to determine them yourself. Of course, your other approach is to enumerate the products already present on the machine and then from that enumeration determine which patches that you have should be downloaded and applied using the product code you retrieved and the XML blobs.

    You have other APIs like MsiEnumProductsEx and the like that can provide additional state on the machine.

Content credit also belongs to

[Author: Robert Flaming]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.

Comments