msi: Fix MSIREG_OpenUserComponentsKey and MSIREG_DeleteUpgradeCodesKey for Wow64.

Hans Leidekker hans at codeweavers.com
Tue Nov 29 02:43:59 CST 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/msi/registry.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 1f87cbb..cbc8d8d 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -653,6 +653,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 {
     WCHAR squashed_cc[SQUASHED_GUID_SIZE], keypath[0x200];
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     UINT ret;
 
     if (!squash_guid( szComponent, squashed_cc)) return ERROR_FUNCTION_FAILED;
@@ -667,7 +668,7 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 
     strcpyW(keypath, szInstaller_Components);
     strcatW( keypath, squashed_cc );
-    return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+    return RegOpenKeyExW( HKEY_LOCAL_MACHINE, keypath, 0, access, key );
 }
 
 UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)
@@ -942,14 +943,18 @@ UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL creat
 
 UINT MSIREG_DeleteUpgradeCodesKey( const WCHAR *code )
 {
-    WCHAR squashed_code[SQUASHED_GUID_SIZE], keypath[0x200];
+    WCHAR squashed_code[SQUASHED_GUID_SIZE];
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
+    HKEY hkey;
+    LONG ret;
 
     if (!squash_guid( code, squashed_code )) return ERROR_FUNCTION_FAILED;
     TRACE( "%s squashed %s\n", debugstr_w(code), debugstr_w(squashed_code) );
 
-    strcpyW( keypath, szInstaller_UpgradeCodes );
-    strcatW( keypath, squashed_code );
-    return RegDeleteTreeW( HKEY_LOCAL_MACHINE, keypath );
+    if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, szInstaller_UpgradeCodes, 0, access, &hkey )) return ERROR_SUCCESS;
+    ret = RegDeleteTreeW( hkey, squashed_code );
+    RegCloseKey( hkey );
+    return ret;
 }
 
 UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
-- 
2.1.4




More information about the wine-patches mailing list