diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-15 17:36:45 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-22 20:25:06 -0600 |
| commit | dbd55be5e707f07eb044c8c7f13c3dfd246148c0 (patch) | |
| tree | 3c1628524caf1e64f4a8aafc917988424977ba02 /src/engine/core.cpp | |
| parent | b6862716cd27cefa541b85c63dd30dc3f0749d87 (diff) | |
| download | wix-dbd55be5e707f07eb044c8c7f13c3dfd246148c0.tar.gz wix-dbd55be5e707f07eb044c8c7f13c3dfd246148c0.tar.bz2 wix-dbd55be5e707f07eb044c8c7f13c3dfd246148c0.zip | |
Initialize exe package ancestors during CoreInitialize instead of Plan.
Diffstat (limited to 'src/engine/core.cpp')
| -rw-r--r-- | src/engine/core.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/src/engine/core.cpp b/src/engine/core.cpp index 0ece3f44..b90d4b92 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp | |||
| @@ -104,9 +104,9 @@ extern "C" HRESULT CoreInitialize( | |||
| 104 | ExitOnFailure(hr, "Failed to parse command line."); | 104 | ExitOnFailure(hr, "Failed to parse command line."); |
| 105 | 105 | ||
| 106 | LogId(REPORT_STANDARD, MSG_BURN_COMMAND_LINE, sczSanitizedCommandLine ? sczSanitizedCommandLine : L""); | 106 | LogId(REPORT_STANDARD, MSG_BURN_COMMAND_LINE, sczSanitizedCommandLine ? sczSanitizedCommandLine : L""); |
| 107 | 107 | ||
| 108 | hr = DependencyInitialize(&pEngineState->registration, pEngineState->sczIgnoreDependencies); | 108 | hr = CoreInitializeConstants(pEngineState); |
| 109 | ExitOnFailure(hr, "Failed to initialize dependency data."); | 109 | ExitOnFailure(hr, "Failed to initialize contants."); |
| 110 | 110 | ||
| 111 | // Retain whether bundle was initially run elevated. | 111 | // Retain whether bundle was initially run elevated. |
| 112 | ProcElevated(::GetCurrentProcess(), &fElevated); | 112 | ProcElevated(::GetCurrentProcess(), &fElevated); |
| @@ -173,6 +173,43 @@ LExit: | |||
| 173 | return hr; | 173 | return hr; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | extern "C" HRESULT CoreInitializeConstants( | ||
| 177 | __in BURN_ENGINE_STATE* pEngineState | ||
| 178 | ) | ||
| 179 | { | ||
| 180 | HRESULT hr = S_OK; | ||
| 181 | BURN_REGISTRATION* pRegistration = &pEngineState->registration; | ||
| 182 | |||
| 183 | hr = DependencyInitialize(pRegistration, pEngineState->sczIgnoreDependencies); | ||
| 184 | ExitOnFailure(hr, "Failed to initialize dependency data."); | ||
| 185 | |||
| 186 | // Support passing Ancestors to embedded burn bundles. | ||
| 187 | if (pRegistration->sczAncestors && *pRegistration->sczAncestors) | ||
| 188 | { | ||
| 189 | hr = StrAllocFormatted(&pRegistration->sczBundlePackageAncestors, L"%ls;%ls", pRegistration->sczAncestors, pRegistration->sczId); | ||
| 190 | ExitOnFailure(hr, "Failed to copy ancestors and self to bundle package ancestors."); | ||
| 191 | } | ||
| 192 | else | ||
| 193 | { | ||
| 194 | hr = StrAllocString(&pRegistration->sczBundlePackageAncestors, pRegistration->sczId, 0); | ||
| 195 | ExitOnFailure(hr, "Failed to copy self to bundle package ancestors."); | ||
| 196 | } | ||
| 197 | |||
| 198 | for (DWORD i = 0; i < pEngineState->packages.cPackages; ++i) | ||
| 199 | { | ||
| 200 | BURN_PACKAGE* pPackage = pEngineState->packages.rgPackages + i; | ||
| 201 | |||
| 202 | if (BURN_PACKAGE_TYPE_EXE == pPackage->type && BURN_EXE_PROTOCOL_TYPE_BURN == pPackage->Exe.protocol) // TODO: Don't assume exePackages with burn protocol are bundles. | ||
| 203 | { | ||
| 204 | // Pass along any ancestors and ourself to prevent infinite loops. | ||
| 205 | pPackage->Exe.wzAncestors = pRegistration->sczBundlePackageAncestors; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | LExit: | ||
| 210 | return hr; | ||
| 211 | } | ||
| 212 | |||
| 176 | extern "C" HRESULT CoreSerializeEngineState( | 213 | extern "C" HRESULT CoreSerializeEngineState( |
| 177 | __in BURN_ENGINE_STATE* pEngineState, | 214 | __in BURN_ENGINE_STATE* pEngineState, |
| 178 | __inout BYTE** ppbBuffer, | 215 | __inout BYTE** ppbBuffer, |
