List:Commits« Previous MessageNext Message »
From:Iggy Galarza Date:February 21 2011 4:37pm
Subject:bzr commit into wex-installer-1.0 branch (iggy:341)
View as plain text  
#At file:///C:/src/bzr.mysql/wex/installer/ based on revid:iggy@stripped

  341 Iggy Galarza	2011-02-21
      Remove installed products even when MSI isn't available in cache.

    modified:
      WexInstaller.Core/Installer.cs
      WexInstaller.Core/MsiInterop.cs
      WexInstaller.Core/Product.cs
=== modified file 'WexInstaller.Core/Installer.cs'
--- a/WexInstaller.Core/Installer.cs	2011-02-08 21:28:42 +0000
+++ b/WexInstaller.Core/Installer.cs	2011-02-21 16:37:13 +0000
@@ -26,6 +26,9 @@ namespace WexInstaller.Core
         /// <summary> Path to msi package </summary>
         public string Path { get; set; }
 
+        /// <summary> When true, the ChainedInstaller will use the MsiConfigureProductEx fucntion else MsiInstallProduct</summary>
+        public bool UseProductCode { get; set; }
+
         /// <summary> command line, in form PROPERTY1=VALUE1 PROPERTY2=VALUE2 where PROPERTY are public Msi properties </summary>
         public string CommandLine { get; set; }
 
@@ -34,6 +37,7 @@ namespace WexInstaller.Core
 
         public PackageParameters(string path, InstallAction installAction)
         {
+            UseProductCode = false;
             Path = path;
             switch (installAction)
             {
@@ -233,7 +237,15 @@ namespace WexInstaller.Core
                     | InstallLogMode.CommonData | InstallLogMode.Progress | InstallLogMode.Initialize
                     | InstallLogMode.Terminate | InstallLogMode.ShowDialog | InstallLogMode.InstallStart
                     | InstallLogMode.InstallEnd, IntPtr.Zero);
-                returnCodes[returnIndex] = MsiInterop.MsiInstallProduct(par.Path, par.CommandLine);
+
+                if (par.UseProductCode == true)
+                {
+                    returnCodes[returnIndex] = MsiInterop.MsiConfigureProductEx(par.Path, InstallLevel.Default, InstallState.Default, par.CommandLine);
+                }
+                else
+                {
+                    returnCodes[returnIndex] = MsiInterop.MsiInstallProduct(par.Path, par.CommandLine);
+                }
             }
 
             return returnCodes;

=== modified file 'WexInstaller.Core/MsiInterop.cs'
--- a/WexInstaller.Core/MsiInterop.cs	2011-02-08 21:28:42 +0000
+++ b/WexInstaller.Core/MsiInterop.cs	2011-02-21 16:37:13 +0000
@@ -89,7 +89,15 @@ namespace WexInstaller.Core
         Advertised = 1,
         Absent     = 2,
         Local      = 3,
-        Source     = 4
+        Source     = 4,
+        Default    = 5
+    }
+
+    public enum InstallLevel
+    {
+        Default = 0,
+        Minimum = 1,
+        Maximum = 65535
     }
 
     public enum MSIEnumError : uint
@@ -180,6 +188,8 @@ namespace WexInstaller.Core
         internal static extern int MsiSetInternalUI(InstallUILevel uiLevel, IntPtr hwnd);
         [DllImport("msi.dll")]
         internal static extern uint MsiInstallProduct(string packagePath, string commandLine);
+        [DllImport("msi.dll")]
+        internal static extern uint MsiConfigureProductEx(string productCode, InstallLevel installLevel, InstallState installState, string commandLine);
 /*
         [DllImport("msi.dll")]
         internal static extern uint MsiOpenPackageEx(string packagePath, int dwOptions, ref UIntPtr msiHandle);

=== modified file 'WexInstaller.Core/Product.cs'
--- a/WexInstaller.Core/Product.cs	2011-02-10 22:24:06 +0000
+++ b/WexInstaller.Core/Product.cs	2011-02-21 16:37:13 +0000
@@ -354,6 +354,11 @@ namespace WexInstaller.Core
             if (p != null)
             {
                 PackageParameters parameters = new PackageParameters(p.FullPath, InstallAction.Uninstall);
+                if (p.FoundLocal == false)
+                {
+                    parameters.UseProductCode = true;
+                    parameters.Path = p.Id;
+                }
 
                 Logger.LogInformation(String.Format("Beginning removal of {0}.", Name));
                 CurrentState = ProductState.RemoveStarted;


Attachment: [text/bzr-bundle] bzr/iggy@mysql.com-20110221163713-pzccrqkckdsxoivn.bundle
Thread
bzr commit into wex-installer-1.0 branch (iggy:341) Iggy Galarza21 Feb