diff options
| author | Bob Arnson <bob@firegiant.com> | 2022-01-15 21:40:54 -0500 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2022-01-16 10:28:44 -0500 |
| commit | 47bca2dc51525fcad86f325278b14953ac5b137e (patch) | |
| tree | 80a153833efbe0794be7153c64e712a5799649c4 /src/burn/engine/search.cpp | |
| parent | 6d1c4cc83214b65032251c67239b02da59a3e635 (diff) | |
| download | wix-47bca2dc51525fcad86f325278b14953ac5b137e.tar.gz wix-47bca2dc51525fcad86f325278b14953ac5b137e.tar.bz2 wix-47bca2dc51525fcad86f325278b14953ac5b137e.zip | |
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.
Diffstat (limited to 'src/burn/engine/search.cpp')
| -rw-r--r-- | src/burn/engine/search.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
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( | |||
| 836 | HKEY hKey = NULL; | 836 | HKEY hKey = NULL; |
| 837 | DWORD dwType = 0; | 837 | DWORD dwType = 0; |
| 838 | BOOL fExists = FALSE; | 838 | BOOL fExists = FALSE; |
| 839 | REGSAM samDesired = KEY_QUERY_VALUE; | ||
| 840 | |||
| 841 | if (pSearch->RegistrySearch.fWin64) | ||
| 842 | { | ||
| 843 | samDesired = samDesired | KEY_WOW64_64KEY; | ||
| 844 | } | ||
| 845 | 839 | ||
| 846 | // format key string | 840 | // format key string |
| 847 | hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); | 841 | hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); |
| 848 | ExitOnFailure(hr, "Failed to format key string."); | 842 | ExitOnFailure(hr, "Failed to format key string."); |
| 849 | 843 | ||
| 850 | // open key | 844 | // open key |
| 851 | hr = RegOpen(pSearch->RegistrySearch.hRoot, sczKey, samDesired, &hKey); | 845 | hr = RegOpenEx(pSearch->RegistrySearch.hRoot, sczKey, KEY_QUERY_VALUE, pSearch->RegistrySearch.fWin64 ? REG_KEY_64BIT : REG_KEY_32BIT, &hKey); |
| 852 | if (SUCCEEDED(hr)) | 846 | if (SUCCEEDED(hr)) |
| 853 | { | 847 | { |
| 854 | fExists = TRUE; | 848 | fExists = TRUE; |
| @@ -922,12 +916,6 @@ static HRESULT RegistrySearchValue( | |||
| 922 | LPBYTE pData = NULL; | 916 | LPBYTE pData = NULL; |
| 923 | DWORD cch = 0; | 917 | DWORD cch = 0; |
| 924 | BURN_VARIANT value = { }; | 918 | BURN_VARIANT value = { }; |
| 925 | REGSAM samDesired = KEY_QUERY_VALUE; | ||
| 926 | |||
| 927 | if (pSearch->RegistrySearch.fWin64) | ||
| 928 | { | ||
| 929 | samDesired = samDesired | KEY_WOW64_64KEY; | ||
| 930 | } | ||
| 931 | 919 | ||
| 932 | // format key string | 920 | // format key string |
| 933 | hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); | 921 | hr = VariableFormatString(pVariables, pSearch->RegistrySearch.sczKey, &sczKey, NULL); |
| @@ -941,7 +929,7 @@ static HRESULT RegistrySearchValue( | |||
| 941 | } | 929 | } |
| 942 | 930 | ||
| 943 | // open key | 931 | // open key |
| 944 | hr = RegOpen(pSearch->RegistrySearch.hRoot, sczKey, samDesired, &hKey); | 932 | hr = RegOpenEx(pSearch->RegistrySearch.hRoot, sczKey, KEY_QUERY_VALUE, pSearch->RegistrySearch.fWin64 ? REG_KEY_64BIT : REG_KEY_32BIT, &hKey); |
| 945 | if (E_FILENOTFOUND == hr) | 933 | if (E_FILENOTFOUND == hr) |
| 946 | { | 934 | { |
| 947 | // What if there is a hidden variable in sczKey? | 935 | // What if there is a hidden variable in sczKey? |
