msigetpatchinfoex (msi)
Last changed: -63.115.132.100

.
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