Hans Leidekker : msi: Fix MSIREG_OpenUserComponentsKey and MSIREG_DeleteUpgradeCodesKey for Wow64.

Alexandre Julliard julliard at winehq.org
Tue Nov 29 16:01:38 CST 2016


Module: wine
Branch: master
Commit: 3b5b3ef185fc303b7b64dd27365b5e9992cbe730
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3b5b3ef185fc303b7b64dd27365b5e9992cbe730

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Nov 29 09:43:59 2016 +0100

msi: Fix MSIREG_OpenUserComponentsKey and MSIREG_DeleteUpgradeCodesKey for Wow64.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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)




More information about the wine-cvs mailing list