aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/burn/engine/approvedexe.h1
-rw-r--r--src/burn/engine/core.cpp29
-rw-r--r--src/burn/engine/core.h11
-rw-r--r--src/burn/engine/dependency.cpp66
-rw-r--r--src/burn/engine/dependency.h27
-rw-r--r--src/burn/engine/detect.cpp7
-rw-r--r--src/burn/engine/engine.cpp7
-rw-r--r--src/burn/engine/externalengine.cpp2
-rw-r--r--src/burn/engine/plan.cpp23
-rw-r--r--src/burn/engine/plan.h4
-rw-r--r--src/burn/engine/precomp.h2
-rw-r--r--src/burn/engine/pseudobundle.cpp4
-rw-r--r--src/burn/engine/pseudobundle.h2
-rw-r--r--src/burn/engine/registration.cpp7
-rw-r--r--src/burn/engine/registration.h5
-rw-r--r--src/burn/test/BurnUnitTest/PlanTest.cpp8
-rw-r--r--src/burn/test/BurnUnitTest/RegistrationTest.cpp36
-rw-r--r--src/burn/test/BurnUnitTest/precomp.h2
18 files changed, 148 insertions, 95 deletions
diff --git a/src/burn/engine/approvedexe.h b/src/burn/engine/approvedexe.h
index 076d86c4..cd3bf271 100644
--- a/src/burn/engine/approvedexe.h
+++ b/src/burn/engine/approvedexe.h
@@ -10,6 +10,7 @@ extern "C" {
10 10
11typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT; 11typedef struct _BOOTSTRAPPER_ENGINE_CONTEXT BOOTSTRAPPER_ENGINE_CONTEXT;
12typedef struct _BURN_CACHE BURN_CACHE; 12typedef struct _BURN_CACHE BURN_CACHE;
13typedef struct _BURN_DEPENDENCIES BURN_DEPENDENCIES;
13typedef struct _BURN_ENGINE_COMMAND BURN_ENGINE_COMMAND; 14typedef struct _BURN_ENGINE_COMMAND BURN_ENGINE_COMMAND;
14 15
15// structs 16// structs
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index 8985ab27..bccdfa9f 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -111,6 +111,12 @@ extern "C" HRESULT CoreInitialize(
111 hr = VariableSetNumeric(&pEngineState->variables, BURN_BUNDLE_UILEVEL, pEngineState->command.display, TRUE); 111 hr = VariableSetNumeric(&pEngineState->variables, BURN_BUNDLE_UILEVEL, pEngineState->command.display, TRUE);
112 ExitOnFailure(hr, "Failed to overwrite the %ls built-in variable.", BURN_BUNDLE_UILEVEL); 112 ExitOnFailure(hr, "Failed to overwrite the %ls built-in variable.", BURN_BUNDLE_UILEVEL);
113 113
114 if (pEngineState->internalCommand.sczActiveParent && *pEngineState->internalCommand.sczActiveParent)
115 {
116 hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_ACTIVE_PARENT, pEngineState->internalCommand.sczActiveParent, TRUE, FALSE);
117 ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable.");
118 }
119
114 if (pEngineState->internalCommand.sczSourceProcessPath) 120 if (pEngineState->internalCommand.sczSourceProcessPath)
115 { 121 {
116 hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_PATH, pEngineState->internalCommand.sczSourceProcessPath, TRUE, FALSE); 122 hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_PATH, pEngineState->internalCommand.sczSourceProcessPath, TRUE, FALSE);
@@ -172,7 +178,7 @@ extern "C" HRESULT CoreInitializeConstants(
172 HRESULT hr = S_OK; 178 HRESULT hr = S_OK;
173 BURN_REGISTRATION* pRegistration = &pEngineState->registration; 179 BURN_REGISTRATION* pRegistration = &pEngineState->registration;
174 180
175 hr = DependencyInitialize(pRegistration, pEngineState->sczIgnoreDependencies); 181 hr = DependencyInitialize(&pEngineState->internalCommand, &pEngineState->dependencies, pRegistration);
176 ExitOnFailure(hr, "Failed to initialize dependency data."); 182 ExitOnFailure(hr, "Failed to initialize dependency data.");
177 183
178 // Support passing Ancestors to embedded burn bundles. 184 // Support passing Ancestors to embedded burn bundles.
@@ -360,7 +366,7 @@ extern "C" HRESULT CoreDetect(
360 } 366 }
361 } 367 }
362 368
363 hr = DependencyDetect(pEngineState); 369 hr = DependencyDetect(&pEngineState->dependencies, &pEngineState->packages, &pEngineState->registration);
364 ExitOnFailure(hr, "Failed to detect the dependencies."); 370 ExitOnFailure(hr, "Failed to detect the dependencies.");
365 371
366 // Log the detected states. 372 // Log the detected states.
@@ -453,6 +459,7 @@ extern "C" HRESULT CorePlan(
453 // we make everywhere. 459 // we make everywhere.
454 pEngineState->plan.action = action; 460 pEngineState->plan.action = action;
455 pEngineState->plan.pCache = &pEngineState->cache; 461 pEngineState->plan.pCache = &pEngineState->cache;
462 pEngineState->plan.pInternalCommand = &pEngineState->internalCommand;
456 pEngineState->plan.pPayloads = &pEngineState->payloads; 463 pEngineState->plan.pPayloads = &pEngineState->payloads;
457 pEngineState->plan.wzBundleId = pEngineState->registration.sczId; 464 pEngineState->plan.wzBundleId = pEngineState->registration.sczId;
458 pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId; 465 pEngineState->plan.wzBundleProviderKey = pEngineState->registration.sczId;
@@ -463,10 +470,10 @@ extern "C" HRESULT CorePlan(
463 ExitOnFailure(hr, "Failed to update action."); 470 ExitOnFailure(hr, "Failed to update action.");
464 471
465 // Set resume commandline 472 // Set resume commandline
466 hr = PlanSetResumeCommand(&pEngineState->registration, action, &pEngineState->command, &pEngineState->log); 473 hr = PlanSetResumeCommand(&pEngineState->plan, &pEngineState->registration, &pEngineState->command, &pEngineState->log);
467 ExitOnFailure(hr, "Failed to set resume command"); 474 ExitOnFailure(hr, "Failed to set resume command");
468 475
469 hr = DependencyPlanInitialize(&pEngineState->registration, &pEngineState->plan); 476 hr = DependencyPlanInitialize(&pEngineState->dependencies, &pEngineState->plan);
470 ExitOnFailure(hr, "Failed to initialize the dependencies for the plan."); 477 ExitOnFailure(hr, "Failed to initialize the dependencies for the plan.");
471 478
472 if (BOOTSTRAPPER_ACTION_LAYOUT == action) 479 if (BOOTSTRAPPER_ACTION_LAYOUT == action)
@@ -508,7 +515,7 @@ extern "C" HRESULT CorePlan(
508 { 515 {
509 pEngineState->plan.fPerMachine = pEngineState->registration.fPerMachine; // default the scope of the plan to the per-machine state of the bundle. 516 pEngineState->plan.fPerMachine = pEngineState->registration.fPerMachine; // default the scope of the plan to the per-machine state of the bundle.
510 517
511 hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning); 518 hr = PlanRegistration(&pEngineState->plan, &pEngineState->registration, &pEngineState->dependencies, pEngineState->command.resumeType, pEngineState->command.relationType, &fContinuePlanning);
512 ExitOnFailure(hr, "Failed to plan registration."); 519 ExitOnFailure(hr, "Failed to plan registration.");
513 520
514 if (fContinuePlanning) 521 if (fContinuePlanning)
@@ -921,10 +928,10 @@ extern "C" LPCWSTR CoreRelationTypeToCommandLineString(
921extern "C" HRESULT CoreRecreateCommandLine( 928extern "C" HRESULT CoreRecreateCommandLine(
922 __deref_inout_z LPWSTR* psczCommandLine, 929 __deref_inout_z LPWSTR* psczCommandLine,
923 __in BOOTSTRAPPER_ACTION action, 930 __in BOOTSTRAPPER_ACTION action,
924 __in BOOTSTRAPPER_DISPLAY display, 931 __in BURN_ENGINE_COMMAND* pInternalCommand,
932 __in BOOTSTRAPPER_COMMAND* pCommand,
925 __in BOOTSTRAPPER_RELATION_TYPE relationType, 933 __in BOOTSTRAPPER_RELATION_TYPE relationType,
926 __in BOOL fPassthrough, 934 __in BOOL fPassthrough,
927 __in_z_opt LPCWSTR wzActiveParent,
928 __in_z_opt LPCWSTR wzAncestors, 935 __in_z_opt LPCWSTR wzAncestors,
929 __in_z_opt LPCWSTR wzAppendLogPath, 936 __in_z_opt LPCWSTR wzAppendLogPath,
930 __in_z_opt LPCWSTR wzAdditionalCommandLineArguments 937 __in_z_opt LPCWSTR wzAdditionalCommandLineArguments
@@ -937,7 +944,7 @@ extern "C" HRESULT CoreRecreateCommandLine(
937 hr = StrAllocString(psczCommandLine, L"", 0); 944 hr = StrAllocString(psczCommandLine, L"", 0);
938 ExitOnFailure(hr, "Failed to empty command line."); 945 ExitOnFailure(hr, "Failed to empty command line.");
939 946
940 switch (display) 947 switch (pCommand->display)
941 { 948 {
942 case BOOTSTRAPPER_DISPLAY_NONE: 949 case BOOTSTRAPPER_DISPLAY_NONE:
943 hr = StrAllocConcat(psczCommandLine, L" /quiet", 0); 950 hr = StrAllocConcat(psczCommandLine, L" /quiet", 0);
@@ -962,11 +969,11 @@ extern "C" HRESULT CoreRecreateCommandLine(
962 } 969 }
963 ExitOnFailure(hr, "Failed to append action state to command-line"); 970 ExitOnFailure(hr, "Failed to append action state to command-line");
964 971
965 if (wzActiveParent) 972 if (pInternalCommand->sczActiveParent)
966 { 973 {
967 if (*wzActiveParent) 974 if (*pInternalCommand->sczActiveParent)
968 { 975 {
969 hr = StrAllocFormatted(&scz, L" /%ls \"%ls\"", BURN_COMMANDLINE_SWITCH_PARENT, wzActiveParent); 976 hr = StrAllocFormatted(&scz, L" /%ls \"%ls\"", BURN_COMMANDLINE_SWITCH_PARENT, pInternalCommand->sczActiveParent);
970 ExitOnFailure(hr, "Failed to format active parent command-line for command-line."); 977 ExitOnFailure(hr, "Failed to format active parent command-line for command-line.");
971 } 978 }
972 else 979 else
diff --git a/src/burn/engine/core.h b/src/burn/engine/core.h
index 9bb06147..9a6305d3 100644
--- a/src/burn/engine/core.h
+++ b/src/burn/engine/core.h
@@ -81,6 +81,10 @@ enum BURN_AU_PAUSE_ACTION
81typedef struct _BURN_ENGINE_COMMAND 81typedef struct _BURN_ENGINE_COMMAND
82{ 82{
83 BOOL fInitiallyElevated; 83 BOOL fInitiallyElevated;
84
85 LPWSTR sczActiveParent;
86 LPWSTR sczIgnoreDependencies;
87
84 LPWSTR sczSourceProcessPath; 88 LPWSTR sczSourceProcessPath;
85 LPWSTR sczOriginalSource; 89 LPWSTR sczOriginalSource;
86} BURN_ENGINE_COMMAND; 90} BURN_ENGINE_COMMAND;
@@ -111,6 +115,7 @@ typedef struct _BURN_ENGINE_STATE
111 BURN_UPDATE update; 115 BURN_UPDATE update;
112 BURN_APPROVED_EXES approvedExes; 116 BURN_APPROVED_EXES approvedExes;
113 BURN_CACHE cache; 117 BURN_CACHE cache;
118 BURN_DEPENDENCIES dependencies;
114 BURN_EXTENSIONS extensions; 119 BURN_EXTENSIONS extensions;
115 120
116 HWND hMessageWindow; 121 HWND hMessageWindow;
@@ -138,8 +143,6 @@ typedef struct _BURN_ENGINE_STATE
138 BURN_RESUME_MODE resumeMode; 143 BURN_RESUME_MODE resumeMode;
139 BOOL fDisableUnelevate; 144 BOOL fDisableUnelevate;
140 145
141 LPWSTR sczIgnoreDependencies;
142
143 int argc; 146 int argc;
144 LPWSTR* argv; 147 LPWSTR* argv;
145 BOOL fInvalidCommandLine; 148 BOOL fInvalidCommandLine;
@@ -211,10 +214,10 @@ LPCWSTR CoreRelationTypeToCommandLineString(
211HRESULT CoreRecreateCommandLine( 214HRESULT CoreRecreateCommandLine(
212 __deref_inout_z LPWSTR* psczCommandLine, 215 __deref_inout_z LPWSTR* psczCommandLine,
213 __in BOOTSTRAPPER_ACTION action, 216 __in BOOTSTRAPPER_ACTION action,
214 __in BOOTSTRAPPER_DISPLAY display, 217 __in BURN_ENGINE_COMMAND* pInternalCommand,
218 __in BOOTSTRAPPER_COMMAND* pCommand,
215 __in BOOTSTRAPPER_RELATION_TYPE relationType, 219 __in BOOTSTRAPPER_RELATION_TYPE relationType,
216 __in BOOL fPassthrough, 220 __in BOOL fPassthrough,
217 __in_z_opt LPCWSTR wzActiveParent,
218 __in_z_opt LPCWSTR wzAncestors, 221 __in_z_opt LPCWSTR wzAncestors,
219 __in_z_opt LPCWSTR wzAppendLogPath, 222 __in_z_opt LPCWSTR wzAppendLogPath,
220 __in_z_opt LPCWSTR wzAdditionalCommandLineArguments 223 __in_z_opt LPCWSTR wzAdditionalCommandLineArguments
diff --git a/src/burn/engine/dependency.cpp b/src/burn/engine/dependency.cpp
index 876cd8b3..f6cfe2c6 100644
--- a/src/burn/engine/dependency.cpp
+++ b/src/burn/engine/dependency.cpp
@@ -171,38 +171,58 @@ LExit:
171} 171}
172 172
173extern "C" HRESULT DependencyInitialize( 173extern "C" HRESULT DependencyInitialize(
174 __in BURN_REGISTRATION* pRegistration, 174 __in BURN_ENGINE_COMMAND* pInternalCommand,
175 __in_z_opt LPCWSTR wzIgnoreDependencies 175 __in BURN_DEPENDENCIES* pDependencies,
176 __in BURN_REGISTRATION* pRegistration
176 ) 177 )
177{ 178{
179 AssertSz(!pDependencies->cIgnoredDependencies, "Dependencies already initalized.");
180
178 HRESULT hr = S_OK; 181 HRESULT hr = S_OK;
179 182
180 // If no parent was specified at all, use the bundle id as the self dependent. 183 // If no parent was specified at all, use the bundle id as the self dependent.
181 if (!pRegistration->sczActiveParent) 184 if (!pInternalCommand->sczActiveParent)
182 { 185 {
183 pRegistration->wzSelfDependent = pRegistration->sczId; 186 pDependencies->wzSelfDependent = pRegistration->sczId;
184 } 187 }
185 else if (*pRegistration->sczActiveParent) // if parent was specified use that as the self dependent. 188 else if (*pInternalCommand->sczActiveParent) // if parent was specified use that as the self dependent.
186 { 189 {
187 pRegistration->wzSelfDependent = pRegistration->sczActiveParent; 190 pDependencies->wzSelfDependent = pInternalCommand->sczActiveParent;
188 } 191 }
189 // else parent:none was used which means we should not register a dependency on ourself. 192 // else parent:none was used which means we should not register a dependency on ourself.
190 193
194 pDependencies->wzActiveParent = pInternalCommand->sczActiveParent;
195
191 // The current bundle provider key should always be ignored for dependency checks. 196 // The current bundle provider key should always be ignored for dependency checks.
192 hr = DepDependencyArrayAlloc(&pRegistration->rgIgnoredDependencies, &pRegistration->cIgnoredDependencies, pRegistration->sczProviderKey, NULL); 197 hr = DepDependencyArrayAlloc(&pDependencies->rgIgnoredDependencies, &pDependencies->cIgnoredDependencies, pRegistration->sczProviderKey, NULL);
193 ExitOnFailure(hr, "Failed to add the bundle provider key to the list of dependencies to ignore."); 198 ExitOnFailure(hr, "Failed to add the bundle provider key to the list of dependencies to ignore.");
194 199
195 // Add the list of dependencies to ignore. 200 // Add the list of dependencies to ignore.
196 if (wzIgnoreDependencies) 201 if (pInternalCommand->sczIgnoreDependencies)
197 { 202 {
198 hr = SplitIgnoreDependencies(wzIgnoreDependencies, &pRegistration->rgIgnoredDependencies, &pRegistration->cIgnoredDependencies, &pRegistration->fIgnoreAllDependents); 203 hr = SplitIgnoreDependencies(pInternalCommand->sczIgnoreDependencies, &pDependencies->rgIgnoredDependencies, &pDependencies->cIgnoredDependencies, &pDependencies->fIgnoreAllDependents);
199 ExitOnFailure(hr, "Failed to split the list of dependencies to ignore."); 204 ExitOnFailure(hr, "Failed to split the list of dependencies to ignore.");
200 } 205 }
201 206
207 pDependencies->fSelfDependent = NULL != pDependencies->wzSelfDependent;
208 pDependencies->fActiveParent = NULL != pInternalCommand->sczActiveParent && NULL != *pInternalCommand->sczActiveParent;
209
202LExit: 210LExit:
203 return hr; 211 return hr;
204} 212}
205 213
214extern "C" void DependencyUninitialize(
215 __in BURN_DEPENDENCIES* pDependencies
216 )
217{
218 if (pDependencies->rgIgnoredDependencies)
219 {
220 ReleaseDependencyArray(pDependencies->rgIgnoredDependencies, pDependencies->cIgnoredDependencies);
221 }
222
223 memset(pDependencies, 0, sizeof(BURN_DEPENDENCIES));
224}
225
206extern "C" HRESULT DependencyDetectProviderKeyBundleId( 226extern "C" HRESULT DependencyDetectProviderKeyBundleId(
207 __in BURN_REGISTRATION* pRegistration 227 __in BURN_REGISTRATION* pRegistration
208 ) 228 )
@@ -228,15 +248,14 @@ LExit:
228} 248}
229 249
230extern "C" HRESULT DependencyDetect( 250extern "C" HRESULT DependencyDetect(
231 __in BURN_ENGINE_STATE* pEngineState 251 __in BURN_DEPENDENCIES* pDependencies,
252 __in BURN_PACKAGES* pPackages,
253 __in BURN_REGISTRATION* pRegistration
232 ) 254 )
233{ 255{
234 HRESULT hr = S_OK; 256 HRESULT hr = S_OK;
235 BURN_REGISTRATION* pRegistration = &pEngineState->registration;
236 STRINGDICT_HANDLE sdIgnoredDependents = NULL; 257 STRINGDICT_HANDLE sdIgnoredDependents = NULL;
237 BURN_PACKAGE* pPackage = NULL; 258 BURN_PACKAGE* pPackage = NULL;
238 BOOL fSelfDependent = NULL != pRegistration->wzSelfDependent;
239 BOOL fActiveParent = NULL != pRegistration->sczActiveParent && NULL != *pRegistration->sczActiveParent;
240 259
241 // Always leave this empty so that all dependents get detected. Plan will ignore dependents based on its own logic. 260 // Always leave this empty so that all dependents get detected. Plan will ignore dependents based on its own logic.
242 hr = DictCreateStringList(&sdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); 261 hr = DictCreateStringList(&sdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE);
@@ -252,16 +271,16 @@ extern "C" HRESULT DependencyDetect(
252 hr = S_OK; 271 hr = S_OK;
253 } 272 }
254 273
255 for (DWORD iPackage = 0; iPackage < pEngineState->packages.cPackages; ++iPackage) 274 for (DWORD iPackage = 0; iPackage < pPackages->cPackages; ++iPackage)
256 { 275 {
257 pPackage = pEngineState->packages.rgPackages + iPackage; 276 pPackage = pPackages->rgPackages + iPackage;
258 hr = DetectPackageDependents(pPackage, sdIgnoredDependents, pRegistration); 277 hr = DetectPackageDependents(pPackage, sdIgnoredDependents, pRegistration);
259 ExitOnFailure(hr, "Failed to detect dependents for package '%ls'", pPackage->sczId); 278 ExitOnFailure(hr, "Failed to detect dependents for package '%ls'", pPackage->sczId);
260 } 279 }
261 280
262 for (DWORD iRelatedBundle = 0; iRelatedBundle < pEngineState->registration.relatedBundles.cRelatedBundles; ++iRelatedBundle) 281 for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle)
263 { 282 {
264 BURN_RELATED_BUNDLE* pRelatedBundle = pEngineState->registration.relatedBundles.rgRelatedBundles + iRelatedBundle; 283 BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle;
265 if (!pRelatedBundle->fPlannable) 284 if (!pRelatedBundle->fPlannable)
266 { 285 {
267 continue; 286 continue;
@@ -272,18 +291,18 @@ extern "C" HRESULT DependencyDetect(
272 ExitOnFailure(hr, "Failed to detect dependents for related bundle '%ls'", pPackage->sczId); 291 ExitOnFailure(hr, "Failed to detect dependents for related bundle '%ls'", pPackage->sczId);
273 } 292 }
274 293
275 if (fSelfDependent || fActiveParent) 294 if (pDependencies->fSelfDependent || pDependencies->fActiveParent)
276 { 295 {
277 for (DWORD i = 0; i < pRegistration->cDependents; ++i) 296 for (DWORD i = 0; i < pRegistration->cDependents; ++i)
278 { 297 {
279 DEPENDENCY* pDependent = pRegistration->rgDependents + i; 298 DEPENDENCY* pDependent = pRegistration->rgDependents + i;
280 299
281 if (fActiveParent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->sczActiveParent, -1, pDependent->sczKey, -1)) 300 if (pDependencies->fActiveParent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pDependencies->wzActiveParent, -1, pDependent->sczKey, -1))
282 { 301 {
283 pRegistration->fParentRegisteredAsDependent = TRUE; 302 pRegistration->fParentRegisteredAsDependent = TRUE;
284 } 303 }
285 304
286 if (fSelfDependent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pRegistration->wzSelfDependent, -1, pDependent->sczKey, -1)) 305 if (pDependencies->fSelfDependent && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, pDependencies->wzSelfDependent, -1, pDependent->sczKey, -1))
287 { 306 {
288 pRegistration->fSelfRegisteredAsDependent = TRUE; 307 pRegistration->fSelfRegisteredAsDependent = TRUE;
289 } 308 }
@@ -297,16 +316,16 @@ LExit:
297} 316}
298 317
299extern "C" HRESULT DependencyPlanInitialize( 318extern "C" HRESULT DependencyPlanInitialize(
300 __in const BURN_REGISTRATION* pRegistration, 319 __in BURN_DEPENDENCIES* pDependencies,
301 __in BURN_PLAN* pPlan 320 __in BURN_PLAN* pPlan
302 ) 321 )
303{ 322{
304 HRESULT hr = S_OK; 323 HRESULT hr = S_OK;
305 324
306 // TODO: After adding enumeration to STRINGDICT, a single STRINGDICT_HANDLE can be used everywhere. 325 // TODO: After adding enumeration to STRINGDICT, a single STRINGDICT_HANDLE can be used everywhere.
307 for (DWORD i = 0; i < pRegistration->cIgnoredDependencies; ++i) 326 for (DWORD i = 0; i < pDependencies->cIgnoredDependencies; ++i)
308 { 327 {
309 DEPENDENCY* pDependency = pRegistration->rgIgnoredDependencies + i; 328 DEPENDENCY* pDependency = pDependencies->rgIgnoredDependencies + i;
310 329
311 hr = DepDependencyArrayAlloc(&pPlan->rgPlannedProviders, &pPlan->cPlannedProviders, pDependency->sczKey, pDependency->sczName); 330 hr = DepDependencyArrayAlloc(&pPlan->rgPlannedProviders, &pPlan->cPlannedProviders, pDependency->sczKey, pDependency->sczName);
312 ExitOnFailure(hr, "Failed to add the detected provider to the list of dependencies to ignore."); 331 ExitOnFailure(hr, "Failed to add the detected provider to the list of dependencies to ignore.");
@@ -952,6 +971,7 @@ static HRESULT GetIgnoredDependents(
952 { 971 {
953 ExitOnFailure(hr, "Failed to get the package property: %ls", DEPENDENCY_IGNOREDEPENDENCIES); 972 ExitOnFailure(hr, "Failed to get the package property: %ls", DEPENDENCY_IGNOREDEPENDENCIES);
954 973
974 // TODO: this is the raw value of the property, all property values are currently formatted in a different part of planning.
955 hr = DependencyAddIgnoreDependencies(*psdIgnoredDependents, sczIgnoreDependencies); 975 hr = DependencyAddIgnoreDependencies(*psdIgnoredDependents, sczIgnoreDependencies);
956 ExitOnFailure(hr, "Failed to add the authored ignored dependencies to the cumulative list of ignored dependencies."); 976 ExitOnFailure(hr, "Failed to add the authored ignored dependencies to the cumulative list of ignored dependencies.");
957 } 977 }
diff --git a/src/burn/engine/dependency.h b/src/burn/engine/dependency.h
index 06a01a20..3dacaf99 100644
--- a/src/burn/engine/dependency.h
+++ b/src/burn/engine/dependency.h
@@ -11,6 +11,18 @@ extern "C" {
11const LPCWSTR DEPENDENCY_IGNOREDEPENDENCIES = L"IGNOREDEPENDENCIES"; 11const LPCWSTR DEPENDENCY_IGNOREDEPENDENCIES = L"IGNOREDEPENDENCIES";
12 12
13 13
14typedef struct _BURN_DEPENDENCIES
15{
16 DEPENDENCY* rgIgnoredDependencies;
17 UINT cIgnoredDependencies;
18 LPCWSTR wzActiveParent;
19 LPCWSTR wzSelfDependent;
20 BOOL fIgnoreAllDependents;
21 BOOL fSelfDependent;
22 BOOL fActiveParent;
23} BURN_DEPENDENCIES;
24
25
14// function declarations 26// function declarations
15 27
16/******************************************************************** 28/********************************************************************
@@ -33,8 +45,13 @@ HRESULT DependencyParseProvidersFromXml(
33 ); 45 );
34 46
35HRESULT DependencyInitialize( 47HRESULT DependencyInitialize(
36 __in BURN_REGISTRATION* pRegistration, 48 __in BURN_ENGINE_COMMAND* pInternalCommand,
37 __in_z_opt LPCWSTR wzIgnoreDependencies 49 __in BURN_DEPENDENCIES* pDependencies,
50 __in BURN_REGISTRATION* pRegistration
51 );
52
53void DependencyUninitialize(
54 __in BURN_DEPENDENCIES* pDependencies
38 ); 55 );
39 56
40/******************************************************************** 57/********************************************************************
@@ -52,7 +69,9 @@ HRESULT DependencyDetectProviderKeyBundleId(
52 69
53*********************************************************************/ 70*********************************************************************/
54HRESULT DependencyDetect( 71HRESULT DependencyDetect(
55 __in BURN_ENGINE_STATE* pEngineState 72 __in BURN_DEPENDENCIES* pDependencies,
73 __in BURN_PACKAGES* pPackages,
74 __in BURN_REGISTRATION* pRegistration
56 ); 75 );
57 76
58/******************************************************************** 77/********************************************************************
@@ -60,7 +79,7 @@ HRESULT DependencyDetect(
60 79
61*********************************************************************/ 80*********************************************************************/
62HRESULT DependencyPlanInitialize( 81HRESULT DependencyPlanInitialize(
63 __in const BURN_REGISTRATION* pRegistration, 82 __in BURN_DEPENDENCIES* pDependencies,
64 __in BURN_PLAN* pPlan 83 __in BURN_PLAN* pPlan
65 ); 84 );
66 85
diff --git a/src/burn/engine/detect.cpp b/src/burn/engine/detect.cpp
index dc35e747..5f68a240 100644
--- a/src/burn/engine/detect.cpp
+++ b/src/burn/engine/detect.cpp
@@ -44,13 +44,6 @@ extern "C" void DetectReset(
44 pRegistration->fForwardCompatibleBundleExists = FALSE; 44 pRegistration->fForwardCompatibleBundleExists = FALSE;
45 pRegistration->fEligibleForCleanup = FALSE; 45 pRegistration->fEligibleForCleanup = FALSE;
46 46
47 if (pRegistration->rgIgnoredDependencies)
48 {
49 ReleaseDependencyArray(pRegistration->rgIgnoredDependencies, pRegistration->cIgnoredDependencies);
50 }
51 pRegistration->rgIgnoredDependencies = NULL;
52 pRegistration->cIgnoredDependencies = 0;
53
54 if (pRegistration->rgDependents) 47 if (pRegistration->rgDependents)
55 { 48 {
56 ReleaseDependencyArray(pRegistration->rgDependents, pRegistration->cDependents); 49 ReleaseDependencyArray(pRegistration->rgDependents, pRegistration->cDependents);
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp
index 0c2c8dc5..66eee27e 100644
--- a/src/burn/engine/engine.cpp
+++ b/src/burn/engine/engine.cpp
@@ -338,7 +338,7 @@ static HRESULT InitializeEngineState(
338 ProcElevated(::GetCurrentProcess(), &pEngineState->internalCommand.fInitiallyElevated); 338 ProcElevated(::GetCurrentProcess(), &pEngineState->internalCommand.fInitiallyElevated);
339 339
340 // Parse command line. 340 // Parse command line.
341 hr = CoreParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &pEngineState->internalCommand.sczSourceProcessPath, &pEngineState->internalCommand.sczOriginalSource, &hSectionFile, &hSourceEngineFile, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->registration.sczActiveParent, &pEngineState->sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &pEngineState->fInvalidCommandLine, &pEngineState->cUnknownArgs, &pEngineState->rgUnknownArgs); 341 hr = CoreParseCommandLine(pEngineState->argc, pEngineState->argv, &pEngineState->command, &pEngineState->companionConnection, &pEngineState->embeddedConnection, &pEngineState->mode, &pEngineState->automaticUpdates, &pEngineState->fDisableSystemRestore, &pEngineState->internalCommand.sczSourceProcessPath, &pEngineState->internalCommand.sczOriginalSource, &hSectionFile, &hSourceEngineFile, &pEngineState->fDisableUnelevate, &pEngineState->log.dwAttributes, &pEngineState->log.sczPath, &pEngineState->internalCommand.sczActiveParent, &pEngineState->internalCommand.sczIgnoreDependencies, &pEngineState->registration.sczAncestors, &pEngineState->fInvalidCommandLine, &pEngineState->cUnknownArgs, &pEngineState->rgUnknownArgs);
342 ExitOnFailure(hr, "Fatal error while parsing command line."); 342 ExitOnFailure(hr, "Fatal error while parsing command line.");
343 343
344 hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile); 344 hr = SectionInitialize(&pEngineState->section, hSectionFile, hSourceEngineFile);
@@ -362,8 +362,6 @@ static void UninitializeEngineState(
362 362
363 ReleaseMem(pEngineState->rgUnknownArgs); 363 ReleaseMem(pEngineState->rgUnknownArgs);
364 364
365 ReleaseStr(pEngineState->sczIgnoreDependencies);
366
367 PipeConnectionUninitialize(&pEngineState->embeddedConnection); 365 PipeConnectionUninitialize(&pEngineState->embeddedConnection);
368 PipeConnectionUninitialize(&pEngineState->companionConnection); 366 PipeConnectionUninitialize(&pEngineState->companionConnection);
369 ReleaseStr(pEngineState->sczBundleEngineWorkingPath) 367 ReleaseStr(pEngineState->sczBundleEngineWorkingPath)
@@ -376,6 +374,7 @@ static void UninitializeEngineState(
376 UserExperienceUninitialize(&pEngineState->userExperience); 374 UserExperienceUninitialize(&pEngineState->userExperience);
377 375
378 ApprovedExesUninitialize(&pEngineState->approvedExes); 376 ApprovedExesUninitialize(&pEngineState->approvedExes);
377 DependencyUninitialize(&pEngineState->dependencies);
379 UpdateUninitialize(&pEngineState->update); 378 UpdateUninitialize(&pEngineState->update);
380 VariablesUninitialize(&pEngineState->variables); 379 VariablesUninitialize(&pEngineState->variables);
381 SearchesUninitialize(&pEngineState->searches); 380 SearchesUninitialize(&pEngineState->searches);
@@ -390,6 +389,8 @@ static void UninitializeEngineState(
390 ReleaseStr(pEngineState->command.wzLayoutDirectory); 389 ReleaseStr(pEngineState->command.wzLayoutDirectory);
391 ReleaseStr(pEngineState->command.wzCommandLine); 390 ReleaseStr(pEngineState->command.wzCommandLine);
392 391
392 ReleaseStr(pEngineState->internalCommand.sczActiveParent);
393 ReleaseStr(pEngineState->internalCommand.sczIgnoreDependencies);
393 ReleaseStr(pEngineState->internalCommand.sczOriginalSource); 394 ReleaseStr(pEngineState->internalCommand.sczOriginalSource);
394 ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath); 395 ReleaseStr(pEngineState->internalCommand.sczSourceProcessPath);
395 396
diff --git a/src/burn/engine/externalengine.cpp b/src/burn/engine/externalengine.cpp
index a5f75bd4..60497640 100644
--- a/src/burn/engine/externalengine.cpp
+++ b/src/burn/engine/externalengine.cpp
@@ -295,7 +295,7 @@ HRESULT ExternalEngineSetUpdate(
295 { 295 {
296 UpdateUninitialize(&pEngineState->update); 296 UpdateUninitialize(&pEngineState->update);
297 297
298 hr = CoreRecreateCommandLine(&sczCommandline, BOOTSTRAPPER_ACTION_INSTALL, pEngineState->command.display, BOOTSTRAPPER_RELATION_NONE, FALSE, pEngineState->registration.sczActiveParent, pEngineState->registration.sczAncestors, NULL, pEngineState->command.wzCommandLine); 298 hr = CoreRecreateCommandLine(&sczCommandline, BOOTSTRAPPER_ACTION_INSTALL, &pEngineState->internalCommand, &pEngineState->command, BOOTSTRAPPER_RELATION_NONE, FALSE, pEngineState->registration.sczAncestors, NULL, pEngineState->command.wzCommandLine);
299 ExitOnFailure(hr, "Failed to recreate command-line for update bundle."); 299 ExitOnFailure(hr, "Failed to recreate command-line for update bundle.");
300 300
301 // Bundles would fail to use the downloaded update bundle, as the running bundle would be one of the search paths. 301 // Bundles would fail to use the downloaded update bundle, as the running bundle would be one of the search paths.
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp
index 79b7c98f..8c5b7051 100644
--- a/src/burn/engine/plan.cpp
+++ b/src/burn/engine/plan.cpp
@@ -444,7 +444,7 @@ extern "C" HRESULT PlanForwardCompatibleBundles(
444 } 444 }
445 445
446 // Only change the recommendation if an active parent was provided. 446 // Only change the recommendation if an active parent was provided.
447 if (pRegistration->sczActiveParent && *pRegistration->sczActiveParent) 447 if (pPlan->pInternalCommand->sczActiveParent && *pPlan->pInternalCommand->sczActiveParent)
448 { 448 {
449 // On install, recommend running the forward compatible bundle because there is an active parent. This 449 // On install, recommend running the forward compatible bundle because there is an active parent. This
450 // will essentially register the parent with the forward compatible bundle. 450 // will essentially register the parent with the forward compatible bundle.
@@ -480,7 +480,7 @@ extern "C" HRESULT PlanForwardCompatibleBundles(
480 480
481 if (!fIgnoreBundle) 481 if (!fIgnoreBundle)
482 { 482 {
483 hr = PseudoBundleInitializePassthrough(&pPlan->forwardCompatibleBundle, pCommand, NULL, pRegistration->sczActiveParent, pRegistration->sczAncestors, &pRelatedBundle->package); 483 hr = PseudoBundleInitializePassthrough(&pPlan->forwardCompatibleBundle, pPlan->pInternalCommand, pCommand, NULL, pRegistration->sczAncestors, &pRelatedBundle->package);
484 ExitOnFailure(hr, "Failed to initialize pass through bundle."); 484 ExitOnFailure(hr, "Failed to initialize pass through bundle.");
485 485
486 pPlan->fEnabledForwardCompatibleBundle = TRUE; 486 pPlan->fEnabledForwardCompatibleBundle = TRUE;
@@ -512,6 +512,7 @@ extern "C" HRESULT PlanPackages(
512extern "C" HRESULT PlanRegistration( 512extern "C" HRESULT PlanRegistration(
513 __in BURN_PLAN* pPlan, 513 __in BURN_PLAN* pPlan,
514 __in BURN_REGISTRATION* pRegistration, 514 __in BURN_REGISTRATION* pRegistration,
515 __in BURN_DEPENDENCIES* pDependencies,
515 __in BOOTSTRAPPER_RESUME_TYPE /*resumeType*/, 516 __in BOOTSTRAPPER_RESUME_TYPE /*resumeType*/,
516 __in BOOTSTRAPPER_RELATION_TYPE relationType, 517 __in BOOTSTRAPPER_RELATION_TYPE relationType,
517 __inout BOOL* pfContinuePlanning 518 __inout BOOL* pfContinuePlanning
@@ -523,7 +524,7 @@ extern "C" HRESULT PlanRegistration(
523 524
524 pPlan->fCanAffectMachineState = TRUE; // register the bundle since we're modifying machine state. 525 pPlan->fCanAffectMachineState = TRUE; // register the bundle since we're modifying machine state.
525 pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed 526 pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed
526 pPlan->fIgnoreAllDependents = pRegistration->fIgnoreAllDependents; 527 pPlan->fIgnoreAllDependents = pDependencies->fIgnoreAllDependents;
527 528
528 // Ensure the bundle is cached if not running from the cache. 529 // Ensure the bundle is cached if not running from the cache.
529 if (!CacheBundleRunningFromCache(pPlan->pCache)) 530 if (!CacheBundleRunningFromCache(pPlan->pCache))
@@ -560,10 +561,10 @@ extern "C" HRESULT PlanRegistration(
560 // would prevent self-removal. 561 // would prevent self-removal.
561 if (pRegistration->fSelfRegisteredAsDependent) 562 if (pRegistration->fSelfRegisteredAsDependent)
562 { 563 {
563 hr = AddRegistrationAction(pPlan, BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_UNREGISTER, pRegistration->wzSelfDependent, pRegistration->sczId); 564 hr = AddRegistrationAction(pPlan, BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_UNREGISTER, pDependencies->wzSelfDependent, pRegistration->sczId);
564 ExitOnFailure(hr, "Failed to allocate registration action."); 565 ExitOnFailure(hr, "Failed to allocate registration action.");
565 566
566 hr = DependencyAddIgnoreDependencies(sdIgnoreDependents, pRegistration->wzSelfDependent); 567 hr = DependencyAddIgnoreDependencies(sdIgnoreDependents, pDependencies->wzSelfDependent);
567 ExitOnFailure(hr, "Failed to add self-dependent to ignore dependents."); 568 ExitOnFailure(hr, "Failed to add self-dependent to ignore dependents.");
568 } 569 }
569 570
@@ -575,9 +576,9 @@ extern "C" HRESULT PlanRegistration(
575 if (BOOTSTRAPPER_RELATION_UPGRADE != relationType) 576 if (BOOTSTRAPPER_RELATION_UPGRADE != relationType)
576 { 577 {
577 // If there were other dependencies to ignore, add them. 578 // If there were other dependencies to ignore, add them.
578 for (DWORD iDependency = 0; iDependency < pRegistration->cIgnoredDependencies; ++iDependency) 579 for (DWORD iDependency = 0; iDependency < pDependencies->cIgnoredDependencies; ++iDependency)
579 { 580 {
580 DEPENDENCY* pDependency = pRegistration->rgIgnoredDependencies + iDependency; 581 DEPENDENCY* pDependency = pDependencies->rgIgnoredDependencies + iDependency;
581 582
582 hr = DictKeyExists(sdIgnoreDependents, pDependency->sczKey); 583 hr = DictKeyExists(sdIgnoreDependents, pDependency->sczKey);
583 if (E_NOTFOUND != hr) 584 if (E_NOTFOUND != hr)
@@ -689,9 +690,9 @@ extern "C" HRESULT PlanRegistration(
689 // Only do the following if we decided there was a dependent self to register. If so and and an explicit parent was 690 // Only do the following if we decided there was a dependent self to register. If so and and an explicit parent was
690 // provided, register dependent self. Otherwise, if this bundle is not an addon or patch bundle then self-regisiter 691 // provided, register dependent self. Otherwise, if this bundle is not an addon or patch bundle then self-regisiter
691 // as our own dependent. 692 // as our own dependent.
692 if (pRegistration->wzSelfDependent && !pRegistration->fSelfRegisteredAsDependent && (pRegistration->sczActiveParent || !fAddonOrPatchBundle)) 693 if (pDependencies->wzSelfDependent && !pRegistration->fSelfRegisteredAsDependent && (pDependencies->wzActiveParent || !fAddonOrPatchBundle))
693 { 694 {
694 hr = AddRegistrationAction(pPlan, BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_REGISTER, pRegistration->wzSelfDependent, pRegistration->sczId); 695 hr = AddRegistrationAction(pPlan, BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_REGISTER, pDependencies->wzSelfDependent, pRegistration->sczId);
695 ExitOnFailure(hr, "Failed to add registration action for self dependent."); 696 ExitOnFailure(hr, "Failed to add registration action for self dependent.");
696 } 697 }
697 } 698 }
@@ -1774,8 +1775,8 @@ LExit:
1774 1775
1775*******************************************************************/ 1776*******************************************************************/
1776extern "C" HRESULT PlanSetResumeCommand( 1777extern "C" HRESULT PlanSetResumeCommand(
1778 __in BURN_PLAN* pPlan,
1777 __in BURN_REGISTRATION* pRegistration, 1779 __in BURN_REGISTRATION* pRegistration,
1778 __in BOOTSTRAPPER_ACTION action,
1779 __in BOOTSTRAPPER_COMMAND* pCommand, 1780 __in BOOTSTRAPPER_COMMAND* pCommand,
1780 __in BURN_LOGGING* pLog 1781 __in BURN_LOGGING* pLog
1781 ) 1782 )
@@ -1783,7 +1784,7 @@ extern "C" HRESULT PlanSetResumeCommand(
1783 HRESULT hr = S_OK; 1784 HRESULT hr = S_OK;
1784 1785
1785 // build the resume command-line. 1786 // build the resume command-line.
1786 hr = CoreRecreateCommandLine(&pRegistration->sczResumeCommandLine, action, pCommand->display, pCommand->relationType, pCommand->fPassthrough, pRegistration->sczActiveParent, pRegistration->sczAncestors, pLog->sczPath, pCommand->wzCommandLine); 1787 hr = CoreRecreateCommandLine(&pRegistration->sczResumeCommandLine, pPlan->action, pPlan->pInternalCommand, pCommand, pCommand->relationType, pCommand->fPassthrough, pRegistration->sczAncestors, pLog->sczPath, pCommand->wzCommandLine);
1787 ExitOnFailure(hr, "Failed to recreate resume command-line."); 1788 ExitOnFailure(hr, "Failed to recreate resume command-line.");
1788 1789
1789LExit: 1790LExit:
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h
index 28fc1639..00a5bf0d 100644
--- a/src/burn/engine/plan.h
+++ b/src/burn/engine/plan.h
@@ -230,6 +230,7 @@ typedef struct _BURN_PLAN
230{ 230{
231 BOOTSTRAPPER_ACTION action; 231 BOOTSTRAPPER_ACTION action;
232 BURN_CACHE* pCache; 232 BURN_CACHE* pCache;
233 BURN_ENGINE_COMMAND* pInternalCommand;
233 BURN_PAYLOADS* pPayloads; 234 BURN_PAYLOADS* pPayloads;
234 LPWSTR wzBundleId; // points directly into parent the ENGINE_STATE. 235 LPWSTR wzBundleId; // points directly into parent the ENGINE_STATE.
235 LPWSTR wzBundleProviderKey; // points directly into parent the ENGINE_STATE. 236 LPWSTR wzBundleProviderKey; // points directly into parent the ENGINE_STATE.
@@ -342,6 +343,7 @@ HRESULT PlanPackages(
342HRESULT PlanRegistration( 343HRESULT PlanRegistration(
343 __in BURN_PLAN* pPlan, 344 __in BURN_PLAN* pPlan,
344 __in BURN_REGISTRATION* pRegistration, 345 __in BURN_REGISTRATION* pRegistration,
346 __in BURN_DEPENDENCIES* pDependencies,
345 __in BOOTSTRAPPER_RESUME_TYPE resumeType, 347 __in BOOTSTRAPPER_RESUME_TYPE resumeType,
346 __in BOOTSTRAPPER_RELATION_TYPE relationType, 348 __in BOOTSTRAPPER_RELATION_TYPE relationType,
347 __inout BOOL* pfContinuePlanning 349 __inout BOOL* pfContinuePlanning
@@ -442,8 +444,8 @@ HRESULT PlanRollbackBoundaryComplete(
442 __in BURN_PLAN* pPlan 444 __in BURN_PLAN* pPlan
443 ); 445 );
444HRESULT PlanSetResumeCommand( 446HRESULT PlanSetResumeCommand(
447 __in BURN_PLAN* pPlan,
445 __in BURN_REGISTRATION* pRegistration, 448 __in BURN_REGISTRATION* pRegistration,
446 __in BOOTSTRAPPER_ACTION action,
447 __in BOOTSTRAPPER_COMMAND* pCommand, 449 __in BOOTSTRAPPER_COMMAND* pCommand,
448 __in BURN_LOGGING* pLog 450 __in BURN_LOGGING* pLog
449 ); 451 );
diff --git a/src/burn/engine/precomp.h b/src/burn/engine/precomp.h
index 647a3b33..f76bb198 100644
--- a/src/burn/engine/precomp.h
+++ b/src/burn/engine/precomp.h
@@ -83,13 +83,13 @@
83#include "logging.h" 83#include "logging.h"
84#include "pipe.h" 84#include "pipe.h"
85#include "cache.h" 85#include "cache.h"
86#include "dependency.h"
86#include "core.h" 87#include "core.h"
87#include "apply.h" 88#include "apply.h"
88#include "exeengine.h" 89#include "exeengine.h"
89#include "msiengine.h" 90#include "msiengine.h"
90#include "mspengine.h" 91#include "mspengine.h"
91#include "msuengine.h" 92#include "msuengine.h"
92#include "dependency.h"
93#include "elevation.h" 93#include "elevation.h"
94#include "embedded.h" 94#include "embedded.h"
95#include "manifest.h" 95#include "manifest.h"
diff --git a/src/burn/engine/pseudobundle.cpp b/src/burn/engine/pseudobundle.cpp
index 351fe044..df3edef6 100644
--- a/src/burn/engine/pseudobundle.cpp
+++ b/src/burn/engine/pseudobundle.cpp
@@ -163,9 +163,9 @@ LExit:
163 163
164extern "C" HRESULT PseudoBundleInitializePassthrough( 164extern "C" HRESULT PseudoBundleInitializePassthrough(
165 __in BURN_PACKAGE* pPassthroughPackage, 165 __in BURN_PACKAGE* pPassthroughPackage,
166 __in BURN_ENGINE_COMMAND* pInternalCommand,
166 __in BOOTSTRAPPER_COMMAND* pCommand, 167 __in BOOTSTRAPPER_COMMAND* pCommand,
167 __in_z_opt LPCWSTR wzAppendLogPath, 168 __in_z_opt LPCWSTR wzAppendLogPath,
168 __in_z_opt LPCWSTR wzActiveParent,
169 __in_z_opt LPCWSTR wzAncestors, 169 __in_z_opt LPCWSTR wzAncestors,
170 __in BURN_PACKAGE* pPackage 170 __in BURN_PACKAGE* pPackage
171 ) 171 )
@@ -205,7 +205,7 @@ extern "C" HRESULT PseudoBundleInitializePassthrough(
205 205
206 // No matter the operation, we're passing the same command-line. That's what makes 206 // No matter the operation, we're passing the same command-line. That's what makes
207 // this a passthrough bundle. 207 // this a passthrough bundle.
208 hr = CoreRecreateCommandLine(&sczArguments, pCommand->action, pCommand->display, pCommand->relationType, TRUE, wzActiveParent, wzAncestors, wzAppendLogPath, pCommand->wzCommandLine); 208 hr = CoreRecreateCommandLine(&sczArguments, pCommand->action, pInternalCommand, pCommand, pCommand->relationType, TRUE, wzAncestors, wzAppendLogPath, pCommand->wzCommandLine);
209 ExitOnFailure(hr, "Failed to recreate command-line arguments."); 209 ExitOnFailure(hr, "Failed to recreate command-line arguments.");
210 210
211 hr = StrAllocString(&pPassthroughPackage->Exe.sczInstallArguments, sczArguments, 0); 211 hr = StrAllocString(&pPassthroughPackage->Exe.sczInstallArguments, sczArguments, 0);
diff --git a/src/burn/engine/pseudobundle.h b/src/burn/engine/pseudobundle.h
index 9fb530aa..75ad08d2 100644
--- a/src/burn/engine/pseudobundle.h
+++ b/src/burn/engine/pseudobundle.h
@@ -28,9 +28,9 @@ HRESULT PseudoBundleInitialize(
28 ); 28 );
29HRESULT PseudoBundleInitializePassthrough( 29HRESULT PseudoBundleInitializePassthrough(
30 __in BURN_PACKAGE* pPassthroughPackage, 30 __in BURN_PACKAGE* pPassthroughPackage,
31 __in BURN_ENGINE_COMMAND* pInternalCommand,
31 __in BOOTSTRAPPER_COMMAND* pCommand, 32 __in BOOTSTRAPPER_COMMAND* pCommand,
32 __in_z_opt LPCWSTR wzAppendLogPath, 33 __in_z_opt LPCWSTR wzAppendLogPath,
33 __in_z_opt LPCWSTR wzActiveParent,
34 __in_z_opt LPCWSTR wzAncestors, 34 __in_z_opt LPCWSTR wzAncestors,
35 __in BURN_PACKAGE* pPackage 35 __in BURN_PACKAGE* pPackage
36 ); 36 );
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index d1c32b3e..51e75b78 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -385,7 +385,6 @@ extern "C" void RegistrationUninitialize(
385 ReleaseMem(pRegistration->rgsczPatchCodes); 385 ReleaseMem(pRegistration->rgsczPatchCodes);
386 386
387 ReleaseStr(pRegistration->sczProviderKey); 387 ReleaseStr(pRegistration->sczProviderKey);
388 ReleaseStr(pRegistration->sczActiveParent);
389 ReleaseStr(pRegistration->sczExecutableName); 388 ReleaseStr(pRegistration->sczExecutableName);
390 389
391 ReleaseStr(pRegistration->sczRegistrationKey); 390 ReleaseStr(pRegistration->sczRegistrationKey);
@@ -462,12 +461,6 @@ extern "C" HRESULT RegistrationSetVariables(
462 hr = GetBundleManufacturer(pRegistration, pVariables, &scz); 461 hr = GetBundleManufacturer(pRegistration, pVariables, &scz);
463 ExitOnFailure(hr, "Failed to initialize bundle manufacturer."); 462 ExitOnFailure(hr, "Failed to initialize bundle manufacturer.");
464 463
465 if (pRegistration->sczActiveParent && *pRegistration->sczActiveParent)
466 {
467 hr = VariableSetString(pVariables, BURN_BUNDLE_ACTIVE_PARENT, pRegistration->sczActiveParent, TRUE, FALSE);
468 ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable.");
469 }
470
471 hr = VariableSetString(pVariables, BURN_BUNDLE_PROVIDER_KEY, pRegistration->sczProviderKey, TRUE, FALSE); 464 hr = VariableSetString(pVariables, BURN_BUNDLE_PROVIDER_KEY, pRegistration->sczProviderKey, TRUE, FALSE);
472 ExitOnFailure(hr, "Failed to overwrite the bundle provider key built-in variable."); 465 ExitOnFailure(hr, "Failed to overwrite the bundle provider key built-in variable.");
473 466
diff --git a/src/burn/engine/registration.h b/src/burn/engine/registration.h
index aa5bf842..4da792d3 100644
--- a/src/burn/engine/registration.h
+++ b/src/burn/engine/registration.h
@@ -110,7 +110,6 @@ typedef struct _BURN_REGISTRATION
110 DWORD cPatchCodes; 110 DWORD cPatchCodes;
111 111
112 VERUTIL_VERSION* pVersion; 112 VERUTIL_VERSION* pVersion;
113 LPWSTR sczActiveParent;
114 LPWSTR sczProviderKey; 113 LPWSTR sczProviderKey;
115 LPWSTR sczExecutableName; 114 LPWSTR sczExecutableName;
116 115
@@ -145,12 +144,8 @@ typedef struct _BURN_REGISTRATION
145 BURN_UPDATE_REGISTRATION update; 144 BURN_UPDATE_REGISTRATION update;
146 145
147 BURN_RELATED_BUNDLES relatedBundles; // Only valid after detect. 146 BURN_RELATED_BUNDLES relatedBundles; // Only valid after detect.
148 DEPENDENCY* rgIgnoredDependencies; // Only valid after detect.
149 UINT cIgnoredDependencies; // Only valid after detect.
150 DEPENDENCY* rgDependents; // Only valid after detect. 147 DEPENDENCY* rgDependents; // Only valid after detect.
151 UINT cDependents; // Only valid after detect. 148 UINT cDependents; // Only valid after detect.
152 BOOL fIgnoreAllDependents; // Only valid after detect.
153 LPCWSTR wzSelfDependent; // Only valid after detect.
154 BOOL fSelfRegisteredAsDependent; // Only valid after detect. 149 BOOL fSelfRegisteredAsDependent; // Only valid after detect.
155 BOOL fParentRegisteredAsDependent; // Only valid after detect. 150 BOOL fParentRegisteredAsDependent; // Only valid after detect.
156 BOOL fForwardCompatibleBundleExists; // Only valid after detect. 151 BOOL fForwardCompatibleBundleExists; // Only valid after detect.
diff --git a/src/burn/test/BurnUnitTest/PlanTest.cpp b/src/burn/test/BurnUnitTest/PlanTest.cpp
index 2e3b1092..c7f2037d 100644
--- a/src/burn/test/BurnUnitTest/PlanTest.cpp
+++ b/src/burn/test/BurnUnitTest/PlanTest.cpp
@@ -959,15 +959,9 @@ namespace Bootstrapper
959 959
960 void PlanTestDetect(BURN_ENGINE_STATE* pEngineState) 960 void PlanTestDetect(BURN_ENGINE_STATE* pEngineState)
961 { 961 {
962 HRESULT hr = S_OK; 962 DetectReset(&pEngineState->registration, &pEngineState->packages);
963 BURN_REGISTRATION* pRegistration = &pEngineState->registration;
964
965 DetectReset(pRegistration, &pEngineState->packages);
966 PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads); 963 PlanReset(&pEngineState->plan, &pEngineState->containers, &pEngineState->packages, &pEngineState->layoutPayloads);
967 964
968 hr = DepDependencyArrayAlloc(&pRegistration->rgIgnoredDependencies, &pRegistration->cIgnoredDependencies, pRegistration->sczProviderKey, NULL);
969 NativeAssert::Succeeded(hr, "Failed to add the bundle provider key to the list of dependencies to ignore.");
970
971 pEngineState->userExperience.fEngineActive = TRUE; 965 pEngineState->userExperience.fEngineActive = TRUE;
972 pEngineState->fDetected = TRUE; 966 pEngineState->fDetected = TRUE;
973 } 967 }
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
index 7c0dde5a..af52e893 100644
--- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp
+++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
@@ -75,6 +75,7 @@ namespace Bootstrapper
75 BURN_REGISTRATION registration = { }; 75 BURN_REGISTRATION registration = { };
76 BURN_LOGGING logging = { }; 76 BURN_LOGGING logging = { };
77 BURN_PACKAGES packages = { }; 77 BURN_PACKAGES packages = { };
78 BURN_PLAN plan = { };
78 BURN_CACHE cache = { }; 79 BURN_CACHE cache = { };
79 BURN_ENGINE_COMMAND internalCommand = { }; 80 BURN_ENGINE_COMMAND internalCommand = { };
80 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 81 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
@@ -113,7 +114,10 @@ namespace Bootstrapper
113 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 114 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
114 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 115 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
115 116
116 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 117 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
118 plan.pInternalCommand = &internalCommand;
119
120 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
117 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 121 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
118 122
119 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 123 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
@@ -170,6 +174,7 @@ namespace Bootstrapper
170 BURN_REGISTRATION registration = { }; 174 BURN_REGISTRATION registration = { };
171 BURN_LOGGING logging = { }; 175 BURN_LOGGING logging = { };
172 BURN_PACKAGES packages = { }; 176 BURN_PACKAGES packages = { };
177 BURN_PLAN plan = { };
173 BURN_CACHE cache = { }; 178 BURN_CACHE cache = { };
174 BURN_ENGINE_COMMAND internalCommand = { }; 179 BURN_ENGINE_COMMAND internalCommand = { };
175 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 180 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
@@ -207,7 +212,10 @@ namespace Bootstrapper
207 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 212 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
208 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 213 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
209 214
210 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 215 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
216 plan.pInternalCommand = &internalCommand;
217
218 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
211 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 219 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
212 220
213 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 221 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
@@ -287,6 +295,7 @@ namespace Bootstrapper
287 BURN_REGISTRATION registration = { }; 295 BURN_REGISTRATION registration = { };
288 BURN_LOGGING logging = { }; 296 BURN_LOGGING logging = { };
289 BURN_PACKAGES packages = { }; 297 BURN_PACKAGES packages = { };
298 BURN_PLAN plan = { };
290 BURN_CACHE cache = { }; 299 BURN_CACHE cache = { };
291 BURN_ENGINE_COMMAND internalCommand = { }; 300 BURN_ENGINE_COMMAND internalCommand = { };
292 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 301 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
@@ -324,7 +333,10 @@ namespace Bootstrapper
324 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 333 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
325 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 334 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
326 335
327 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 336 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
337 plan.pInternalCommand = &internalCommand;
338
339 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
328 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 340 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
329 341
330 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 342 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
@@ -402,6 +414,7 @@ namespace Bootstrapper
402 BURN_REGISTRATION registration = { }; 414 BURN_REGISTRATION registration = { };
403 BURN_LOGGING logging = { }; 415 BURN_LOGGING logging = { };
404 BURN_PACKAGES packages = { }; 416 BURN_PACKAGES packages = { };
417 BURN_PLAN plan = { };
405 BURN_CACHE cache = { }; 418 BURN_CACHE cache = { };
406 BURN_ENGINE_COMMAND internalCommand = { }; 419 BURN_ENGINE_COMMAND internalCommand = { };
407 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID)); 420 String^ cacheDirectory = Path::Combine(Path::Combine(Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData), gcnew String(L"Package Cache")), gcnew String(TEST_BUNDLE_ID));
@@ -441,7 +454,10 @@ namespace Bootstrapper
441 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 454 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
442 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 455 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
443 456
444 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 457 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
458 plan.pInternalCommand = &internalCommand;
459
460 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
445 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 461 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
446 462
447 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 463 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
@@ -534,6 +550,7 @@ namespace Bootstrapper
534 BURN_REGISTRATION registration = { }; 550 BURN_REGISTRATION registration = { };
535 BURN_LOGGING logging = { }; 551 BURN_LOGGING logging = { };
536 BURN_PACKAGES packages = { }; 552 BURN_PACKAGES packages = { };
553 BURN_PLAN plan = { };
537 BURN_CACHE cache = { }; 554 BURN_CACHE cache = { };
538 BURN_ENGINE_COMMAND internalCommand = { }; 555 BURN_ENGINE_COMMAND internalCommand = { };
539 BYTE* pbBuffer = NULL; 556 BYTE* pbBuffer = NULL;
@@ -583,7 +600,10 @@ namespace Bootstrapper
583 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 600 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
584 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 601 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
585 602
586 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 603 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
604 plan.pInternalCommand = &internalCommand;
605
606 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
587 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 607 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
588 608
589 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 609 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
@@ -668,6 +688,7 @@ namespace Bootstrapper
668 BURN_REGISTRATION registration = { }; 688 BURN_REGISTRATION registration = { };
669 BURN_LOGGING logging = { }; 689 BURN_LOGGING logging = { };
670 BURN_PACKAGES packages = { }; 690 BURN_PACKAGES packages = { };
691 BURN_PLAN plan = { };
671 BURN_CACHE cache = { }; 692 BURN_CACHE cache = { };
672 BURN_ENGINE_COMMAND internalCommand = { }; 693 BURN_ENGINE_COMMAND internalCommand = { };
673 BOOTSTRAPPER_RESUME_TYPE resumeType = BOOTSTRAPPER_RESUME_TYPE_NONE; 694 BOOTSTRAPPER_RESUME_TYPE resumeType = BOOTSTRAPPER_RESUME_TYPE_NONE;
@@ -716,7 +737,10 @@ namespace Bootstrapper
716 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle); 737 hr = RegistrationParseFromXml(&registration, &cache, pixeBundle);
717 TestThrowOnFailure(hr, L"Failed to parse registration from XML."); 738 TestThrowOnFailure(hr, L"Failed to parse registration from XML.");
718 739
719 hr = PlanSetResumeCommand(&registration, BOOTSTRAPPER_ACTION_INSTALL, &command, &logging); 740 plan.action = BOOTSTRAPPER_ACTION_INSTALL;
741 plan.pInternalCommand = &internalCommand;
742
743 hr = PlanSetResumeCommand(&plan, &registration, &command, &logging);
720 TestThrowOnFailure(hr, L"Failed to set registration resume command."); 744 TestThrowOnFailure(hr, L"Failed to set registration resume command.");
721 745
722 hr = PathForCurrentProcess(&sczCurrentProcess, NULL); 746 hr = PathForCurrentProcess(&sczCurrentProcess, NULL);
diff --git a/src/burn/test/BurnUnitTest/precomp.h b/src/burn/test/BurnUnitTest/precomp.h
index a77dfe32..a31917b4 100644
--- a/src/burn/test/BurnUnitTest/precomp.h
+++ b/src/burn/test/BurnUnitTest/precomp.h
@@ -57,13 +57,13 @@
57#include "pipe.h" 57#include "pipe.h"
58#include "logging.h" 58#include "logging.h"
59#include "cache.h" 59#include "cache.h"
60#include "dependency.h"
60#include "core.h" 61#include "core.h"
61#include "apply.h" 62#include "apply.h"
62#include "exeengine.h" 63#include "exeengine.h"
63#include "msiengine.h" 64#include "msiengine.h"
64#include "mspengine.h" 65#include "mspengine.h"
65#include "msuengine.h" 66#include "msuengine.h"
66#include "dependency.h"
67#include "elevation.h" 67#include "elevation.h"
68#include "embedded.h" 68#include "embedded.h"
69#include "manifest.h" 69#include "manifest.h"