[msitools: 1/2] Support all CustomAction Execute types properly




commit 0f5032c6123a9323ec836fec1dc51183f6e9cf41
Author: roblabla <unfiltered roblab la>
Date:   Fri Nov 12 22:23:05 2021 +0100

    Support all CustomAction Execute types properly
    
    This commit does two things: It sets the correct flags for all types of
    CustomAction Execute types (mostly figured through experimentation), and
    only sets NO_IMPERSONATE flag if the resulting type has the IN_SCRIPT
    type set (which is in-line with Microsoft's documentation of the
    NO_IMPERSONATE flag: It's an in-script option).
    
    This should allow SET_PROPERTY custom actions to work. Previously, they
    would be set to SET_PROPERTY | NO_IMPERSONATE, which is an invalid
    custom action type that Windows' msiexec would complain about.

 tools/wixl/builder.vala | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 319006d..9bcefe1 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -1232,6 +1232,19 @@ namespace Wixl {
             } else
                 throw new Wixl.Error.FAILED ("Unsupported CustomAction");
 
+            if (action.Execute == "firstSequence")
+                type |= CustomActionType.FIRST_SEQUENCE;
+            else if (action.Execute == "oncePerProcess")
+                type |= CustomActionType.ONCE_PER_PROCESS;
+            else if (action.Execute == "clientRepeat")
+                type |= CustomActionType.CLIENT_REPEAT;
+            else if (action.Execute == "deferred")
+                type |= CustomActionType.IN_SCRIPT;
+            else if (action.Execute == "rollback")
+                type |= CustomActionType.IN_SCRIPT | CustomActionType.ROLLBACK;
+            else if (action.Execute == "commit")
+                type |= CustomActionType.IN_SCRIPT | CustomActionType.COMMIT;
+
             if (action.Return == "ignore")
                 type |= CustomActionType.CONTINUE;
             else if (action.Return == "asyncWait")
@@ -1240,9 +1253,8 @@ namespace Wixl {
                 type |= CustomActionType.CONTINUE;
                 type |= CustomActionType.ASYNC;
             }
-            if (action.Execute == "deferred")
-                type |= CustomActionType.IN_SCRIPT;
-            if (!parse_yesno (action.Impersonate))
+
+            if ((type & CustomActionType.IN_SCRIPT) == CustomActionType.IN_SCRIPT && !parse_yesno 
(action.Impersonate))
                 type |= CustomActionType.NO_IMPERSONATE;
 
             db.table_custom_action.add (action.Id, type, source, target);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]