diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-06-09 11:30:46 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-06-09 13:47:53 -0500 |
commit | 56105916271ff9a7c0bfa237b45b9b3fab9c570b (patch) | |
tree | 828aff9543e541b42ed45198e6bd3e0aa065c137 /src/burn | |
parent | d47c73dbcd0a314cf3346b9b1294063ed4a124c4 (diff) | |
download | wix-56105916271ff9a7c0bfa237b45b9b3fab9c570b.tar.gz wix-56105916271ff9a7c0bfa237b45b9b3fab9c570b.tar.bz2 wix-56105916271ff9a7c0bfa237b45b9b3fab9c570b.zip |
Fix building and perf for bundles with 1000s of package and BA payloads
Fixes other half of #5300
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/engine/apply.cpp | 2 | ||||
-rw-r--r-- | src/burn/engine/burnextension.cpp | 11 | ||||
-rw-r--r-- | src/burn/engine/burnextension.h | 1 | ||||
-rw-r--r-- | src/burn/engine/container.cpp | 3 | ||||
-rw-r--r-- | src/burn/engine/container.h | 3 | ||||
-rw-r--r-- | src/burn/engine/manifest.h | 2 | ||||
-rw-r--r-- | src/burn/engine/payload.cpp | 80 | ||||
-rw-r--r-- | src/burn/engine/payload.h | 3 | ||||
-rw-r--r-- | src/burn/engine/userexperience.h | 2 |
9 files changed, 54 insertions, 53 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index a99a3987..c126d63c 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
@@ -1175,7 +1175,7 @@ static HRESULT ExtractContainer( | |||
1175 | { | 1175 | { |
1176 | BOOL fExtracted = FALSE; | 1176 | BOOL fExtracted = FALSE; |
1177 | 1177 | ||
1178 | hr = PayloadFindEmbeddedBySourcePath(pContext->pPayloads, sczStreamName, &pExtract); | 1178 | hr = PayloadFindEmbeddedBySourcePath(pContainer->sdhPayloads, sczStreamName, &pExtract); |
1179 | if (E_NOTFOUND != hr) | 1179 | if (E_NOTFOUND != hr) |
1180 | { | 1180 | { |
1181 | ExitOnFailure(hr, "Failed to find embedded payload by source path: %ls container: %ls", sczStreamName, pContainer->sczId); | 1181 | ExitOnFailure(hr, "Failed to find embedded payload by source path: %ls container: %ls", sczStreamName, pContainer->sczId); |
diff --git a/src/burn/engine/burnextension.cpp b/src/burn/engine/burnextension.cpp index 475df1c5..ee4b1542 100644 --- a/src/burn/engine/burnextension.cpp +++ b/src/burn/engine/burnextension.cpp | |||
@@ -26,6 +26,7 @@ EXTERN_C HRESULT BurnExtensionParseFromXml( | |||
26 | IXMLDOMNodeList* pixnNodes = NULL; | 26 | IXMLDOMNodeList* pixnNodes = NULL; |
27 | IXMLDOMNode* pixnNode = NULL; | 27 | IXMLDOMNode* pixnNode = NULL; |
28 | DWORD cNodes = 0; | 28 | DWORD cNodes = 0; |
29 | LPWSTR scz = NULL; | ||
29 | 30 | ||
30 | // Select BundleExtension nodes. | 31 | // Select BundleExtension nodes. |
31 | hr = XmlSelectNodes(pixnBundle, L"BundleExtension", &pixnNodes); | 32 | hr = XmlSelectNodes(pixnBundle, L"BundleExtension", &pixnNodes); |
@@ -59,11 +60,11 @@ EXTERN_C HRESULT BurnExtensionParseFromXml( | |||
59 | ExitOnFailure(hr, "Failed to get @Id."); | 60 | ExitOnFailure(hr, "Failed to get @Id."); |
60 | 61 | ||
61 | // @EntryPayloadId | 62 | // @EntryPayloadId |
62 | hr = XmlGetAttributeEx(pixnNode, L"EntryPayloadId", &pExtension->sczEntryPayloadId); | 63 | hr = XmlGetAttributeEx(pixnNode, L"EntryPayloadSourcePath", &scz); |
63 | ExitOnFailure(hr, "Failed to get @EntryPayloadId."); | 64 | ExitOnFailure(hr, "Failed to get @EntryPayloadSourcePath."); |
64 | 65 | ||
65 | hr = PayloadFindById(pBaPayloads, pExtension->sczEntryPayloadId, &pExtension->pEntryPayload); | 66 | hr = PayloadFindEmbeddedBySourcePath(pBaPayloads->sdhPayloads, scz, &pExtension->pEntryPayload); |
66 | ExitOnFailure(hr, "Failed to find BundleExtension EntryPayload '%ls'.", pExtension->sczEntryPayloadId); | 67 | ExitOnFailure(hr, "Failed to find BundleExtension EntryPayload '%ls'.", pExtension->sczId); |
67 | 68 | ||
68 | // prepare next iteration | 69 | // prepare next iteration |
69 | ReleaseNullObject(pixnNode); | 70 | ReleaseNullObject(pixnNode); |
@@ -72,6 +73,7 @@ EXTERN_C HRESULT BurnExtensionParseFromXml( | |||
72 | hr = S_OK; | 73 | hr = S_OK; |
73 | 74 | ||
74 | LExit: | 75 | LExit: |
76 | ReleaseStr(scz); | ||
75 | ReleaseObject(pixnNode); | 77 | ReleaseObject(pixnNode); |
76 | ReleaseObject(pixnNodes); | 78 | ReleaseObject(pixnNodes); |
77 | 79 | ||
@@ -92,7 +94,6 @@ EXTERN_C void BurnExtensionUninitialize( | |||
92 | { | 94 | { |
93 | BURN_EXTENSION* pExtension = &pBurnExtensions->rgExtensions[i]; | 95 | BURN_EXTENSION* pExtension = &pBurnExtensions->rgExtensions[i]; |
94 | 96 | ||
95 | ReleaseStr(pExtension->sczEntryPayloadId); | ||
96 | ReleaseStr(pExtension->sczId); | 97 | ReleaseStr(pExtension->sczId); |
97 | } | 98 | } |
98 | MemFree(pBurnExtensions->rgExtensions); | 99 | MemFree(pBurnExtensions->rgExtensions); |
diff --git a/src/burn/engine/burnextension.h b/src/burn/engine/burnextension.h index 370ddd2d..3529ef38 100644 --- a/src/burn/engine/burnextension.h +++ b/src/burn/engine/burnextension.h | |||
@@ -13,7 +13,6 @@ typedef struct _BURN_EXTENSION_ENGINE_CONTEXT BURN_EXTENSION_ENGINE_CONTEXT; | |||
13 | 13 | ||
14 | typedef struct _BURN_EXTENSION | 14 | typedef struct _BURN_EXTENSION |
15 | { | 15 | { |
16 | LPWSTR sczEntryPayloadId; | ||
17 | LPWSTR sczId; | 16 | LPWSTR sczId; |
18 | 17 | ||
19 | BURN_PAYLOAD* pEntryPayload; | 18 | BURN_PAYLOAD* pEntryPayload; |
diff --git a/src/burn/engine/container.cpp b/src/burn/engine/container.cpp index c6f2ada8..aa123927 100644 --- a/src/burn/engine/container.cpp +++ b/src/burn/engine/container.cpp | |||
@@ -35,7 +35,7 @@ extern "C" HRESULT ContainersParseFromXml( | |||
35 | 35 | ||
36 | pContainers->cContainers = cNodes; | 36 | pContainers->cContainers = cNodes; |
37 | 37 | ||
38 | // parse search elements | 38 | // parse container elements |
39 | for (DWORD i = 0; i < cNodes; ++i) | 39 | for (DWORD i = 0; i < cNodes; ++i) |
40 | { | 40 | { |
41 | BURN_CONTAINER* pContainer = &pContainers->rgContainers[i]; | 41 | BURN_CONTAINER* pContainer = &pContainers->rgContainers[i]; |
@@ -181,6 +181,7 @@ extern "C" void ContainersUninitialize( | |||
181 | ReleaseStr(pContainer->downloadSource.sczUser); | 181 | ReleaseStr(pContainer->downloadSource.sczUser); |
182 | ReleaseStr(pContainer->downloadSource.sczPassword); | 182 | ReleaseStr(pContainer->downloadSource.sczPassword); |
183 | ReleaseStr(pContainer->sczUnverifiedPath); | 183 | ReleaseStr(pContainer->sczUnverifiedPath); |
184 | ReleaseDict(pContainer->sdhPayloads); | ||
184 | } | 185 | } |
185 | MemFree(pContainers->rgContainers); | 186 | MemFree(pContainers->rgContainers); |
186 | } | 187 | } |
diff --git a/src/burn/engine/container.h b/src/burn/engine/container.h index d454a248..f35f1da5 100644 --- a/src/burn/engine/container.h +++ b/src/burn/engine/container.h | |||
@@ -72,6 +72,9 @@ typedef struct _BURN_CONTAINER | |||
72 | LPWSTR sczFilePath; // relative path to container. | 72 | LPWSTR sczFilePath; // relative path to container. |
73 | DOWNLOAD_SOURCE downloadSource; | 73 | DOWNLOAD_SOURCE downloadSource; |
74 | 74 | ||
75 | DWORD cParsedPayloads; | ||
76 | STRINGDICT_HANDLE sdhPayloads; // value is BURN_PAYLOAD* | ||
77 | |||
75 | BYTE* pbHash; | 78 | BYTE* pbHash; |
76 | DWORD cbHash; | 79 | DWORD cbHash; |
77 | BURN_CONTAINER_VERIFICATION verification; | 80 | BURN_CONTAINER_VERIFICATION verification; |
diff --git a/src/burn/engine/manifest.h b/src/burn/engine/manifest.h index 8c527279..40748c52 100644 --- a/src/burn/engine/manifest.h +++ b/src/burn/engine/manifest.h | |||
@@ -2,8 +2,6 @@ | |||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
3 | 3 | ||
4 | 4 | ||
5 | interface IBurnPayload; // forward declare. | ||
6 | |||
7 | #if defined(__cplusplus) | 5 | #if defined(__cplusplus) |
8 | extern "C" { | 6 | extern "C" { |
9 | #endif | 7 | #endif |
diff --git a/src/burn/engine/payload.cpp b/src/burn/engine/payload.cpp index 84c32eec..e0362a76 100644 --- a/src/burn/engine/payload.cpp +++ b/src/burn/engine/payload.cpp | |||
@@ -5,13 +5,6 @@ | |||
5 | 5 | ||
6 | // internal function declarations | 6 | // internal function declarations |
7 | 7 | ||
8 | static HRESULT FindEmbeddedBySourcePath( | ||
9 | __in BURN_PAYLOADS* pPayloads, | ||
10 | __in_opt BURN_CONTAINER* pContainer, | ||
11 | __in_z LPCWSTR wzStreamName, | ||
12 | __out BURN_PAYLOAD** ppPayload | ||
13 | ); | ||
14 | |||
15 | 8 | ||
16 | // function definitions | 9 | // function definitions |
17 | 10 | ||
@@ -29,6 +22,7 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
29 | LPWSTR scz = NULL; | 22 | LPWSTR scz = NULL; |
30 | BOOL fChainPayload = pContainers && pLayoutPayloads; // These are required when parsing chain payloads. | 23 | BOOL fChainPayload = pContainers && pLayoutPayloads; // These are required when parsing chain payloads. |
31 | BOOL fValidFileSize = FALSE; | 24 | BOOL fValidFileSize = FALSE; |
25 | size_t cByteOffset = fChainPayload ? offsetof(BURN_PAYLOAD, sczKey) : offsetof(BURN_PAYLOAD, sczSourcePath); | ||
32 | 26 | ||
33 | // select payload nodes | 27 | // select payload nodes |
34 | hr = XmlSelectNodes(pixnBundle, L"Payload", &pixnNodes); | 28 | hr = XmlSelectNodes(pixnBundle, L"Payload", &pixnNodes); |
@@ -49,7 +43,11 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
49 | 43 | ||
50 | pPayloads->cPayloads = cNodes; | 44 | pPayloads->cPayloads = cNodes; |
51 | 45 | ||
52 | // parse search elements | 46 | // create dictionary for payloads |
47 | hr = DictCreateWithEmbeddedKey(&pPayloads->sdhPayloads, pPayloads->cPayloads, reinterpret_cast<void**>(&pPayloads->rgPayloads), cByteOffset, DICT_FLAG_NONE); | ||
48 | ExitOnFailure(hr, "Failed to create dictionary for payloads."); | ||
49 | |||
50 | // parse payload elements | ||
53 | for (DWORD i = 0; i < cNodes; ++i) | 51 | for (DWORD i = 0; i < cNodes; ++i) |
54 | { | 52 | { |
55 | BURN_PAYLOAD* pPayload = &pPayloads->rgPayloads[i]; | 53 | BURN_PAYLOAD* pPayload = &pPayloads->rgPayloads[i]; |
@@ -104,6 +102,8 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
104 | // find container | 102 | // find container |
105 | hr = ContainerFindById(pContainers, scz, &pPayload->pContainer); | 103 | hr = ContainerFindById(pContainers, scz, &pPayload->pContainer); |
106 | ExitOnFailure(hr, "Failed to to find container: %ls", scz); | 104 | ExitOnFailure(hr, "Failed to to find container: %ls", scz); |
105 | |||
106 | pPayload->pContainer->cParsedPayloads += 1; | ||
107 | } | 107 | } |
108 | 108 | ||
109 | // @LayoutOnly | 109 | // @LayoutOnly |
@@ -190,12 +190,37 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | hr = DictAddValue(pPayloads->sdhPayloads, pPayload); | ||
194 | ExitOnFailure(hr, "Failed to add payload to payloads dictionary."); | ||
195 | |||
193 | // prepare next iteration | 196 | // prepare next iteration |
194 | ReleaseNullObject(pixnNode); | 197 | ReleaseNullObject(pixnNode); |
195 | } | 198 | } |
196 | 199 | ||
197 | hr = S_OK; | 200 | hr = S_OK; |
198 | 201 | ||
202 | if (pContainers && pContainers->cContainers) | ||
203 | { | ||
204 | for (DWORD i = 0; i < pPayloads->cPayloads; ++i) | ||
205 | { | ||
206 | BURN_PAYLOAD* pPayload = &pPayloads->rgPayloads[i]; | ||
207 | BURN_CONTAINER* pContainer = pPayload->pContainer; | ||
208 | |||
209 | if (!pContainer) | ||
210 | { | ||
211 | continue; | ||
212 | } | ||
213 | else if (!pContainer->sdhPayloads) | ||
214 | { | ||
215 | hr = DictCreateWithEmbeddedKey(&pContainer->sdhPayloads, pContainer->cParsedPayloads, NULL, offsetof(BURN_PAYLOAD, sczSourcePath), DICT_FLAG_NONE); | ||
216 | ExitOnFailure(hr, "Failed to create dictionary for container payloads."); | ||
217 | } | ||
218 | |||
219 | hr = DictAddValue(pContainer->sdhPayloads, pPayload); | ||
220 | ExitOnFailure(hr, "Failed to add payload to container dictionary."); | ||
221 | } | ||
222 | } | ||
223 | |||
199 | LExit: | 224 | LExit: |
200 | ReleaseObject(pixnNodes); | 225 | ReleaseObject(pixnNodes); |
201 | ReleaseObject(pixnNode); | 226 | ReleaseObject(pixnNode); |
@@ -237,6 +262,8 @@ extern "C" void PayloadsUninitialize( | |||
237 | MemFree(pPayloads->rgPayloads); | 262 | MemFree(pPayloads->rgPayloads); |
238 | } | 263 | } |
239 | 264 | ||
265 | ReleaseDict(pPayloads->sdhPayloads); | ||
266 | |||
240 | // clear struct | 267 | // clear struct |
241 | memset(pPayloads, 0, sizeof(BURN_PAYLOADS)); | 268 | memset(pPayloads, 0, sizeof(BURN_PAYLOADS)); |
242 | } | 269 | } |
@@ -265,7 +292,7 @@ extern "C" HRESULT PayloadExtractUXContainer( | |||
265 | ExitOnFailure(hr, "Failed to get next stream."); | 292 | ExitOnFailure(hr, "Failed to get next stream."); |
266 | 293 | ||
267 | // find payload by stream name | 294 | // find payload by stream name |
268 | hr = PayloadFindEmbeddedBySourcePath(pPayloads, sczStreamName, &pPayload); | 295 | hr = PayloadFindEmbeddedBySourcePath(pPayloads->sdhPayloads, sczStreamName, &pPayload); |
269 | ExitOnFailure(hr, "Failed to find embedded payload: %ls", sczStreamName); | 296 | ExitOnFailure(hr, "Failed to find embedded payload: %ls", sczStreamName); |
270 | 297 | ||
271 | // make file path | 298 | // make file path |
@@ -313,51 +340,22 @@ extern "C" HRESULT PayloadFindById( | |||
313 | ) | 340 | ) |
314 | { | 341 | { |
315 | HRESULT hr = S_OK; | 342 | HRESULT hr = S_OK; |
316 | BURN_PAYLOAD* pPayload = NULL; | ||
317 | 343 | ||
318 | for (DWORD i = 0; i < pPayloads->cPayloads; ++i) | 344 | hr = DictGetValue(pPayloads->sdhPayloads, wzId, reinterpret_cast<void**>(ppPayload)); |
319 | { | ||
320 | pPayload = &pPayloads->rgPayloads[i]; | ||
321 | |||
322 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPayload->sczKey, -1, wzId, -1)) | ||
323 | { | ||
324 | *ppPayload = pPayload; | ||
325 | ExitFunction1(hr = S_OK); | ||
326 | } | ||
327 | } | ||
328 | 345 | ||
329 | hr = E_NOTFOUND; | ||
330 | |||
331 | LExit: | ||
332 | return hr; | 346 | return hr; |
333 | } | 347 | } |
334 | 348 | ||
335 | extern "C" HRESULT PayloadFindEmbeddedBySourcePath( | 349 | extern "C" HRESULT PayloadFindEmbeddedBySourcePath( |
336 | __in BURN_PAYLOADS* pPayloads, | 350 | __in STRINGDICT_HANDLE sdhPayloads, |
337 | __in_z LPCWSTR wzStreamName, | 351 | __in_z LPCWSTR wzStreamName, |
338 | __out BURN_PAYLOAD** ppPayload | 352 | __out BURN_PAYLOAD** ppPayload |
339 | ) | 353 | ) |
340 | { | 354 | { |
341 | HRESULT hr = S_OK; | 355 | HRESULT hr = S_OK; |
342 | BURN_PAYLOAD* pPayload = NULL; | ||
343 | 356 | ||
344 | for (DWORD i = 0; i < pPayloads->cPayloads; ++i) | 357 | hr = DictGetValue(sdhPayloads, wzStreamName, reinterpret_cast<void**>(ppPayload)); |
345 | { | ||
346 | pPayload = &pPayloads->rgPayloads[i]; | ||
347 | |||
348 | if (BURN_PAYLOAD_PACKAGING_EMBEDDED == pPayload->packaging) | ||
349 | { | ||
350 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pPayload->sczSourcePath, -1, wzStreamName, -1)) | ||
351 | { | ||
352 | *ppPayload = pPayload; | ||
353 | ExitFunction1(hr = S_OK); | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | 358 | ||
358 | hr = E_NOTFOUND; | ||
359 | |||
360 | LExit: | ||
361 | return hr; | 359 | return hr; |
362 | } | 360 | } |
363 | 361 | ||
diff --git a/src/burn/engine/payload.h b/src/burn/engine/payload.h index c12fbe66..14738506 100644 --- a/src/burn/engine/payload.h +++ b/src/burn/engine/payload.h | |||
@@ -66,6 +66,7 @@ typedef struct _BURN_PAYLOADS | |||
66 | { | 66 | { |
67 | BURN_PAYLOAD* rgPayloads; | 67 | BURN_PAYLOAD* rgPayloads; |
68 | DWORD cPayloads; | 68 | DWORD cPayloads; |
69 | STRINGDICT_HANDLE sdhPayloads; // value is BURN_PAYLOAD* | ||
69 | } BURN_PAYLOADS; | 70 | } BURN_PAYLOADS; |
70 | 71 | ||
71 | typedef struct _BURN_PAYLOAD_GROUP_ITEM | 72 | typedef struct _BURN_PAYLOAD_GROUP_ITEM |
@@ -109,7 +110,7 @@ HRESULT PayloadFindById( | |||
109 | __out BURN_PAYLOAD** ppPayload | 110 | __out BURN_PAYLOAD** ppPayload |
110 | ); | 111 | ); |
111 | HRESULT PayloadFindEmbeddedBySourcePath( | 112 | HRESULT PayloadFindEmbeddedBySourcePath( |
112 | __in BURN_PAYLOADS* pPayloads, | 113 | __in STRINGDICT_HANDLE sdhPayloads, |
113 | __in_z LPCWSTR wzStreamName, | 114 | __in_z LPCWSTR wzStreamName, |
114 | __out BURN_PAYLOAD** ppPayload | 115 | __out BURN_PAYLOAD** ppPayload |
115 | ); | 116 | ); |
diff --git a/src/burn/engine/userexperience.h b/src/burn/engine/userexperience.h index 6a5ae697..584bef14 100644 --- a/src/burn/engine/userexperience.h +++ b/src/burn/engine/userexperience.h | |||
@@ -15,7 +15,7 @@ const DWORD MB_RETRYTRYAGAIN = 0xF; | |||
15 | 15 | ||
16 | // structs | 16 | // structs |
17 | 17 | ||
18 | typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT; | 18 | typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT; // forward declare |
19 | 19 | ||
20 | typedef struct _BURN_USER_EXPERIENCE | 20 | typedef struct _BURN_USER_EXPERIENCE |
21 | { | 21 | { |