@joebigelow / wix-1 / commits / 44c2ca03

Move the logic of a bundle registering as a system component into Burn.

Sean Hall committed Apr 4, 2022 at 14:43 UTC 44c2ca035c1a5d52a6b3299ba3abbb8b88f7f1c0
7 files changed +40 -19
src/burn/engine/registration.cpp
+9 -8
@@ -169,10 +169,6 @@ extern "C" HRESULT RegistrationParseFromXml(
169
170 if (fFoundXml)
171 {
172 - // @Register
173 - hr = XmlGetYesNoAttribute(pixnArpNode, L"Register", &pRegistration->fRegisterArp);
174 - ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Register.");
175 -
172 // @DisplayName
173 hr = XmlGetAttributeEx(pixnArpNode, L"DisplayName", &pRegistration->sczDisplayName);
174 ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @DisplayName.");
@@ -247,7 +243,12 @@ extern "C" HRESULT RegistrationParseFromXml(
243
244 // @DisableRemove
245 hr = XmlGetYesNoAttribute(pixnArpNode, L"DisableRemove", &pRegistration->fNoRemove);
250 - ExitOnOptionalXmlQueryFailure(hr, pRegistration->fNoRemoveDefined, "Failed to get @DisableRemove.");
246 + ExitOnOptionalXmlQueryFailure(hr, fFoundXml, "Failed to get @DisableRemove.");
247 + }
248 +
249 + if (pRegistration->fNoRemove && BURN_REGISTRATION_MODIFY_ENABLED != pRegistration->modify)
250 + {
251 + pRegistration->fForceSystemComponent = TRUE;
252 }
253
254 hr = ParseSoftwareTagsFromXml(pixnRegistrationNode, &pRegistration->softwareTags.rgSoftwareTags, &pRegistration->softwareTags.cSoftwareTags);
@@ -759,14 +760,14 @@ extern "C" HRESULT RegistrationSessionBegin(
760 }
761
762 // NoRemove: should this be allowed?
762 - if (pRegistration->fNoRemoveDefined)
763 + if (pRegistration->fNoRemove)
764 {
764 - hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, (DWORD)pRegistration->fNoRemove);
765 + hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_NO_REMOVE, 1);
766 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_NO_REMOVE);
767 }
768
769 // Conditionally hide the ARP entry.
769 - if (!pRegistration->fRegisterArp)
770 + if (pRegistration->fForceSystemComponent)
771 {
772 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1);
773 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
src/burn/engine/registration.h
+1 -2
@@ -95,7 +95,7 @@ typedef struct _BURN_SOFTWARE_TAGS
95 typedef struct _BURN_REGISTRATION
96 {
97 BOOL fPerMachine;
98 - BOOL fRegisterArp;
98 + BOOL fForceSystemComponent;
99 BOOL fDisableResume;
100 BOOL fCached;
101 BOOTSTRAPPER_REGISTRATION_TYPE detectedRegistrationType;
@@ -140,7 +140,6 @@ typedef struct _BURN_REGISTRATION
140 LPWSTR sczContact;
141 //DWORD64 qwEstimatedSize; // TODO: size should come from disk cost calculation
142 BURN_REGISTRATION_MODIFY_TYPE modify;
143 - BOOL fNoRemoveDefined;
143 BOOL fNoRemove;
144
145 BURN_SOFTWARE_TAGS softwareTags;
src/burn/test/BurnUnitTest/PlanTest.cpp
+22
@@ -71,6 +71,7 @@ namespace Bootstrapper
71 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
72 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
73 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
74 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
75
76 BOOL fRollback = FALSE;
77 DWORD dwIndex = 0;
@@ -231,6 +232,7 @@ namespace Bootstrapper
232 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
233 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
234 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
235 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
236
237 BOOL fRollback = FALSE;
238 DWORD dwIndex = 0;
@@ -364,6 +366,7 @@ namespace Bootstrapper
366 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
367 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
368 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
369 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
370
371 BOOL fRollback = FALSE;
372 DWORD dwIndex = 0;
@@ -479,6 +482,7 @@ namespace Bootstrapper
482 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
483 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
484 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
485 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
486
487 BOOL fRollback = FALSE;
488 DWORD dwIndex = 0;
@@ -579,6 +583,7 @@ namespace Bootstrapper
583 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
584 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
585 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
586 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
587
588 BOOL fRollback = FALSE;
589 DWORD dwIndex = 0;
@@ -698,6 +703,7 @@ namespace Bootstrapper
703 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
704 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
705 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
706 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
707
708 BOOL fRollback = FALSE;
709 DWORD dwIndex = 0;
@@ -800,6 +806,7 @@ namespace Bootstrapper
806 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
807 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
808 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
809 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
810
811 BOOL fRollback = FALSE;
812 DWORD dwIndex = 0;
@@ -894,6 +901,7 @@ namespace Bootstrapper
901 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
902 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
903 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
904 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
905
906 BOOL fRollback = FALSE;
907 DWORD dwIndex = 0;
@@ -983,6 +991,7 @@ namespace Bootstrapper
991 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
992 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
993 Assert::Equal<BOOL>(TRUE, pPlan->fDowngrade);
994 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_NONE, pPlan->dwRegistrationOperations);
995
996 BOOL fRollback = FALSE;
997 DWORD dwIndex = 0;
@@ -1058,6 +1067,7 @@ namespace Bootstrapper
1067 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1068 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1069 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1070 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1071
1072 BOOL fRollback = FALSE;
1073 DWORD dwIndex = 0;
@@ -1147,6 +1157,7 @@ namespace Bootstrapper
1157 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1158 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1159 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1160 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1161
1162 BOOL fRollback = FALSE;
1163 DWORD dwIndex = 0;
@@ -1238,6 +1249,7 @@ namespace Bootstrapper
1249 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1250 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1251 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1252 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1253
1254 BOOL fRollback = FALSE;
1255 DWORD dwIndex = 0;
@@ -1344,6 +1356,7 @@ namespace Bootstrapper
1356 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1357 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1358 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1359 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1360
1361 BOOL fRollback = FALSE;
1362 DWORD dwIndex = 0;
@@ -1423,6 +1436,7 @@ namespace Bootstrapper
1436 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1437 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1438 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1439 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1440
1441 BOOL fRollback = FALSE;
1442 DWORD dwIndex = 0;
@@ -1518,6 +1532,7 @@ namespace Bootstrapper
1532 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1533 Assert::Equal<BOOL>(TRUE, pPlan->fDisallowRemoval);
1534 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1535 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1536
1537 BOOL fRollback = FALSE;
1538 DWORD dwIndex = 0;
@@ -1588,6 +1603,7 @@ namespace Bootstrapper
1603 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1604 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1605 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1606 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1607
1608 BOOL fRollback = FALSE;
1609 DWORD dwIndex = 0;
@@ -1672,6 +1688,7 @@ namespace Bootstrapper
1688 Assert::Equal<BOOL>(TRUE, pPlan->fDisableRollback);
1689 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1690 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1691 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1692
1693 BOOL fRollback = FALSE;
1694 DWORD dwIndex = 0;
@@ -1767,6 +1784,7 @@ namespace Bootstrapper
1784 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1785 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1786 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1787 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1788
1789 BOOL fRollback = FALSE;
1790 DWORD dwIndex = 0;
@@ -1861,6 +1879,7 @@ namespace Bootstrapper
1879 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
1880 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
1881 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
1882 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
1883
1884 BOOL fRollback = FALSE;
1885 DWORD dwIndex = 0;
@@ -1992,6 +2011,7 @@ namespace Bootstrapper
2011 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
2012 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
2013 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
2014 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
2015
2016 BOOL fRollback = FALSE;
2017 DWORD dwIndex = 0;
@@ -2108,6 +2128,7 @@ namespace Bootstrapper
2128 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
2129 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
2130 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
2131 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
2132
2133 BOOL fRollback = FALSE;
2134 DWORD dwIndex = 0;
@@ -2203,6 +2224,7 @@ namespace Bootstrapper
2224 Assert::Equal<BOOL>(FALSE, pPlan->fDisableRollback);
2225 Assert::Equal<BOOL>(FALSE, pPlan->fDisallowRemoval);
2226 Assert::Equal<BOOL>(FALSE, pPlan->fDowngrade);
2227 + Assert::Equal<DWORD>(BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE | BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_PROVIDER_KEY, pPlan->dwRegistrationOperations);
2228
2229 BOOL fRollback = FALSE;
2230 DWORD dwIndex = 0;
src/wix/WixToolset.Core.Burn/Bundles/CreateBurnManifestCommand.cs
+4 -5
@@ -208,7 +208,6 @@ namespace WixToolset.Core.Burn.Bundles
208 writer.WriteAttributeString("ProviderKey", this.BundleSymbol.ProviderKey);
209
210 writer.WriteStartElement("Arp");
211 - writer.WriteAttributeString("Register", (this.BundleSymbol.DisableModify || this.BundleSymbol.SingleChangeUninstallButton) && this.BundleSymbol.DisableRemove ? "no" : "yes"); // do not register if disabled modify and remove.
211 writer.WriteAttributeString("DisplayName", this.BundleSymbol.Name);
212 writer.WriteAttributeString("DisplayVersion", this.BundleSymbol.Version);
213
@@ -251,16 +250,16 @@ namespace WixToolset.Core.Burn.Bundles
250 {
251 writer.WriteAttributeString("DisableModify", "yes");
252 }
253 + else if (this.BundleSymbol.SingleChangeUninstallButton)
254 + {
255 + writer.WriteAttributeString("DisableModify", "button");
256 + }
257
258 if (this.BundleSymbol.DisableRemove)
259 {
260 writer.WriteAttributeString("DisableRemove", "yes");
261 }
262
260 - if (this.BundleSymbol.SingleChangeUninstallButton)
261 - {
262 - writer.WriteAttributeString("DisableModify", "button");
263 - }
263 writer.WriteEndElement(); // </Arp>
264
265 // Get update registration if specified.
src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+1 -1
@@ -120,7 +120,7 @@ namespace WixToolsetTest.CoreIntegration
120 var registrationElements = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Registration");
121 var registrationElement = (XmlNode)Assert.Single(registrationElements);
122 Assert.Equal($"<Registration Id='{bundleSymbol.BundleId}' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='{bundleSymbol.BundleId}'>" +
123 - "<Arp Register='yes' DisplayName='~TestBundle' DisplayVersion='1.0.0.0' InProgressDisplayName='~InProgressTestBundle' Publisher='Example Corporation' />" +
123 + "<Arp DisplayName='~TestBundle' DisplayVersion='1.0.0.0' InProgressDisplayName='~InProgressTestBundle' Publisher='Example Corporation' />" +
124 "</Registration>", registrationElement.GetTestXml());
125
126 var msiPayloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Payload[@Id='test.msi']");
src/wix/test/WixToolsetTest.CoreIntegration/BundlePackageFixture.cs
+2 -2
@@ -109,7 +109,7 @@ namespace WixToolsetTest.CoreIntegration
109 WixAssert.CompareLineByLine(new string[]
110 {
111 $"<Registration Id='{parentBundleId}' ExecutableName='parent.exe' PerMachine='yes' Tag='' Version='1.0.1.0' ProviderKey='{parentBundleId}'>" +
112 - "<Arp Register='yes' DisplayName='BundlePackageBundle' DisplayVersion='1.0.1.0' Publisher='Example Corporation' />" +
112 + "<Arp DisplayName='BundlePackageBundle' DisplayVersion='1.0.1.0' Publisher='Example Corporation' />" +
113 "</Registration>"
114 }, registrations);
115
@@ -196,7 +196,7 @@ namespace WixToolsetTest.CoreIntegration
196 WixAssert.CompareLineByLine(new string[]
197 {
198 $"<Registration Id='{parentBundleId}' ExecutableName='parent.exe' PerMachine='yes' Tag='' Version='1.1.1.1' ProviderKey='{parentBundleId}'>" +
199 - "<Arp Register='yes' DisplayName='V3BundlePackageBundle' DisplayVersion='1.1.1.1' Publisher='Example Corporation' />" +
199 + "<Arp DisplayName='V3BundlePackageBundle' DisplayVersion='1.1.1.1' Publisher='Example Corporation' />" +
200 "</Registration>"
201 }, registrations);
202
src/wix/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs
+1 -1
@@ -152,7 +152,7 @@ namespace WixToolsetTest.CoreIntegration
152 .ToArray();
153 WixAssert.CompareLineByLine(new string[]
154 {
155 - "<Registration Id='*' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='MyProviderKey,v1.0'><Arp Register='yes' DisplayName='BurnBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' /></Registration>",
155 + "<Registration Id='*' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='MyProviderKey,v1.0'><Arp DisplayName='BurnBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' /></Registration>",
156 }, registration);
157 }
158 }