@joebigelow / wix / commits / 8016c4dd

Tame some wild pointers.

Maybe Rust wouldn't be so bad... Fixes https://github.com/wixtoolset/issues/issues/7451.

Bob Arnson committed May 1, 2023 at 21:09 UTC 8016c4dd39fe1f8816c968952a2aac5a98c09560
2 files changed +16 -5
src/burn/engine/bundlepackageengine.cpp
+4 -4
@@ -151,7 +151,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes(
151 hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(prgsczDetectCodes), *pcDetectCodes, 1, sizeof(LPWSTR), 5);
152 ExitOnFailure(hr, "Failed to resize Detect code array");
153
154 - *prgsczDetectCodes[*pcDetectCodes] = sczId;
154 + (*prgsczDetectCodes)[*pcDetectCodes] = sczId;
155 sczId = NULL;
156 *pcDetectCodes += 1;
157 }
@@ -160,7 +160,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes(
160 hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(prgsczUpgradeCodes), *pcUpgradeCodes, 1, sizeof(LPWSTR), 5);
161 ExitOnFailure(hr, "Failed to resize Upgrade code array");
162
163 - *prgsczUpgradeCodes[*pcUpgradeCodes] = sczId;
163 + (*prgsczUpgradeCodes)[*pcUpgradeCodes] = sczId;
164 sczId = NULL;
165 *pcUpgradeCodes += 1;
166 }
@@ -169,7 +169,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes(
169 hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(prgsczAddonCodes), *pcAddonCodes, 1, sizeof(LPWSTR), 5);
170 ExitOnFailure(hr, "Failed to resize Addon code array");
171
172 - *prgsczAddonCodes[*pcAddonCodes] = sczId;
172 + (*prgsczAddonCodes)[*pcAddonCodes] = sczId;
173 sczId = NULL;
174 *pcAddonCodes += 1;
175 }
@@ -178,7 +178,7 @@ extern "C" HRESULT BundlePackageEngineParseRelatedCodes(
178 hr = MemEnsureArraySizeForNewItems(reinterpret_cast<LPVOID*>(prgsczPatchCodes), *pcPatchCodes, 1, sizeof(LPWSTR), 5);
179 ExitOnFailure(hr, "Failed to resize Patch code array");
180
181 - *prgsczPatchCodes[*pcPatchCodes] = sczId;
181 + (*prgsczPatchCodes)[*pcPatchCodes] = sczId;
182 sczId = NULL;
183 *pcPatchCodes += 1;
184 }
src/test/burn/TestData/DependencyTests/BundleF/BundleF.wxs
+12 -1
@@ -3,7 +3,18 @@
3 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:fortestinguseonly="http://wixtoolset.org/schemas/v4/wxs/fortestinguseonly">
4 <Fragment>
5 <fortestinguseonly:ForTestingUseOnlyBundle Id="{5E9D5B04-41EA-4196-954C-1F7357C31FB0}" />
6 - <RelatedBundle Id="583B5ECB-04E6-4837-A30C-A1ADCBE24235" Action="detect" />
6 + <RelatedBundle Id="{AAAAAAAA-0000-0000-0000-000000000000}" Action="addon" />
7 + <RelatedBundle Id="{BBBBBBBB-0000-0000-0000-000000000000}" Action="patch" />
8 + <RelatedBundle Id="{CCCCCCCC-0000-0000-0000-000000000000}" Action="upgrade" />
9 + <RelatedBundle Id="{DDDDDDDD-0000-0000-0000-000000000000}" Action="detect" />
10 + <RelatedBundle Id="{AAAAAAAA-1111-0000-0000-000000000000}" Action="addon" />
11 + <RelatedBundle Id="{BBBBBBBB-1111-0000-0000-000000000000}" Action="patch" />
12 + <RelatedBundle Id="{CCCCCCCC-1111-0000-0000-000000000000}" Action="upgrade" />
13 + <RelatedBundle Id="{DDDDDDDD-1111-0000-0000-000000000000}" Action="detect" />
14 + <RelatedBundle Id="{AAAAAAAA-2222-0000-0000-000000000000}" Action="addon" />
15 + <RelatedBundle Id="{BBBBBBBB-2222-0000-0000-000000000000}" Action="patch" />
16 + <RelatedBundle Id="{CCCCCCCC-2222-0000-0000-000000000000}" Action="upgrade" />
17 + <RelatedBundle Id="{DDDDDDDD-2222-0000-0000-000000000000}" Action="detect" />
18
19 <PackageGroup Id="BundlePackages">
20 <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv1.TargetPath)" />