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/libs/dutil | |
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/libs/dutil')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/butil.cpp | 232 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/butil.h | 7 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/regutil.h | 9 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/monutil.cpp | 13 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/precomp.h | 2 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/regutil.cpp | 19 |
6 files changed, 121 insertions, 161 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/butil.cpp b/src/libs/dutil/WixToolset.DUtil/butil.cpp index 4262d573..2f45da56 100644 --- a/src/libs/dutil/WixToolset.DUtil/butil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/butil.cpp | |||
@@ -63,13 +63,6 @@ static HRESULT CopyStringToBuffer( | |||
63 | __in_z_opt LPWSTR wzBuffer, | 63 | __in_z_opt LPWSTR wzBuffer, |
64 | __inout SIZE_T* pcchBuffer | 64 | __inout SIZE_T* pcchBuffer |
65 | ); | 65 | ); |
66 | static HRESULT DoBundleEnumRelatedBundle( | ||
67 | __in HKEY hkRoot, | ||
68 | __in REG_KEY_BITNESS kbKeyBitness, | ||
69 | __in_z LPCWSTR wzUpgradeCode, | ||
70 | __inout PDWORD pdwStartIndex, | ||
71 | __deref_out_z LPWSTR* psczBundleId | ||
72 | ); | ||
73 | 66 | ||
74 | 67 | ||
75 | DAPI_(HRESULT) BundleGetBundleInfo( | 68 | DAPI_(HRESULT) BundleGetBundleInfo( |
@@ -156,11 +149,21 @@ LExit: | |||
156 | DAPI_(HRESULT) BundleEnumRelatedBundle( | 149 | DAPI_(HRESULT) BundleEnumRelatedBundle( |
157 | __in_z LPCWSTR wzUpgradeCode, | 150 | __in_z LPCWSTR wzUpgradeCode, |
158 | __in BUNDLE_INSTALL_CONTEXT context, | 151 | __in BUNDLE_INSTALL_CONTEXT context, |
152 | __in REG_KEY_BITNESS kbKeyBitness, | ||
159 | __inout PDWORD pdwStartIndex, | 153 | __inout PDWORD pdwStartIndex, |
160 | __deref_out_z LPWSTR* psczBundleId | 154 | __deref_out_z LPWSTR* psczBundleId |
161 | ) | 155 | ) |
162 | { | 156 | { |
163 | HRESULT hr = S_OK; | 157 | HRESULT hr = S_OK; |
158 | BOOL fUpgradeCodeFound = FALSE; | ||
159 | HKEY hkUninstall = NULL; | ||
160 | HKEY hkBundle = NULL; | ||
161 | LPWSTR sczUninstallSubKey = NULL; | ||
162 | LPWSTR sczUninstallSubKeyPath = NULL; | ||
163 | LPWSTR sczValue = NULL; | ||
164 | DWORD dwType = 0; | ||
165 | LPWSTR* rgsczBundleUpgradeCodes = NULL; | ||
166 | DWORD cBundleUpgradeCodes = 0; | ||
164 | HKEY hkRoot = BUNDLE_INSTALL_CONTEXT_USER == context ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; | 167 | HKEY hkRoot = BUNDLE_INSTALL_CONTEXT_USER == context ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; |
165 | 168 | ||
166 | if (!wzUpgradeCode || !pdwStartIndex) | 169 | if (!wzUpgradeCode || !pdwStartIndex) |
@@ -168,27 +171,105 @@ DAPI_(HRESULT) BundleEnumRelatedBundle( | |||
168 | ButilExitOnFailure(hr = E_INVALIDARG, "An invalid parameter was passed to the function."); | 171 | ButilExitOnFailure(hr = E_INVALIDARG, "An invalid parameter was passed to the function."); |
169 | } | 172 | } |
170 | 173 | ||
171 | hr = DoBundleEnumRelatedBundle(hkRoot, REG_KEY_DEFAULT, wzUpgradeCode, pdwStartIndex, psczBundleId); | 174 | hr = RegOpenEx(hkRoot, BUNDLE_REGISTRATION_REGISTRY_UNINSTALL_KEY, KEY_READ, kbKeyBitness, &hkUninstall); |
172 | ButilExitOnFailure(hr, "Failed to enumerate default-bitness bundles."); | 175 | ButilExitOnFailure(hr, "Failed to open bundle uninstall key path."); |
173 | if (S_FALSE == hr) | 176 | |
177 | for (DWORD dwIndex = *pdwStartIndex; !fUpgradeCodeFound; dwIndex++) | ||
174 | { | 178 | { |
175 | #if defined(_WIN64) | 179 | hr = RegKeyEnum(hkUninstall, dwIndex, &sczUninstallSubKey); |
176 | hr = DoBundleEnumRelatedBundle(hkRoot, REG_KEY_32BIT, wzUpgradeCode, pdwStartIndex, psczBundleId); | 180 | ButilExitOnFailure(hr, "Failed to enumerate bundle uninstall key path."); |
177 | ButilExitOnFailure(hr, "Failed to enumerate 32-bit bundles."); | 181 | |
178 | #else | 182 | hr = StrAllocFormatted(&sczUninstallSubKeyPath, L"%ls\\%ls", BUNDLE_REGISTRATION_REGISTRY_UNINSTALL_KEY, sczUninstallSubKey); |
179 | hr = DoBundleEnumRelatedBundle(hkRoot, REG_KEY_64BIT, wzUpgradeCode, pdwStartIndex, psczBundleId); | 183 | ButilExitOnFailure(hr, "Failed to allocate bundle uninstall key path."); |
180 | ButilExitOnFailure(hr, "Failed to enumerate 64-bit bundles."); | 184 | |
181 | #endif | 185 | hr = RegOpenEx(hkRoot, sczUninstallSubKeyPath, KEY_READ, kbKeyBitness, &hkBundle); |
186 | ButilExitOnFailure(hr, "Failed to open uninstall key path."); | ||
187 | |||
188 | // If it's a bundle, it should have a BundleUpgradeCode value of type REG_SZ (old) or REG_MULTI_SZ | ||
189 | hr = RegGetType(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &dwType); | ||
190 | if (FAILED(hr)) | ||
191 | { | ||
192 | ReleaseRegKey(hkBundle); | ||
193 | ReleaseNullStr(sczUninstallSubKey); | ||
194 | ReleaseNullStr(sczUninstallSubKeyPath); | ||
195 | // Not a bundle | ||
196 | continue; | ||
197 | } | ||
198 | |||
199 | switch (dwType) | ||
200 | { | ||
201 | case REG_SZ: | ||
202 | hr = RegReadString(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &sczValue); | ||
203 | ButilExitOnFailure(hr, "Failed to read BundleUpgradeCode string property."); | ||
204 | |||
205 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, sczValue, -1, wzUpgradeCode, -1)) | ||
206 | { | ||
207 | *pdwStartIndex = dwIndex; | ||
208 | fUpgradeCodeFound = TRUE; | ||
209 | break; | ||
210 | } | ||
211 | |||
212 | ReleaseNullStr(sczValue); | ||
213 | |||
214 | break; | ||
215 | case REG_MULTI_SZ: | ||
216 | hr = RegReadStringArray(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &rgsczBundleUpgradeCodes, &cBundleUpgradeCodes); | ||
217 | ButilExitOnFailure(hr, "Failed to read BundleUpgradeCode multi-string property."); | ||
218 | |||
219 | for (DWORD i = 0; i < cBundleUpgradeCodes; i++) | ||
220 | { | ||
221 | LPWSTR wzBundleUpgradeCode = rgsczBundleUpgradeCodes[i]; | ||
222 | if (wzBundleUpgradeCode && *wzBundleUpgradeCode) | ||
223 | { | ||
224 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, wzBundleUpgradeCode, -1, wzUpgradeCode, -1)) | ||
225 | { | ||
226 | *pdwStartIndex = dwIndex; | ||
227 | fUpgradeCodeFound = TRUE; | ||
228 | break; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | ReleaseNullStrArray(rgsczBundleUpgradeCodes, cBundleUpgradeCodes); | ||
233 | |||
234 | break; | ||
235 | |||
236 | default: | ||
237 | ButilExitWithRootFailure(hr, E_NOTIMPL, "BundleUpgradeCode of type 0x%x not implemented.", dwType); | ||
238 | } | ||
239 | |||
240 | if (fUpgradeCodeFound) | ||
241 | { | ||
242 | if (psczBundleId) | ||
243 | { | ||
244 | *psczBundleId = sczUninstallSubKey; | ||
245 | sczUninstallSubKey = NULL; | ||
246 | } | ||
247 | |||
248 | break; | ||
249 | } | ||
250 | |||
251 | // Cleanup before next iteration | ||
252 | ReleaseRegKey(hkBundle); | ||
253 | ReleaseNullStr(sczUninstallSubKey); | ||
254 | ReleaseNullStr(sczUninstallSubKeyPath); | ||
182 | } | 255 | } |
183 | 256 | ||
184 | LExit: | 257 | LExit: |
185 | return hr; | 258 | ReleaseStr(sczValue); |
259 | ReleaseStr(sczUninstallSubKey); | ||
260 | ReleaseStr(sczUninstallSubKeyPath); | ||
261 | ReleaseRegKey(hkBundle); | ||
262 | ReleaseRegKey(hkUninstall); | ||
263 | ReleaseStrArray(rgsczBundleUpgradeCodes, cBundleUpgradeCodes); | ||
264 | |||
265 | return FAILED(hr) ? hr : fUpgradeCodeFound ? S_OK : S_FALSE; | ||
186 | } | 266 | } |
187 | 267 | ||
188 | 268 | ||
189 | DAPI_(HRESULT) BundleEnumRelatedBundleFixed( | 269 | DAPI_(HRESULT) BundleEnumRelatedBundleFixed( |
190 | __in_z LPCWSTR wzUpgradeCode, | 270 | __in_z LPCWSTR wzUpgradeCode, |
191 | __in BUNDLE_INSTALL_CONTEXT context, | 271 | __in BUNDLE_INSTALL_CONTEXT context, |
272 | __in REG_KEY_BITNESS kbKeyBitness, | ||
192 | __inout PDWORD pdwStartIndex, | 273 | __inout PDWORD pdwStartIndex, |
193 | __out_ecount(MAX_GUID_CHARS+1) LPWSTR wzBundleId | 274 | __out_ecount(MAX_GUID_CHARS+1) LPWSTR wzBundleId |
194 | ) | 275 | ) |
@@ -197,7 +278,7 @@ DAPI_(HRESULT) BundleEnumRelatedBundleFixed( | |||
197 | LPWSTR sczValue = NULL; | 278 | LPWSTR sczValue = NULL; |
198 | size_t cchValue = 0; | 279 | size_t cchValue = 0; |
199 | 280 | ||
200 | hr = BundleEnumRelatedBundle(wzUpgradeCode, context, pdwStartIndex, &sczValue); | 281 | hr = BundleEnumRelatedBundle(wzUpgradeCode, context, kbKeyBitness, pdwStartIndex, &sczValue); |
201 | if (S_OK == hr && wzBundleId) | 282 | if (S_OK == hr && wzBundleId) |
202 | { | 283 | { |
203 | hr = ::StringCchLengthW(sczValue, STRSAFE_MAX_CCH, &cchValue); | 284 | hr = ::StringCchLengthW(sczValue, STRSAFE_MAX_CCH, &cchValue); |
@@ -396,116 +477,3 @@ static HRESULT CopyStringToBuffer( | |||
396 | 477 | ||
397 | return hr; | 478 | return hr; |
398 | } | 479 | } |
399 | |||
400 | static HRESULT DoBundleEnumRelatedBundle( | ||
401 | __in HKEY hkRoot, | ||
402 | __in REG_KEY_BITNESS kbKeyBitness, | ||
403 | __in_z LPCWSTR wzUpgradeCode, | ||
404 | __inout PDWORD pdwStartIndex, | ||
405 | __deref_out_z LPWSTR* psczBundleId | ||
406 | ) | ||
407 | { | ||
408 | HRESULT hr = S_OK; | ||
409 | BOOL fUpgradeCodeFound = FALSE; | ||
410 | HKEY hkUninstall = NULL; | ||
411 | HKEY hkBundle = NULL; | ||
412 | LPWSTR sczUninstallSubKey = NULL; | ||
413 | LPWSTR sczUninstallSubKeyPath = NULL; | ||
414 | LPWSTR sczValue = NULL; | ||
415 | DWORD dwType = 0; | ||
416 | LPWSTR* rgsczBundleUpgradeCodes = NULL; | ||
417 | DWORD cBundleUpgradeCodes = 0; | ||
418 | |||
419 | hr = RegOpenEx(hkRoot, BUNDLE_REGISTRATION_REGISTRY_UNINSTALL_KEY, KEY_READ, kbKeyBitness, &hkUninstall); | ||
420 | ButilExitOnFailure(hr, "Failed to open bundle uninstall key path."); | ||
421 | |||
422 | for (DWORD dwIndex = *pdwStartIndex; !fUpgradeCodeFound; dwIndex++) | ||
423 | { | ||
424 | hr = RegKeyEnum(hkUninstall, dwIndex, &sczUninstallSubKey); | ||
425 | ButilExitOnFailure(hr, "Failed to enumerate bundle uninstall key path."); | ||
426 | |||
427 | hr = StrAllocFormatted(&sczUninstallSubKeyPath, L"%ls\\%ls", BUNDLE_REGISTRATION_REGISTRY_UNINSTALL_KEY, sczUninstallSubKey); | ||
428 | ButilExitOnFailure(hr, "Failed to allocate bundle uninstall key path."); | ||
429 | |||
430 | hr = RegOpenEx(hkRoot, sczUninstallSubKeyPath, KEY_READ, kbKeyBitness, &hkBundle); | ||
431 | ButilExitOnFailure(hr, "Failed to open uninstall key path."); | ||
432 | |||
433 | // If it's a bundle, it should have a BundleUpgradeCode value of type REG_SZ (old) or REG_MULTI_SZ | ||
434 | hr = RegGetType(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &dwType); | ||
435 | if (FAILED(hr)) | ||
436 | { | ||
437 | ReleaseRegKey(hkBundle); | ||
438 | ReleaseNullStr(sczUninstallSubKey); | ||
439 | ReleaseNullStr(sczUninstallSubKeyPath); | ||
440 | // Not a bundle | ||
441 | continue; | ||
442 | } | ||
443 | |||
444 | switch (dwType) | ||
445 | { | ||
446 | case REG_SZ: | ||
447 | hr = RegReadString(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &sczValue); | ||
448 | ButilExitOnFailure(hr, "Failed to read BundleUpgradeCode string property."); | ||
449 | |||
450 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, sczValue, -1, wzUpgradeCode, -1)) | ||
451 | { | ||
452 | *pdwStartIndex = dwIndex; | ||
453 | fUpgradeCodeFound = TRUE; | ||
454 | break; | ||
455 | } | ||
456 | |||
457 | ReleaseNullStr(sczValue); | ||
458 | |||
459 | break; | ||
460 | case REG_MULTI_SZ: | ||
461 | hr = RegReadStringArray(hkBundle, BUNDLE_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE, &rgsczBundleUpgradeCodes, &cBundleUpgradeCodes); | ||
462 | ButilExitOnFailure(hr, "Failed to read BundleUpgradeCode multi-string property."); | ||
463 | |||
464 | for (DWORD i = 0; i < cBundleUpgradeCodes; i++) | ||
465 | { | ||
466 | LPWSTR wzBundleUpgradeCode = rgsczBundleUpgradeCodes[i]; | ||
467 | if (wzBundleUpgradeCode && *wzBundleUpgradeCode) | ||
468 | { | ||
469 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, wzBundleUpgradeCode, -1, wzUpgradeCode, -1)) | ||
470 | { | ||
471 | *pdwStartIndex = dwIndex; | ||
472 | fUpgradeCodeFound = TRUE; | ||
473 | break; | ||
474 | } | ||
475 | } | ||
476 | } | ||
477 | ReleaseNullStrArray(rgsczBundleUpgradeCodes, cBundleUpgradeCodes); | ||
478 | |||
479 | break; | ||
480 | |||
481 | default: | ||
482 | ButilExitWithRootFailure(hr, E_NOTIMPL, "BundleUpgradeCode of type 0x%x not implemented.", dwType); | ||
483 | } | ||
484 | |||
485 | if (fUpgradeCodeFound) | ||
486 | { | ||
487 | if (psczBundleId) | ||
488 | { | ||
489 | *psczBundleId = sczUninstallSubKey; | ||
490 | sczUninstallSubKey = NULL; | ||
491 | } | ||
492 | |||
493 | break; | ||
494 | } | ||
495 | |||
496 | // Cleanup before next iteration | ||
497 | ReleaseRegKey(hkBundle); | ||
498 | ReleaseNullStr(sczUninstallSubKey); | ||
499 | ReleaseNullStr(sczUninstallSubKeyPath); | ||
500 | } | ||
501 | |||
502 | LExit: | ||
503 | ReleaseStr(sczValue); | ||
504 | ReleaseStr(sczUninstallSubKey); | ||
505 | ReleaseStr(sczUninstallSubKeyPath); | ||
506 | ReleaseRegKey(hkBundle); | ||
507 | ReleaseRegKey(hkUninstall); | ||
508 | ReleaseStrArray(rgsczBundleUpgradeCodes, cBundleUpgradeCodes); | ||
509 | |||
510 | return FAILED(hr) ? hr : fUpgradeCodeFound ? S_OK : S_FALSE; | ||
511 | } | ||
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/butil.h b/src/libs/dutil/WixToolset.DUtil/inc/butil.h index 3b316e66..9c2010ee 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/butil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/butil.h | |||
@@ -60,7 +60,9 @@ HRESULT DAPI BundleGetBundleInfoFixed( | |||
60 | ); | 60 | ); |
61 | 61 | ||
62 | /******************************************************************** | 62 | /******************************************************************** |
63 | BundleEnumRelatedBundle - Queries the bundle installation metadata for installs with the given upgrade code | 63 | BundleEnumRelatedBundle - Queries the bundle installation metadata for installs with the given upgrade code. |
64 | Enumerate 32-bit and 64-bit in two passes. | ||
65 | |||
64 | RETURNS: | 66 | RETURNS: |
65 | E_INVALIDARG | 67 | E_INVALIDARG |
66 | An invalid parameter was passed to the function. | 68 | An invalid parameter was passed to the function. |
@@ -74,12 +76,14 @@ RETURNS: | |||
74 | HRESULT DAPI BundleEnumRelatedBundle( | 76 | HRESULT DAPI BundleEnumRelatedBundle( |
75 | __in_z LPCWSTR wzUpgradeCode, | 77 | __in_z LPCWSTR wzUpgradeCode, |
76 | __in BUNDLE_INSTALL_CONTEXT context, | 78 | __in BUNDLE_INSTALL_CONTEXT context, |
79 | __in REG_KEY_BITNESS kbKeyBitness, | ||
77 | __inout PDWORD pdwStartIndex, | 80 | __inout PDWORD pdwStartIndex, |
78 | __deref_out_z LPWSTR* psczBundleId | 81 | __deref_out_z LPWSTR* psczBundleId |
79 | ); | 82 | ); |
80 | 83 | ||
81 | /******************************************************************** | 84 | /******************************************************************** |
82 | BundleEnumRelatedBundleFixed - Queries the bundle installation metadata for installs with the given upgrade code | 85 | BundleEnumRelatedBundleFixed - Queries the bundle installation metadata for installs with the given upgrade code |
86 | Enumerate 32-bit and 64-bit in two passes. | ||
83 | 87 | ||
84 | NOTE: lpBundleIdBuff is a buffer to receive the bundle GUID. This buffer must be 39 characters long. | 88 | NOTE: lpBundleIdBuff is a buffer to receive the bundle GUID. This buffer must be 39 characters long. |
85 | The first 38 characters are for the GUID, and the last character is for the terminating null character. | 89 | The first 38 characters are for the GUID, and the last character is for the terminating null character. |
@@ -96,6 +100,7 @@ RETURNS: | |||
96 | HRESULT DAPI BundleEnumRelatedBundleFixed( | 100 | HRESULT DAPI BundleEnumRelatedBundleFixed( |
97 | __in_z LPCWSTR wzUpgradeCode, | 101 | __in_z LPCWSTR wzUpgradeCode, |
98 | __in BUNDLE_INSTALL_CONTEXT context, | 102 | __in BUNDLE_INSTALL_CONTEXT context, |
103 | __in REG_KEY_BITNESS kbKeyBitness, | ||
99 | __inout PDWORD pdwStartIndex, | 104 | __inout PDWORD pdwStartIndex, |
100 | __out_ecount(MAX_GUID_CHARS+1) LPWSTR wzBundleId | 105 | __out_ecount(MAX_GUID_CHARS+1) LPWSTR wzBundleId |
101 | ); | 106 | ); |
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h index db8e0c5c..3cbb53b0 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h | |||
@@ -408,6 +408,15 @@ BOOL DAPI RegValueExists( | |||
408 | __in REG_KEY_BITNESS kbKeyBitness | 408 | __in REG_KEY_BITNESS kbKeyBitness |
409 | ); | 409 | ); |
410 | 410 | ||
411 | /******************************************************************** | ||
412 | RegTranslateKeyBitness - Converts from REG_KEY_BITNESS values to | ||
413 | REGSAM-compatible values. | ||
414 | |||
415 | *********************************************************************/ | ||
416 | REGSAM DAPI RegTranslateKeyBitness( | ||
417 | __in REG_KEY_BITNESS kbKeyBitness | ||
418 | ); | ||
419 | |||
411 | #ifdef __cplusplus | 420 | #ifdef __cplusplus |
412 | } | 421 | } |
413 | #endif | 422 | #endif |
diff --git a/src/libs/dutil/WixToolset.DUtil/monutil.cpp b/src/libs/dutil/WixToolset.DUtil/monutil.cpp index 6a7f0596..6ad75b56 100644 --- a/src/libs/dutil/WixToolset.DUtil/monutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/monutil.cpp | |||
@@ -1677,18 +1677,7 @@ static REGSAM GetRegKeyBitness( | |||
1677 | __in MON_REQUEST *pRequest | 1677 | __in MON_REQUEST *pRequest |
1678 | ) | 1678 | ) |
1679 | { | 1679 | { |
1680 | if (REG_KEY_32BIT == pRequest->regkey.kbKeyBitness) | 1680 | return RegTranslateKeyBitness(pRequest->regkey.kbKeyBitness); |
1681 | { | ||
1682 | return KEY_WOW64_32KEY; | ||
1683 | } | ||
1684 | else if (REG_KEY_64BIT == pRequest->regkey.kbKeyBitness) | ||
1685 | { | ||
1686 | return KEY_WOW64_64KEY; | ||
1687 | } | ||
1688 | else | ||
1689 | { | ||
1690 | return 0; | ||
1691 | } | ||
1692 | } | 1681 | } |
1693 | 1682 | ||
1694 | static HRESULT DuplicateRemoveMessage( | 1683 | static HRESULT DuplicateRemoveMessage( |
diff --git a/src/libs/dutil/WixToolset.DUtil/precomp.h b/src/libs/dutil/WixToolset.DUtil/precomp.h index 093c16a2..902fe3e3 100644 --- a/src/libs/dutil/WixToolset.DUtil/precomp.h +++ b/src/libs/dutil/WixToolset.DUtil/precomp.h | |||
@@ -48,7 +48,6 @@ | |||
48 | #include "apputil.h" | 48 | #include "apputil.h" |
49 | #include "atomutil.h" | 49 | #include "atomutil.h" |
50 | #include "buffutil.h" | 50 | #include "buffutil.h" |
51 | #include "butil.h" | ||
52 | #include "cabcutil.h" | 51 | #include "cabcutil.h" |
53 | #include "cabutil.h" | 52 | #include "cabutil.h" |
54 | #include "conutil.h" | 53 | #include "conutil.h" |
@@ -76,6 +75,7 @@ | |||
76 | #include "polcutil.h" | 75 | #include "polcutil.h" |
77 | #include "procutil.h" | 76 | #include "procutil.h" |
78 | #include "regutil.h" | 77 | #include "regutil.h" |
78 | #include "butil.h" // NOTE: Butil must come after Regutil. | ||
79 | #include "resrutil.h" | 79 | #include "resrutil.h" |
80 | #include "reswutil.h" | 80 | #include "reswutil.h" |
81 | #include "rmutil.h" | 81 | #include "rmutil.h" |
diff --git a/src/libs/dutil/WixToolset.DUtil/regutil.cpp b/src/libs/dutil/WixToolset.DUtil/regutil.cpp index f4719466..219a6c11 100644 --- a/src/libs/dutil/WixToolset.DUtil/regutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/regutil.cpp | |||
@@ -32,9 +32,6 @@ static PFN_REGDELETEVALUEW vpfnRegDeleteValueW = ::RegDeleteValueW; | |||
32 | static HMODULE vhAdvApi32Dll = NULL; | 32 | static HMODULE vhAdvApi32Dll = NULL; |
33 | static BOOL vfRegInitialized = FALSE; | 33 | static BOOL vfRegInitialized = FALSE; |
34 | 34 | ||
35 | static REGSAM TranslateKeyBitness( | ||
36 | __in REG_KEY_BITNESS kbKeyBitness | ||
37 | ); | ||
38 | static HRESULT WriteStringToRegistry( | 35 | static HRESULT WriteStringToRegistry( |
39 | __in HKEY hk, | 36 | __in HKEY hk, |
40 | __in_z_opt LPCWSTR wzName, | 37 | __in_z_opt LPCWSTR wzName, |
@@ -135,7 +132,7 @@ DAPI_(HRESULT) RegCreateEx( | |||
135 | DWORD er = ERROR_SUCCESS; | 132 | DWORD er = ERROR_SUCCESS; |
136 | DWORD dwDisposition; | 133 | DWORD dwDisposition; |
137 | 134 | ||
138 | REGSAM samDesired = TranslateKeyBitness(kbKeyBitness); | 135 | REGSAM samDesired = RegTranslateKeyBitness(kbKeyBitness); |
139 | er = vpfnRegCreateKeyExW(hkRoot, wzSubKey, 0, NULL, fVolatile ? REG_OPTION_VOLATILE : REG_OPTION_NON_VOLATILE, dwAccess | samDesired, pSecurityAttributes, phk, &dwDisposition); | 136 | er = vpfnRegCreateKeyExW(hkRoot, wzSubKey, 0, NULL, fVolatile ? REG_OPTION_VOLATILE : REG_OPTION_NON_VOLATILE, dwAccess | samDesired, pSecurityAttributes, phk, &dwDisposition); |
140 | RegExitOnWin32Error(er, hr, "Failed to create registry key."); | 137 | RegExitOnWin32Error(er, hr, "Failed to create registry key."); |
141 | 138 | ||
@@ -171,7 +168,7 @@ DAPI_(HRESULT) RegOpenEx( | |||
171 | HRESULT hr = S_OK; | 168 | HRESULT hr = S_OK; |
172 | DWORD er = ERROR_SUCCESS; | 169 | DWORD er = ERROR_SUCCESS; |
173 | 170 | ||
174 | REGSAM samDesired = TranslateKeyBitness(kbKeyBitness); | 171 | REGSAM samDesired = RegTranslateKeyBitness(kbKeyBitness); |
175 | er = vpfnRegOpenKeyExW(hkRoot, wzSubKey, 0, dwAccess | samDesired, phk); | 172 | er = vpfnRegOpenKeyExW(hkRoot, wzSubKey, 0, dwAccess | samDesired, phk); |
176 | if (E_FILENOTFOUND == HRESULT_FROM_WIN32(er)) | 173 | if (E_FILENOTFOUND == HRESULT_FROM_WIN32(er)) |
177 | { | 174 | { |
@@ -229,7 +226,7 @@ DAPI_(HRESULT) RegDelete( | |||
229 | 226 | ||
230 | if (NULL != vpfnRegDeleteKeyExW) | 227 | if (NULL != vpfnRegDeleteKeyExW) |
231 | { | 228 | { |
232 | REGSAM samDesired = TranslateKeyBitness(kbKeyBitness); | 229 | REGSAM samDesired = RegTranslateKeyBitness(kbKeyBitness); |
233 | er = vpfnRegDeleteKeyExW(hkRoot, wzSubKey, samDesired, 0); | 230 | er = vpfnRegDeleteKeyExW(hkRoot, wzSubKey, samDesired, 0); |
234 | if (E_FILENOTFOUND == HRESULT_FROM_WIN32(er)) | 231 | if (E_FILENOTFOUND == HRESULT_FROM_WIN32(er)) |
235 | { | 232 | { |
@@ -912,11 +909,6 @@ LExit: | |||
912 | return hr; | 909 | return hr; |
913 | } | 910 | } |
914 | 911 | ||
915 | /******************************************************************** | ||
916 | RegValueExists - determines whether a named value exists in a | ||
917 | specified subkey. | ||
918 | |||
919 | *********************************************************************/ | ||
920 | DAPI_(BOOL) RegValueExists( | 912 | DAPI_(BOOL) RegValueExists( |
921 | __in HKEY hk, | 913 | __in HKEY hk, |
922 | __in_z LPCWSTR wzSubKey, | 914 | __in_z LPCWSTR wzSubKey, |
@@ -940,7 +932,7 @@ LExit: | |||
940 | return SUCCEEDED(hr); | 932 | return SUCCEEDED(hr); |
941 | } | 933 | } |
942 | 934 | ||
943 | static REGSAM TranslateKeyBitness( | 935 | DAPI_(REGSAM) RegTranslateKeyBitness( |
944 | __in REG_KEY_BITNESS kbKeyBitness | 936 | __in REG_KEY_BITNESS kbKeyBitness |
945 | ) | 937 | ) |
946 | { | 938 | { |
@@ -948,14 +940,11 @@ static REGSAM TranslateKeyBitness( | |||
948 | { | 940 | { |
949 | case REG_KEY_32BIT: | 941 | case REG_KEY_32BIT: |
950 | return KEY_WOW64_32KEY; | 942 | return KEY_WOW64_32KEY; |
951 | break; | ||
952 | case REG_KEY_64BIT: | 943 | case REG_KEY_64BIT: |
953 | return KEY_WOW64_64KEY; | 944 | return KEY_WOW64_64KEY; |
954 | break; | ||
955 | case REG_KEY_DEFAULT: | 945 | case REG_KEY_DEFAULT: |
956 | default: | 946 | default: |
957 | return 0; | 947 | return 0; |
958 | break; | ||
959 | } | 948 | } |
960 | } | 949 | } |
961 | 950 | ||