Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

MsiGetPatchInfoEx (msi)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport("Msi.dll", SetLastError = true)]
static extern uint MsiGetPatchInfoEx(
    String szPatchCode,
    String szProductCode,
    String szUserSid, //pass 'null' to omit.
    MSIINSTALLCONTEXT dwContext,
    String szProperty,
    [Out] StringBuilder lpValue,
    ref uint pcchValue
);

VB Signature:

Declare Function MsiGetPatchInfoEx Lib "msi.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

   const uint CURRENT_USER_SID = 0;
   const string INSTALLPROPERTY_INSTALLDATE = "InstallDate"; // string value from MSDN

   uint pcchValue = 1024*1024;
   StringBuilder returnValue = new StringBuilder((int)pcchValue);
   uint rv;

   rv = MsiGetPatchInfoEx(
      patch_id,
      product_id,
      CURRENT_USER_SID,
      MSIINSTALLCONTEXT.Machine,  // defined below
      INSTALLPROPERTY_INSTALLDATE,
      returnValue,
      ref pcchValue
   );
///
   private string TranslateMsiError(int msiError)
   {
      switch (msiError)
      {
     case 5 :    return Resources.MsiErrorAccessDenied ;
     case 1610:  return Resources.MsiErrorBadConfiguration ;
     case 1627:  return Resources.MsiErrorFunctionFailed ;
     case 87:    return Resources.MsiErrorInvalidParameter ;
     case 234:   return Resources.MsiErrorMoreData ;
     case 0:     return Resources.MsiErrorSuccess ;
     case 1605:  return Resources.MsiErrorUnknownProduct ;
     case 1608:  return Resources.MsiErrorUnknownProperty ;
     case 1647:  return Resources.MsiErrorUnknownPatch ;

     default:
     break;
      }
      return Resources.AgentErrorUnknown;
   }

   enum MSIINSTALLCONTEXT
   {
      //  Query that is extended to all per–user-managed installations for the users that szUserSid specifies.
      UserManaged= 1,

      //  Query that is extended to all per–user-unmanaged installations for the users that szUserSid specifies.
      UserUnmanaged=2,

      //  Query that is extended to all per-machine installations.
      Machine=4
   }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions