aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/dependency.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-08-08 18:02:15 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-08-09 09:57:02 -0500
commit240b663ad5fc94ed6d19c966b5c9105a176ecf40 (patch)
treed194e242ccb5bb69f0dbbc388ede87cef65c700f /src/burn/engine/dependency.cpp
parent8e1cbe8d7b468553d76c20452561e89726de5c47 (diff)
downloadwix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.tar.gz
wix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.tar.bz2
wix-240b663ad5fc94ed6d19c966b5c9105a176ecf40.zip
Skip logging errors in some places when they are due to missing files or registry keys or values.
Related to 6696
Diffstat (limited to 'src/burn/engine/dependency.cpp')
-rw-r--r--src/burn/engine/dependency.cpp44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/burn/engine/dependency.cpp b/src/burn/engine/dependency.cpp
index 221c7bbf..d6698680 100644
--- a/src/burn/engine/dependency.cpp
+++ b/src/burn/engine/dependency.cpp
@@ -279,19 +279,13 @@ extern "C" HRESULT DependencyDetectBundle(
279 ) 279 )
280{ 280{
281 HRESULT hr = S_OK; 281 HRESULT hr = S_OK;
282 BOOL fExists = FALSE;
282 283
283 hr = DependencyDetectProviderKeyBundleId(pRegistration); 284 hr = DependencyDetectProviderKeyBundleId(pRegistration);
284 ExitOnFailure(hr, "Failed to detect provider key bundle id."); 285 ExitOnFailure(hr, "Failed to detect provider key bundle id.");
285 286
286 hr = DepCheckDependents(pRegistration->hkRoot, pRegistration->sczProviderKey, 0, NULL, &pRegistration->rgDependents, &pRegistration->cDependents); 287 hr = DepCheckDependents(pRegistration->hkRoot, pRegistration->sczProviderKey, 0, NULL, &pRegistration->rgDependents, &pRegistration->cDependents);
287 if (E_FILENOTFOUND != hr) 288 ExitOnPathFailure(hr, fExists, "Failed dependents check on bundle.");
288 {
289 ExitOnFailure(hr, "Failed dependents check on bundle.");
290 }
291 else
292 {
293 hr = S_OK;
294 }
295 289
296 if (pDependencies->fSelfDependent || pDependencies->fActiveParent) 290 if (pDependencies->fSelfDependent || pDependencies->fActiveParent)
297 { 291 {
@@ -813,6 +807,7 @@ extern "C" HRESULT DependencyProcessDependentRegistration(
813 ) 807 )
814{ 808{
815 HRESULT hr = S_OK; 809 HRESULT hr = S_OK;
810 BOOL fDeleted = FALSE;
816 811
817 switch (pAction->type) 812 switch (pAction->type)
818 { 813 {
@@ -823,12 +818,11 @@ extern "C" HRESULT DependencyProcessDependentRegistration(
823 818
824 case BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_UNREGISTER: 819 case BURN_DEPENDENT_REGISTRATION_ACTION_TYPE_UNREGISTER:
825 hr = DepUnregisterDependent(pRegistration->hkRoot, pRegistration->sczProviderKey, pAction->sczDependentProviderKey); 820 hr = DepUnregisterDependent(pRegistration->hkRoot, pRegistration->sczProviderKey, pAction->sczDependentProviderKey);
826 ExitOnFailure(hr, "Failed to unregister dependent: %ls", pAction->sczDependentProviderKey); 821 ExitOnPathFailure(hr, fDeleted, "Failed to unregister dependent: %ls", pAction->sczDependentProviderKey);
827 break; 822 break;
828 823
829 default: 824 default:
830 hr = E_INVALIDARG; 825 ExitWithRootFailure(hr, E_INVALIDARG, "Unrecognized registration action type: %d", pAction->type);
831 ExitOnRootFailure(hr, "Unrecognized registration action type: %d", pAction->type);
832 } 826 }
833 827
834LExit: 828LExit:
@@ -848,11 +842,11 @@ extern "C" void DependencyUnregisterBundle(
848 { 842 {
849 // Remove the bundle provider key. 843 // Remove the bundle provider key.
850 hr = DepUnregisterDependency(pRegistration->hkRoot, pRegistration->sczProviderKey); 844 hr = DepUnregisterDependency(pRegistration->hkRoot, pRegistration->sczProviderKey);
851 if (SUCCEEDED(hr)) 845 if (SUCCEEDED(hr) || E_FILENOTFOUND == hr)
852 { 846 {
853 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED, pRegistration->sczProviderKey); 847 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED, pRegistration->sczProviderKey);
854 } 848 }
855 else if (FAILED(hr) && E_FILENOTFOUND != hr) 849 else
856 { 850 {
857 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED_FAILED, pRegistration->sczProviderKey, hr); 851 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_BUNDLE_UNREGISTERED_FAILED, pRegistration->sczProviderKey, hr);
858 } 852 }
@@ -961,13 +955,10 @@ static HRESULT DetectPackageDependents(
961 for (DWORD i = 0; i < pPackage->cDependencyProviders; ++i) 955 for (DWORD i = 0; i < pPackage->cDependencyProviders; ++i)
962 { 956 {
963 BURN_DEPENDENCY_PROVIDER* pProvider = &pPackage->rgDependencyProviders[i]; 957 BURN_DEPENDENCY_PROVIDER* pProvider = &pPackage->rgDependencyProviders[i];
958 BOOL fExists = FALSE;
964 959
965 hr = DepCheckDependents(hkHive, pProvider->sczKey, 0, NULL, &pProvider->rgDependents, &pProvider->cDependents); 960 hr = DepCheckDependents(hkHive, pProvider->sczKey, 0, NULL, &pProvider->rgDependents, &pProvider->cDependents);
966 if (E_FILENOTFOUND == hr) 961 ExitOnPathFailure(hr, fExists, "Failed dependents check on package provider: %ls", pProvider->sczKey);
967 {
968 hr = S_OK;
969 }
970 ExitOnFailure(hr, "Failed dependents check on package provider: %ls", pProvider->sczKey);
971 962
972 if (0 < pProvider->cDependents || GetProviderExists(hkHive, pProvider->sczKey)) 963 if (0 < pProvider->cDependents || GetProviderExists(hkHive, pProvider->sczKey))
973 { 964 {
@@ -1366,11 +1357,11 @@ static void UnregisterPackageProvider(
1366 HRESULT hr = S_OK; 1357 HRESULT hr = S_OK;
1367 1358
1368 hr = DepUnregisterDependency(hkRoot, pProvider->sczKey); 1359 hr = DepUnregisterDependency(hkRoot, pProvider->sczKey);
1369 if (SUCCEEDED(hr)) 1360 if (SUCCEEDED(hr) || E_FILENOTFOUND == hr)
1370 { 1361 {
1371 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED, pProvider->sczKey, wzPackageId); 1362 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED, pProvider->sczKey, wzPackageId);
1372 } 1363 }
1373 else if (FAILED(hr) && E_FILENOTFOUND != hr) 1364 else
1374 { 1365 {
1375 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_FAILED, pProvider->sczKey, wzPackageId, hr); 1366 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_FAILED, pProvider->sczKey, wzPackageId, hr);
1376 } 1367 }
@@ -1390,15 +1381,14 @@ static HRESULT RegisterPackageProviderDependent(
1390 ) 1381 )
1391{ 1382{
1392 HRESULT hr = S_OK; 1383 HRESULT hr = S_OK;
1384 BOOL fExists = FALSE;
1393 1385
1394 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_REGISTER_DEPENDENCY, wzDependentProviderKey, pProvider->sczKey, wzPackageId); 1386 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_REGISTER_DEPENDENCY, wzDependentProviderKey, pProvider->sczKey, wzPackageId);
1395 1387
1396 hr = DepRegisterDependent(hkRoot, pProvider->sczKey, wzDependentProviderKey, NULL, NULL, 0); 1388 hr = DepRegisterDependent(hkRoot, pProvider->sczKey, wzDependentProviderKey, NULL, NULL, 0);
1397 if (E_FILENOTFOUND != hr) 1389 ExitOnPathFailure(hr, fExists, "Failed to register the dependency on package dependency provider: %ls", pProvider->sczKey);
1398 { 1390
1399 ExitOnFailure(hr, "Failed to register the dependency on package dependency provider: %ls", pProvider->sczKey); 1391 if (!fExists)
1400 }
1401 else
1402 { 1392 {
1403 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_SKIP_MISSING, pProvider->sczKey, wzPackageId); 1393 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_SKIP_MISSING, pProvider->sczKey, wzPackageId);
1404 } 1394 }
@@ -1454,11 +1444,11 @@ static void UnregisterPackageProviderDependent(
1454 HRESULT hr = S_OK; 1444 HRESULT hr = S_OK;
1455 1445
1456 hr = DepUnregisterDependent(hkRoot, pProvider->sczKey, wzDependentProviderKey); 1446 hr = DepUnregisterDependent(hkRoot, pProvider->sczKey, wzDependentProviderKey);
1457 if (SUCCEEDED(hr)) 1447 if (SUCCEEDED(hr) || E_FILENOTFOUND == hr)
1458 { 1448 {
1459 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_DEPENDENCY, wzDependentProviderKey, pProvider->sczKey, wzPackageId); 1449 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_DEPENDENCY, wzDependentProviderKey, pProvider->sczKey, wzPackageId);
1460 } 1450 }
1461 else if (FAILED(hr) && E_FILENOTFOUND != hr) 1451 else
1462 { 1452 {
1463 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_DEPENDENCY_FAILED, wzDependentProviderKey, pProvider->sczKey, wzPackageId, hr); 1453 LogId(REPORT_VERBOSE, MSG_DEPENDENCY_PACKAGE_UNREGISTERED_DEPENDENCY_FAILED, wzDependentProviderKey, pProvider->sczKey, wzPackageId, hr);
1464 } 1454 }