From 47bca2dc51525fcad86f325278b14953ac5b137e Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 15 Jan 2022 21:40:54 -0500 Subject: Fix 32/64-bit bitness handling in Burn and BUtil. - Take advantage of RegOpenEx. - Always look for related bundles in both 32 and 64 hives. - BundleEnumRelatedBundle requires caller to specify bitness. --- src/burn/engine/search.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/burn/engine/search.cpp') diff --git a/src/burn/engine/search.cpp b/src/burn/engine/search.cpp index 6d5f8d49..4505e1a2 100644 --- a/src/burn/engine/search.cpp +++ b/src/burn/engine/search.cpp @@ -836,19 +836,13 @@ static HRESULT RegistrySearchExists( HKEY hKey = NULL; DWORD dwType = 0; BOOL fExists = FALSE; - REGSAM samDesired = KEY_QUERY_VALUE; - - if (pSearch->RegistrySearch.fWin64) - { - samDesired = samDesired | KEY_WOW64_64KEY; - } // format key string hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); ExitOnFailure(hr, "Failed to format key string."); // open key - hr = RegOpen(pSearch->RegistrySearch.hRoot, sczKey, samDesired, &hKey); + hr = RegOpenEx(pSearch->RegistrySearch.hRoot, sczKey, KEY_QUERY_VALUE, pSearch->RegistrySearch.fWin64 ? REG_KEY_64BIT : REG_KEY_32BIT, &hKey); if (SUCCEEDED(hr)) { fExists = TRUE; @@ -922,12 +916,6 @@ static HRESULT RegistrySearchValue( LPBYTE pData = NULL; DWORD cch = 0; BURN_VARIANT value = { }; - REGSAM samDesired = KEY_QUERY_VALUE; - - if (pSearch->RegistrySearch.fWin64) - { - samDesired = samDesired | KEY_WOW64_64KEY; - } // format key string hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); @@ -941,7 +929,7 @@ static HRESULT RegistrySearchValue( } // open key - hr = RegOpen(pSearch->RegistrySearch.hRoot, sczKey, samDesired, &hKey); + hr = RegOpenEx(pSearch->RegistrySearch.hRoot, sczKey, KEY_QUERY_VALUE, pSearch->RegistrySearch.fWin64 ? REG_KEY_64BIT : REG_KEY_32BIT, &hKey); if (E_FILENOTFOUND == hr) { // What if there is a hidden variable in sczKey? -- cgit v1.2.3-55-g6feb