diff --git a/src/ext/Util/ca/scagroup.cpp b/src/ext/Util/ca/scagroup.cpp index 3d2c3bebe..699d9db7e 100644 --- a/src/ext/Util/ca/scagroup.cpp +++ b/src/ext/Util/ca/scagroup.cpp @@ -553,7 +553,14 @@ HRESULT ScaGroupExecute( // // Schedule the creation now. // - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"CreateGroup"), pwzActionData, COST_GROUP_ADD); + if (psg->wzDomain && *psg->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"CreateDomainGroup"), pwzActionData, COST_GROUP_ADD); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"CreateGroup"), pwzActionData, COST_GROUP_ADD); + } ExitOnFailure(hr, "failed to schedule CreateGroup"); } else if (((GROUP_EXISTS_YES == geGroupExists) @@ -569,7 +576,14 @@ HRESULT ScaGroupExecute( // // Note: We can't rollback the removal of a group which is why RemoveGroup is a commit // CustomAction. - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroup"), pwzActionData, COST_GROUP_DELETE); + if (psg->wzDomain && *psg->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveDomainGroup"), pwzActionData, COST_GROUP_DELETE); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroup"), pwzActionData, COST_GROUP_DELETE); + } ExitOnFailure(hr, "failed to schedule RemoveGroup"); } @@ -641,7 +655,15 @@ HRESULT ScaGroupMembershipRemoveParentsExecute( ExitOnFailure(hr, "Failed to add child group domain to custom action data: %ls", psg->wzDomain); hr = WcaWriteIntegerToCaData(psg->iAttributes, &pwzActionData); ExitOnFailure(hr, "Failed to add group attributes to custom action data: %i", psg->iAttributes); - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + + if (psgp->wzDomain && *psgp->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveDomainGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + } LExit: ReleaseNullStr(pwzActionData); @@ -680,7 +702,14 @@ HRESULT ScaGroupMembershipRemoveChildrenExecute( ExitOnFailure(hr, "Failed to add child group domain to custom action data: %ls", psgc->wzDomain); hr = WcaWriteIntegerToCaData(psg->iAttributes, &pwzActionData); ExitOnFailure(hr, "Failed to add group attributes to custom action data: %i", psg->iAttributes); - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + if (psg->wzDomain && *psg->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveDomainGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"RemoveGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_DELETE); + } LExit: ReleaseNullStr(pwzActionData); @@ -748,7 +777,14 @@ HRESULT ScaGroupMembershipAddParentsExecute( ExitOnFailure(hr, "Failed to add child group domain to custom action data: %ls", psg->wzDomain); hr = WcaWriteIntegerToCaData(psg->iAttributes, &pwzActionData); ExitOnFailure(hr, "Failed to add group attributes to custom action data: %i", psg->iAttributes); - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + if (psgp->wzDomain&&* psgp->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddDomainGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + } LExit: ReleaseNullStr(pwzActionData); @@ -790,7 +826,14 @@ HRESULT ScaGroupMembershipAddChildrenExecute( ExitOnFailure(hr, "Failed to add parent group domain to custom action data: %ls", psgc->wzDomain); hr = WcaWriteIntegerToCaData(psg->iAttributes, &pwzActionData); ExitOnFailure(hr, "Failed to add group attributes to custom action data: %i", psg->iAttributes); - hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + if (psg->wzDomain && *psg->wzDomain) + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddDomainGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + } + else + { + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION6(L"AddGroupMembership"), pwzActionData, COST_GROUPMEMBERSHIP_ADD); + } LExit: ReleaseNullStr(pwzActionData); diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index c9a184ab8..ad56a32d3 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs @@ -405,8 +405,11 @@ public void CanCreateUserGroupWithComment() { "Binary:Wix4UtilCA_X64\t[Binary data]", "CustomAction:Wix6ConfigureGroups_X64\t1\tWix4UtilCA_X64\tConfigureGroups\t", + "CustomAction:Wix6CreateDomainGroup_X64\t1025\tWix4UtilCA_X64\tCreateGroup\t", + "CustomAction:Wix6CreateDomainGroupRollback_X64\t1281\tWix4UtilCA_X64\tCreateGroupRollback\t", "CustomAction:Wix6CreateGroup_X64\t3073\tWix4UtilCA_X64\tCreateGroup\t", "CustomAction:Wix6CreateGroupRollback_X64\t3329\tWix4UtilCA_X64\tCreateGroupRollback\t", + "CustomAction:Wix6RemoveDomainGroup_X64\t1601\tWix4UtilCA_X64\tRemoveGroup\t", "CustomAction:Wix6RemoveGroup_X64\t3649\tWix4UtilCA_X64\tRemoveGroup\t", "Wix4Group:TEST_GROUP00\tComponent1\ttestName00\t", "Wix4Group:TEST_GROUP01\tComponent1\ttestName01\t", diff --git a/src/ext/Util/wixlib/UtilExtension.wxs b/src/ext/Util/wixlib/UtilExtension.wxs index f459d51af..a52d60cc1 100644 --- a/src/ext/Util/wixlib/UtilExtension.wxs +++ b/src/ext/Util/wixlib/UtilExtension.wxs @@ -22,7 +22,7 @@ - + diff --git a/src/ext/Util/wixlib/UtilExtension_Platform.wxi b/src/ext/Util/wixlib/UtilExtension_Platform.wxi index 71166d4fc..d28c8df93 100644 --- a/src/ext/Util/wixlib/UtilExtension_Platform.wxi +++ b/src/ext/Util/wixlib/UtilExtension_Platform.wxi @@ -1,4 +1,4 @@ - + @@ -139,17 +139,26 @@ + + + + + - + + + + + diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs index 15328cb32..c27eb27aa 100644 --- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs +++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs @@ -7,12 +7,11 @@ - - + - +