msi: more action.c work

Aric Stewart aric at codeweavers.com
Mon Jan 31 17:39:35 CST 2005


continued work to simplify the ProcessAction call, also split it into a 
ProcessAction and ProcessUIAction for future dialog box work.

Also fix a bug in deformat_string where i was not freeing the created 
record.
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.77
diff -u -u -r1.77 action.c
--- dlls/msi/action.c	31 Jan 2005 16:23:12 -0000	1.77
+++ dlls/msi/action.c	31 Jan 2005 23:39:40 -0000
@@ -374,8 +374,10 @@
             size++;
             *data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
             MSI_FormatRecordW(package,rec,*data,&size);
+            msiobj_release( &rec->hdr );
             return sizeof(WCHAR)*size;
         }
+        msiobj_release( &rec->hdr );
     }
 
     *data = NULL;
@@ -1050,7 +1052,7 @@
                 break;
             }
 
-            rc = ACTION_PerformAction(package,buffer);
+            rc = ACTION_PerformUIAction(package,buffer);
 
             if (rc == ERROR_FUNCTION_NOT_CALLED)
                 rc = ERROR_SUCCESS;
@@ -1076,6 +1078,58 @@
 /********************************************************
  * ACTION helper functions and functions that perform the actions
  *******************************************************/
+BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action, UINT* rc)
+{
+    BOOL ret = FALSE; 
+
+    int i;
+    i = 0;
+    while (StandardActions[i].action != NULL)
+    {
+        if (strcmpW(StandardActions[i].action, action)==0)
+        {
+            ui_actioninfo(package, action, TRUE, 0);
+            ui_actionstart(package, action);
+            *rc = StandardActions[i].handler(package);
+            ui_actioninfo(package, action, FALSE, *rc);
+            ret = TRUE;
+            break;
+        }
+        i++;
+    }
+    return ret;
+}
+
+BOOL ACTION_HandleDialogBox(MSIPACKAGE *package, LPCWSTR dialog, UINT* rc)
+{
+    BOOL ret = FALSE;
+
+    /*
+     * for the UI when we get that working
+     *
+    if (ACTION_DialogBox(package,dialog) == ERROR_SUCCESS)
+    {
+        *rc = package->CurrentInstallState;
+        ret = TRUE;
+    }
+    */
+    return ret;
+}
+
+BOOL ACTION_HandleCustomAction(MSIPACKAGE* package, LPCWSTR action, UINT* rc)
+{
+    BOOL ret=FALSE;
+    UINT arc;
+
+    arc = ACTION_CustomAction(package,action,FALSE);
+
+    if (arc != ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        *rc = arc;
+        ret = TRUE;
+    }
+    return ret;
+}
 
 /* 
  * A lot of actions are really important even if they don't do anything
@@ -1088,36 +1142,44 @@
 UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
 {
     UINT rc = ERROR_SUCCESS; 
-    BOOL handled = FALSE;
-    int i;
+    BOOL handled;
 
     TRACE("Performing action (%s)\n",debugstr_w(action));
 
-    i = 0;
-    while (StandardActions[i].action != NULL)
+    handled = ACTION_HandleStandardAction(package, action, &rc);
+
+    if (!handled)
+        handled = ACTION_HandleCustomAction(package, action, &rc);
+
+    if (!handled)
     {
-        if (strcmpW(StandardActions[i].action, action)==0)
-        {
-            ui_actioninfo(package, action, TRUE, 0);
-            ui_actionstart(package, action);
-            rc = StandardActions[i].handler(package);
-            ui_actioninfo(package, action, FALSE, rc);
-            handled =TRUE;
-            break;
-        }
-        i++;
+        FIXME("UNHANDLED MSI ACTION %s\n",debugstr_w(action));
+        rc = ERROR_FUNCTION_NOT_CALLED;
     }
 
-    /* Try for Custom Actions */
+    package->CurrentInstallState = rc;
+    return rc;
+}
+
+UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
+{
+    UINT rc = ERROR_SUCCESS;
+    BOOL handled = FALSE;
+
+    TRACE("Performing action (%s)\n",debugstr_w(action));
+
+    handled = ACTION_HandleStandardAction(package, action, &rc);
+
     if (!handled)
-    {
-        rc = ACTION_CustomAction(package,action,FALSE);
+        handled = ACTION_HandleCustomAction(package, action, &rc);
 
-        if (rc != ERROR_SUCCESS)
-        {
-            FIXME("UNHANDLED MSI ACTION %s\n",debugstr_w(action));
-            rc = ERROR_FUNCTION_NOT_CALLED;
-        }
+    if (!handled)
+        handled = ACTION_HandleDialogBox(package, action, &rc);
+
+    if (!handled)
+    {
+        FIXME("UNHANDLED MSI ACTION %s\n",debugstr_w(action));
+        rc = ERROR_FUNCTION_NOT_CALLED;
     }
 
     package->CurrentInstallState = rc;
Index: dlls/msi/action.h
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.h,v
retrieving revision 1.2
diff -u -u -r1.2 action.h
--- dlls/msi/action.h	27 Jan 2005 11:12:56 -0000	1.2
+++ dlls/msi/action.h	31 Jan 2005 23:39:40 -0000
@@ -98,6 +98,7 @@
 
 
 UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
+UINT ACTION_PerformUIAction(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);
Index: dlls/msi/custom.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/custom.c,v
retrieving revision 1.3
diff -u -u -r1.3 custom.c
--- dlls/msi/custom.c	27 Jan 2005 10:43:12 -0000	1.3
+++ dlls/msi/custom.c	31 Jan 2005 23:39:41 -0000
@@ -103,7 +103,7 @@
     {
         MSI_ViewClose(view);
         msiobj_release(&view->hdr);
-        return rc;
+        return ERROR_CALL_NOT_IMPLEMENTED;
     }
 
     type = MSI_RecordGetInteger(row,2);


More information about the wine-patches mailing list