aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/dependency.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/dependency.cpp')
-rw-r--r--src/burn/engine/dependency.cpp73
1 files changed, 39 insertions, 34 deletions
diff --git a/src/burn/engine/dependency.cpp b/src/burn/engine/dependency.cpp
index bd86fe11..5d7e1a94 100644
--- a/src/burn/engine/dependency.cpp
+++ b/src/burn/engine/dependency.cpp
@@ -12,7 +12,6 @@ const LPCWSTR vcszIgnoreDependenciesDelim = L";";
12 12
13static HRESULT DetectPackageDependents( 13static HRESULT DetectPackageDependents(
14 __in BURN_PACKAGE* pPackage, 14 __in BURN_PACKAGE* pPackage,
15 __in STRINGDICT_HANDLE sdIgnoredDependents,
16 __in const BURN_REGISTRATION* pRegistration 15 __in const BURN_REGISTRATION* pRegistration
17 ); 16 );
18 17
@@ -232,7 +231,8 @@ extern "C" HRESULT DependencyDetectProviderKeyBundleId(
232 hr = DepGetProviderInformation(pRegistration->hkRoot, pRegistration->sczProviderKey, &pRegistration->sczDetectedProviderKeyBundleId, NULL, NULL); 231 hr = DepGetProviderInformation(pRegistration->hkRoot, pRegistration->sczProviderKey, &pRegistration->sczDetectedProviderKeyBundleId, NULL, NULL);
233 if (E_NOTFOUND == hr) 232 if (E_NOTFOUND == hr)
234 { 233 {
235 ExitFunction(); 234 ReleaseNullStr(pRegistration->sczDetectedProviderKeyBundleId);
235 ExitFunction1(hr = S_OK);
236 } 236 }
237 ExitOnFailure(hr, "Failed to get provider key bundle id."); 237 ExitOnFailure(hr, "Failed to get provider key bundle id.");
238 238
@@ -247,50 +247,26 @@ LExit:
247 return hr; 247 return hr;
248} 248}
249 249
250extern "C" HRESULT DependencyDetect( 250extern "C" HRESULT DependencyDetectBundle(
251 __in BURN_DEPENDENCIES* pDependencies, 251 __in BURN_DEPENDENCIES* pDependencies,
252 __in BURN_PACKAGES* pPackages,
253 __in BURN_REGISTRATION* pRegistration 252 __in BURN_REGISTRATION* pRegistration
254 ) 253 )
255{ 254{
256 HRESULT hr = S_OK; 255 HRESULT hr = S_OK;
257 STRINGDICT_HANDLE sdIgnoredDependents = NULL;
258 BURN_PACKAGE* pPackage = NULL;
259 256
260 // Always leave this empty so that all dependents get detected. Plan will ignore dependents based on its own logic. 257 hr = DependencyDetectProviderKeyBundleId(pRegistration);
261 hr = DictCreateStringList(&sdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); 258 ExitOnFailure(hr, "Failed to detect provider key bundle id.");
262 ExitOnFailure(hr, "Failed to create the string dictionary.");
263 259
264 hr = DepCheckDependents(pRegistration->hkRoot, pRegistration->sczProviderKey, 0, sdIgnoredDependents, &pRegistration->rgDependents, &pRegistration->cDependents); 260 hr = DepCheckDependents(pRegistration->hkRoot, pRegistration->sczProviderKey, 0, NULL, &pRegistration->rgDependents, &pRegistration->cDependents);
265 if (E_FILENOTFOUND != hr) 261 if (E_FILENOTFOUND != hr)
266 { 262 {
267 ExitOnFailure(hr, "Failed dependents check on bundle"); 263 ExitOnFailure(hr, "Failed dependents check on bundle.");
268 } 264 }
269 else 265 else
270 { 266 {
271 hr = S_OK; 267 hr = S_OK;
272 } 268 }
273 269
274 for (DWORD iPackage = 0; iPackage < pPackages->cPackages; ++iPackage)
275 {
276 pPackage = pPackages->rgPackages + iPackage;
277 hr = DetectPackageDependents(pPackage, sdIgnoredDependents, pRegistration);
278 ExitOnFailure(hr, "Failed to detect dependents for package '%ls'", pPackage->sczId);
279 }
280
281 for (DWORD iRelatedBundle = 0; iRelatedBundle < pRegistration->relatedBundles.cRelatedBundles; ++iRelatedBundle)
282 {
283 BURN_RELATED_BUNDLE* pRelatedBundle = pRegistration->relatedBundles.rgRelatedBundles + iRelatedBundle;
284 if (!pRelatedBundle->fPlannable)
285 {
286 continue;
287 }
288
289 pPackage = &pRelatedBundle->package;
290 hr = DetectPackageDependents(pPackage, sdIgnoredDependents, pRegistration);
291 ExitOnFailure(hr, "Failed to detect dependents for related bundle '%ls'", pPackage->sczId);
292 }
293
294 if (pDependencies->fSelfDependent || pDependencies->fActiveParent) 270 if (pDependencies->fSelfDependent || pDependencies->fActiveParent)
295 { 271 {
296 for (DWORD i = 0; i < pRegistration->cDependents; ++i) 272 for (DWORD i = 0; i < pRegistration->cDependents; ++i)
@@ -310,8 +286,38 @@ extern "C" HRESULT DependencyDetect(
310 } 286 }
311 287
312LExit: 288LExit:
313 ReleaseDict(sdIgnoredDependents); 289 return hr;
290}
291
292extern "C" HRESULT DependencyDetectChainPackage(
293 __in BURN_PACKAGE* pPackage,
294 __in BURN_REGISTRATION* pRegistration
295 )
296{
297 HRESULT hr = S_OK;
298
299 hr = DetectPackageDependents(pPackage, pRegistration);
300 ExitOnFailure(hr, "Failed to detect dependents for package '%ls'", pPackage->sczId);
314 301
302LExit:
303 return hr;
304}
305
306extern "C" HRESULT DependencyDetectRelatedBundle(
307 __in BURN_RELATED_BUNDLE* pRelatedBundle,
308 __in BURN_REGISTRATION* pRegistration
309 )
310{
311 HRESULT hr = S_OK;
312 BURN_PACKAGE* pPackage = &pRelatedBundle->package;
313
314 if (pRelatedBundle->fPlannable)
315 {
316 hr = DetectPackageDependents(pPackage, pRegistration);
317 ExitOnFailure(hr, "Failed to detect dependents for related bundle '%ls'", pPackage->sczId);
318 }
319
320LExit:
315 return hr; 321 return hr;
316} 322}
317 323
@@ -738,7 +744,6 @@ extern "C" void DependencyUnregisterBundle(
738 744
739static HRESULT DetectPackageDependents( 745static HRESULT DetectPackageDependents(
740 __in BURN_PACKAGE* pPackage, 746 __in BURN_PACKAGE* pPackage,
741 __in STRINGDICT_HANDLE sdIgnoredDependents,
742 __in const BURN_REGISTRATION* pRegistration 747 __in const BURN_REGISTRATION* pRegistration
743 ) 748 )
744{ 749{
@@ -759,7 +764,7 @@ static HRESULT DetectPackageDependents(
759 { 764 {
760 BURN_DEPENDENCY_PROVIDER* pProvider = &pPackage->rgDependencyProviders[i]; 765 BURN_DEPENDENCY_PROVIDER* pProvider = &pPackage->rgDependencyProviders[i];
761 766
762 hr = DepCheckDependents(hkHive, pProvider->sczKey, 0, sdIgnoredDependents, &pProvider->rgDependents, &pProvider->cDependents); 767 hr = DepCheckDependents(hkHive, pProvider->sczKey, 0, NULL, &pProvider->rgDependents, &pProvider->cDependents);
763 if (E_FILENOTFOUND != hr) 768 if (E_FILENOTFOUND != hr)
764 { 769 {
765 ExitOnFailure(hr, "Failed dependents check on package provider: %ls", pProvider->sczKey); 770 ExitOnFailure(hr, "Failed dependents check on package provider: %ls", pProvider->sczKey);