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 | |
| 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')
| -rw-r--r-- | src/engine/core.cpp | 43 | ||||
| -rw-r--r-- | src/engine/core.h | 3 | ||||
| -rw-r--r-- | src/engine/exeengine.cpp | 9 | ||||
| -rw-r--r-- | src/engine/package.h | 2 | ||||
| -rw-r--r-- | src/engine/plan.cpp | 29 | ||||
| -rw-r--r-- | src/engine/pseudobundle.cpp | 4 | ||||
| -rw-r--r-- | src/engine/pseudobundle.h | 4 | ||||
| -rw-r--r-- | src/engine/registration.cpp | 1 | ||||
| -rw-r--r-- | src/engine/registration.h | 1 | ||||
| -rw-r--r-- | src/test/BurnUnitTest/PlanTest.cpp | 3 |
10 files changed, 58 insertions, 41 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, |
diff --git a/src/engine/core.h b/src/engine/core.h index f23738c3..d98c7646 100644 --- a/src/engine/core.h +++ b/src/engine/core.h | |||
| @@ -138,6 +138,9 @@ typedef struct _BURN_ENGINE_STATE | |||
| 138 | HRESULT CoreInitialize( | 138 | HRESULT CoreInitialize( |
| 139 | __in BURN_ENGINE_STATE* pEngineState | 139 | __in BURN_ENGINE_STATE* pEngineState |
| 140 | ); | 140 | ); |
| 141 | HRESULT CoreInitializeConstants( | ||
| 142 | __in BURN_ENGINE_STATE* pEngineState | ||
| 143 | ); | ||
| 141 | HRESULT CoreSerializeEngineState( | 144 | HRESULT CoreSerializeEngineState( |
| 142 | __in BURN_ENGINE_STATE* pEngineState, | 145 | __in BURN_ENGINE_STATE* pEngineState, |
| 143 | __inout BYTE** ppbBuffer, | 146 | __inout BYTE** ppbBuffer, |
diff --git a/src/engine/exeengine.cpp b/src/engine/exeengine.cpp index 1ca28473..f734edca 100644 --- a/src/engine/exeengine.cpp +++ b/src/engine/exeengine.cpp | |||
| @@ -105,7 +105,6 @@ extern "C" void ExeEnginePackageUninitialize( | |||
| 105 | ReleaseStr(pPackage->Exe.sczRepairArguments); | 105 | ReleaseStr(pPackage->Exe.sczRepairArguments); |
| 106 | ReleaseStr(pPackage->Exe.sczUninstallArguments); | 106 | ReleaseStr(pPackage->Exe.sczUninstallArguments); |
| 107 | ReleaseStr(pPackage->Exe.sczIgnoreDependencies); | 107 | ReleaseStr(pPackage->Exe.sczIgnoreDependencies); |
| 108 | ReleaseStr(pPackage->Exe.sczAncestors); | ||
| 109 | //ReleaseStr(pPackage->Exe.sczProgressSwitch); | 108 | //ReleaseStr(pPackage->Exe.sczProgressSwitch); |
| 110 | ReleaseMem(pPackage->Exe.rgExitCodes); | 109 | ReleaseMem(pPackage->Exe.rgExitCodes); |
| 111 | 110 | ||
| @@ -334,9 +333,9 @@ extern "C" HRESULT ExeEnginePlanAddPackage( | |||
| 334 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); | 333 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); |
| 335 | } | 334 | } |
| 336 | 335 | ||
| 337 | if (pPackage->Exe.sczAncestors) | 336 | if (pPackage->Exe.wzAncestors) |
| 338 | { | 337 | { |
| 339 | hr = StrAllocString(&pAction->exePackage.sczAncestors, pPackage->Exe.sczAncestors, 0); | 338 | hr = StrAllocString(&pAction->exePackage.sczAncestors, pPackage->Exe.wzAncestors, 0); |
| 340 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); | 339 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); |
| 341 | } | 340 | } |
| 342 | 341 | ||
| @@ -359,9 +358,9 @@ extern "C" HRESULT ExeEnginePlanAddPackage( | |||
| 359 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); | 358 | ExitOnFailure(hr, "Failed to allocate the list of dependencies to ignore."); |
| 360 | } | 359 | } |
| 361 | 360 | ||
| 362 | if (pPackage->Exe.sczAncestors) | 361 | if (pPackage->Exe.wzAncestors) |
| 363 | { | 362 | { |
| 364 | hr = StrAllocString(&pAction->exePackage.sczAncestors, pPackage->Exe.sczAncestors, 0); | 363 | hr = StrAllocString(&pAction->exePackage.sczAncestors, pPackage->Exe.wzAncestors, 0); |
| 365 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); | 364 | ExitOnFailure(hr, "Failed to allocate the list of ancestors."); |
| 366 | } | 365 | } |
| 367 | 366 | ||
diff --git a/src/engine/package.h b/src/engine/package.h index d3225fbc..71aecd95 100644 --- a/src/engine/package.h +++ b/src/engine/package.h | |||
| @@ -250,7 +250,7 @@ typedef struct _BURN_PACKAGE | |||
| 250 | LPWSTR sczRepairArguments; | 250 | LPWSTR sczRepairArguments; |
| 251 | LPWSTR sczUninstallArguments; | 251 | LPWSTR sczUninstallArguments; |
| 252 | LPWSTR sczIgnoreDependencies; | 252 | LPWSTR sczIgnoreDependencies; |
| 253 | LPWSTR sczAncestors; | 253 | LPCWSTR wzAncestors; // points directly into engine state. |
| 254 | 254 | ||
| 255 | BOOL fPseudoBundle; | 255 | BOOL fPseudoBundle; |
| 256 | 256 | ||
diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index a11d0e78..99c87163 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp | |||
| @@ -475,7 +475,7 @@ LExit: | |||
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | extern "C" HRESULT PlanPackages( | 477 | extern "C" HRESULT PlanPackages( |
| 478 | __in BURN_REGISTRATION* pRegistration, | 478 | __in BURN_REGISTRATION* /*pRegistration*/, |
| 479 | __in BURN_USER_EXPERIENCE* pUX, | 479 | __in BURN_USER_EXPERIENCE* pUX, |
| 480 | __in BURN_PACKAGES* pPackages, | 480 | __in BURN_PACKAGES* pPackages, |
| 481 | __in BURN_PLAN* pPlan, | 481 | __in BURN_PLAN* pPlan, |
| @@ -498,22 +498,6 @@ extern "C" HRESULT PlanPackages( | |||
| 498 | DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackages->cPackages - 1 - i : i; | 498 | DWORD iPackage = (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) ? pPackages->cPackages - 1 - i : i; |
| 499 | BURN_PACKAGE* pPackage = pPackages->rgPackages + iPackage; | 499 | BURN_PACKAGE* pPackage = pPackages->rgPackages + iPackage; |
| 500 | 500 | ||
| 501 | // Support passing Ancestors to embedded burn bundles | ||
| 502 | if (BURN_PACKAGE_TYPE_EXE == pPackage->type && BURN_EXE_PROTOCOL_TYPE_BURN == pPackage->Exe.protocol) | ||
| 503 | { | ||
| 504 | // Pass along any ancestors and ourself to prevent infinite loops. | ||
| 505 | if (pRegistration->sczAncestors && *pRegistration->sczAncestors) | ||
| 506 | { | ||
| 507 | hr = StrAllocFormatted(&pPackage->Exe.sczAncestors, L"%ls;%ls", pRegistration->sczAncestors, pRegistration->sczId); | ||
| 508 | ExitOnFailure(hr, "Failed to copy ancestors and self to related bundle ancestors."); | ||
| 509 | } | ||
| 510 | else | ||
| 511 | { | ||
| 512 | hr = StrAllocString(&pPackage->Exe.sczAncestors, pRegistration->sczId, 0); | ||
| 513 | ExitOnFailure(hr, "Failed to copy self to related bundle ancestors."); | ||
| 514 | } | ||
| 515 | } | ||
| 516 | |||
| 517 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary); | 501 | hr = ProcessPackage(fBundlePerMachine, pUX, pPlan, pPackage, pLog, pVariables, display, relationType, wzLayoutDirectory, phSyncpointEvent, &pRollbackBoundary); |
| 518 | ExitOnFailure(hr, "Failed to process package."); | 502 | ExitOnFailure(hr, "Failed to process package."); |
| 519 | } | 503 | } |
| @@ -1230,16 +1214,7 @@ extern "C" HRESULT PlanRelatedBundlesBegin( | |||
| 1230 | } | 1214 | } |
| 1231 | 1215 | ||
| 1232 | // Pass along any ancestors and ourself to prevent infinite loops. | 1216 | // Pass along any ancestors and ourself to prevent infinite loops. |
| 1233 | if (pRegistration->sczAncestors && *pRegistration->sczAncestors) | 1217 | pRelatedBundle->package.Exe.wzAncestors = pRegistration->sczBundlePackageAncestors; |
| 1234 | { | ||
| 1235 | hr = StrAllocFormatted(&pRelatedBundle->package.Exe.sczAncestors, L"%ls;%ls", pRegistration->sczAncestors, pRegistration->sczId); | ||
| 1236 | ExitOnFailure(hr, "Failed to copy ancestors and self to related bundle ancestors."); | ||
| 1237 | } | ||
| 1238 | else | ||
| 1239 | { | ||
| 1240 | hr = StrAllocString(&pRelatedBundle->package.Exe.sczAncestors, pRegistration->sczId, 0); | ||
| 1241 | ExitOnFailure(hr, "Failed to copy self to related bundle ancestors."); | ||
| 1242 | } | ||
| 1243 | 1218 | ||
| 1244 | hr = PlanDefaultRelatedBundleRequestState(relationType, pRelatedBundle->relationType, pPlan->action, pRegistration->pVersion, pRelatedBundle->pVersion, &pRelatedBundle->package.requested); | 1219 | hr = PlanDefaultRelatedBundleRequestState(relationType, pRelatedBundle->relationType, pPlan->action, pRegistration->pVersion, pRelatedBundle->pVersion, &pRelatedBundle->package.requested); |
| 1245 | ExitOnFailure(hr, "Failed to get default request state for related bundle."); | 1220 | ExitOnFailure(hr, "Failed to get default request state for related bundle."); |
diff --git a/src/engine/pseudobundle.cpp b/src/engine/pseudobundle.cpp index 0864be3a..3b05ea0b 100644 --- a/src/engine/pseudobundle.cpp +++ b/src/engine/pseudobundle.cpp | |||
| @@ -159,8 +159,8 @@ extern "C" HRESULT PseudoBundleInitializePassthrough( | |||
| 159 | __in BURN_PACKAGE* pPassthroughPackage, | 159 | __in BURN_PACKAGE* pPassthroughPackage, |
| 160 | __in BOOTSTRAPPER_COMMAND* pCommand, | 160 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| 161 | __in_z_opt LPCWSTR wzAppendLogPath, | 161 | __in_z_opt LPCWSTR wzAppendLogPath, |
| 162 | __in_z_opt LPWSTR wzActiveParent, | 162 | __in_z_opt LPCWSTR wzActiveParent, |
| 163 | __in_z_opt LPWSTR wzAncestors, | 163 | __in_z_opt LPCWSTR wzAncestors, |
| 164 | __in BURN_PACKAGE* pPackage | 164 | __in BURN_PACKAGE* pPackage |
| 165 | ) | 165 | ) |
| 166 | { | 166 | { |
diff --git a/src/engine/pseudobundle.h b/src/engine/pseudobundle.h index 4d3d3052..3b8157a0 100644 --- a/src/engine/pseudobundle.h +++ b/src/engine/pseudobundle.h | |||
| @@ -29,8 +29,8 @@ HRESULT PseudoBundleInitializePassthrough( | |||
| 29 | __in BURN_PACKAGE* pPassthroughPackage, | 29 | __in BURN_PACKAGE* pPassthroughPackage, |
| 30 | __in BOOTSTRAPPER_COMMAND* pCommand, | 30 | __in BOOTSTRAPPER_COMMAND* pCommand, |
| 31 | __in_z_opt LPCWSTR wzAppendLogPath, | 31 | __in_z_opt LPCWSTR wzAppendLogPath, |
| 32 | __in_z_opt LPWSTR wzActiveParent, | 32 | __in_z_opt LPCWSTR wzActiveParent, |
| 33 | __in_z_opt LPWSTR wzAncestors, | 33 | __in_z_opt LPCWSTR wzAncestors, |
| 34 | __in BURN_PACKAGE* pPackage | 34 | __in BURN_PACKAGE* pPackage |
| 35 | ); | 35 | ); |
| 36 | 36 | ||
diff --git a/src/engine/registration.cpp b/src/engine/registration.cpp index a2ed2a0d..9c821422 100644 --- a/src/engine/registration.cpp +++ b/src/engine/registration.cpp | |||
| @@ -396,6 +396,7 @@ extern "C" void RegistrationUninitialize( | |||
| 396 | 396 | ||
| 397 | ReleaseStr(pRegistration->sczDetectedProviderKeyBundleId); | 397 | ReleaseStr(pRegistration->sczDetectedProviderKeyBundleId); |
| 398 | ReleaseStr(pRegistration->sczAncestors); | 398 | ReleaseStr(pRegistration->sczAncestors); |
| 399 | ReleaseStr(pRegistration->sczBundlePackageAncestors); | ||
| 399 | RelatedBundlesUninitialize(&pRegistration->relatedBundles); | 400 | RelatedBundlesUninitialize(&pRegistration->relatedBundles); |
| 400 | 401 | ||
| 401 | // clear struct | 402 | // clear struct |
diff --git a/src/engine/registration.h b/src/engine/registration.h index 55d5a4c8..56bcb1f0 100644 --- a/src/engine/registration.h +++ b/src/engine/registration.h | |||
| @@ -150,6 +150,7 @@ typedef struct _BURN_REGISTRATION | |||
| 150 | 150 | ||
| 151 | LPWSTR sczDetectedProviderKeyBundleId; | 151 | LPWSTR sczDetectedProviderKeyBundleId; |
| 152 | LPWSTR sczAncestors; | 152 | LPWSTR sczAncestors; |
| 153 | LPWSTR sczBundlePackageAncestors; | ||
| 153 | 154 | ||
| 154 | BOOL fEnabledForwardCompatibleBundle; | 155 | BOOL fEnabledForwardCompatibleBundle; |
| 155 | BURN_PACKAGE forwardCompatibleBundle; | 156 | BURN_PACKAGE forwardCompatibleBundle; |
diff --git a/src/test/BurnUnitTest/PlanTest.cpp b/src/test/BurnUnitTest/PlanTest.cpp index 81447ca1..42c11968 100644 --- a/src/test/BurnUnitTest/PlanTest.cpp +++ b/src/test/BurnUnitTest/PlanTest.cpp | |||
| @@ -679,7 +679,8 @@ namespace Bootstrapper | |||
| 679 | ReleaseStr(sczFilePath); | 679 | ReleaseStr(sczFilePath); |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | DependencyInitialize(&pEngineState->registration, NULL); | 682 | hr = CoreInitializeConstants(pEngineState); |
| 683 | NativeAssert::Succeeded(hr, "Failed to initialize core constants"); | ||
| 683 | 684 | ||
| 684 | pEngineState->userExperience.pfnBAProc = PlanTestBAProc; | 685 | pEngineState->userExperience.pfnBAProc = PlanTestBAProc; |
| 685 | } | 686 | } |
