From abe316b80fae80eba54b0b79e76b6362105fa098 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 14 Jan 2022 20:48:01 -0600 Subject: Refactor some dependency detection. * Run DependencyDetect earlier * Do package dependency checking during each package/related bundle --- src/libs/dutil/WixToolset.DUtil/deputil.cpp | 19 ++++++++++++++----- src/libs/dutil/WixToolset.DUtil/inc/deputil.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'src/libs/dutil') diff --git a/src/libs/dutil/WixToolset.DUtil/deputil.cpp b/src/libs/dutil/WixToolset.DUtil/deputil.cpp index 754365e9..1a480263 100644 --- a/src/libs/dutil/WixToolset.DUtil/deputil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/deputil.cpp @@ -246,7 +246,7 @@ DAPI_(HRESULT) DepCheckDependents( __in HKEY hkHive, __in_z LPCWSTR wzProviderKey, __reserved int /*iAttributes*/, - __in C_STRINGDICT_HANDLE sdIgnoredDependents, + __in_opt C_STRINGDICT_HANDLE sdIgnoredDependents, __deref_inout_ecount_opt(*pcDependents) DEPENDENCY** prgDependents, __inout LPUINT pcDependents ) @@ -257,6 +257,7 @@ DAPI_(HRESULT) DepCheckDependents( HKEY hkDependentsKey = NULL; LPWSTR sczDependentKey = NULL; LPWSTR sczDependentName = NULL; + BOOL fIgnore = FALSE; // Format the provider dependency registry key. hr = AllocDependencyKeyName(wzProviderKey, &sczKey); @@ -280,6 +281,8 @@ DAPI_(HRESULT) DepCheckDependents( // Now enumerate the dependent keys. If they are not defined in the ignored list, add them to the array. for (DWORD dwIndex = 0; ; ++dwIndex) { + fIgnore = FALSE; + hr = RegKeyEnum(hkDependentsKey, dwIndex, &sczDependentKey); if (E_NOMOREITEMS != hr) { @@ -292,12 +295,18 @@ DAPI_(HRESULT) DepCheckDependents( } // If the key isn't ignored, add it to the dependent array. - hr = DictKeyExists(sdIgnoredDependents, sczDependentKey); - if (E_NOTFOUND != hr) + if (sdIgnoredDependents) { - DepExitOnFailure(hr, "Failed to check the dictionary of ignored dependents."); + hr = DictKeyExists(sdIgnoredDependents, sczDependentKey); + if (E_NOTFOUND != hr) + { + DepExitOnFailure(hr, "Failed to check the dictionary of ignored dependents."); + + fIgnore = TRUE; + } } - else + + if (!fIgnore) { // Get the name of the dependent from the key. hr = GetDependencyNameFromKey(hkHive, sczDependentKey, &sczDependentName); diff --git a/src/libs/dutil/WixToolset.DUtil/inc/deputil.h b/src/libs/dutil/WixToolset.DUtil/inc/deputil.h index bfe235f3..96f353f6 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/deputil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/deputil.h @@ -56,7 +56,7 @@ DAPI_(HRESULT) DepCheckDependents( __in HKEY hkHive, __in_z LPCWSTR wzProviderKey, __reserved int iAttributes, - __in C_STRINGDICT_HANDLE sdIgnoredDependents, + __in_opt C_STRINGDICT_HANDLE sdIgnoredDependents, __deref_inout_ecount_opt(*pcDependents) DEPENDENCY** prgDependents, __inout LPUINT pcDependents ); -- cgit v1.2.3-55-g6feb