MSI: allow updating of feature states and other action fixes

Aric Stewart aric at codeweavers.com
Wed Jan 26 21:23:39 CST 2005


Enable the updating of Feature and thus the resulting component states
run the end of install actions for suspend and user exit states as well.
start putting in place a currently running state for future ui use.
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.75
diff -u -u -r1.75 action.c
--- dlls/msi/action.c	26 Jan 2005 21:09:05 -0000	1.75
+++ dlls/msi/action.c	27 Jan 2005 03:22:41 -0000
@@ -62,7 +62,6 @@
 static UINT ACTION_ProcessUISequence(MSIPACKAGE *package);
 
 static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq);
-UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
 
 static UINT ACTION_LaunchConditions(MSIPACKAGE *package);
 static UINT ACTION_CostInitialize(MSIPACKAGE *package);
@@ -712,12 +711,22 @@
     }
     else
         rc = ACTION_ProcessExecSequence(package,FALSE);
+    
+    if (rc == -1)
+    {
+        /* install was halted but should be considered a success */
+        rc = ERROR_SUCCESS;
+    }
 
     /* process the ending type action */
     if (rc == ERROR_SUCCESS)
         rc = ACTION_PerformActionSequence(package,-1);
+    else if (rc == ERROR_INSTALL_USEREXIT) 
+        rc = ACTION_PerformActionSequence(package,-2);
     else if (rc == ERROR_FUNCTION_FAILED) 
         rc = ACTION_PerformActionSequence(package,-3);
+    else if (rc == ERROR_INSTALL_SUSPEND) 
+        rc = ACTION_PerformActionSequence(package,-4);
 
     /* finish up running custom actions */
     ACTION_FinishCustomActions(package);
@@ -1106,6 +1115,7 @@
         rc = ERROR_FUNCTION_NOT_CALLED;
      }
 
+    package->CurrentInstallState = rc;
     ui_actioninfo(package, action, FALSE, rc);
     return rc;
 }
@@ -1817,6 +1827,57 @@
     return path;
 }
 
+/* update compoennt state based on a feature change */
+void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
+{
+    int i;
+    INSTALLSTATE newstate;
+    MSIFEATURE *feature;
+
+    i = get_loaded_feature(package,szFeature);
+    if (i < 0)
+        return;
+
+    feature = &package->features[i];
+    newstate = feature->ActionRequest;
+
+    for( i = 0; i < feature->ComponentCount; i++)
+    {
+        MSICOMPONENT* component = &package->components[feature->Components[i]];
+
+        if (!component->Enabled)
+            continue;
+        else
+        {
+            if (newstate == INSTALLSTATE_LOCAL)
+                component->ActionRequest = INSTALLSTATE_LOCAL;
+            else 
+            {
+                int j,k;
+
+                component->ActionRequest = newstate;
+
+                /*if any other feature wants is local we need to set it local*/
+                for (j = 0; 
+                     j < package->loaded_features &&
+                     component->ActionRequest != INSTALLSTATE_LOCAL; 
+                     j++)
+                {
+                    for (k = 0; k < package->features[j].ComponentCount; k++)
+                        if ( package->features[j].Components[k] ==
+                             feature->Components[i] )
+                        {
+                            if (package->features[j].ActionRequest == 
+                                INSTALLSTATE_LOCAL)
+                                component->ActionRequest = INSTALLSTATE_LOCAL;
+                            break;
+                        }
+                }
+            }
+        }
+    } 
+}
+
 static UINT SetFeatureStates(MSIPACKAGE *package)
 {
     LPWSTR level;
@@ -5259,6 +5320,7 @@
         return ERROR_UNKNOWN_FEATURE;
 
     package->features[index].ActionRequest= iState;
+    ACTION_UpdateComponentStates(package,szFeature);
 
     return ERROR_SUCCESS;
 }
Index: dlls/msi/action.h
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.h,v
retrieving revision 1.1
diff -u -u -r1.1 action.h
--- dlls/msi/action.h	25 Jan 2005 20:17:09 -0000	1.1
+++ dlls/msi/action.h	27 Jan 2005 03:22:41 -0000
@@ -97,8 +97,10 @@
 }MSIFILE;
 
 
+UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
 void ACTION_FinishCustomActions( MSIPACKAGE* package);
 UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
+void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
 
 
 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
Index: dlls/msi/msipriv.h
===================================================================
RCS file: /home/wine/wine/dlls/msi/msipriv.h,v
retrieving revision 1.42
diff -u -u -r1.42 msipriv.h
--- dlls/msi/msipriv.h	26 Jan 2005 19:41:13 -0000	1.42
+++ dlls/msi/msipriv.h	27 Jan 2005 03:22:41 -0000
@@ -207,6 +207,8 @@
     UINT RunningActionCount;
 
     LPWSTR PackagePath;
+
+    UINT CurrentInstallState;
 } MSIPACKAGE;
 
 typedef struct tagMSIPREVIEW


More information about the wine-patches mailing list