msi: More Wow64 fixes.

Hans Leidekker hans at codeweavers.com
Wed Apr 6 02:52:16 CDT 2011


---
 dlls/msi/msi.c          |    6 +++---
 dlls/msi/registry.c     |   24 ++++++++++++++----------
 dlls/msi/tests/action.c |    8 ++++----
 3 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 44a4e21..def9e72 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1571,11 +1571,11 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
 
     r = ERROR_UNKNOWN_PATCH;
 
-    res = RegOpenKeyExW(udprod, szPatches, 0, KEY_READ, &patches);
+    res = RegOpenKeyExW(udprod, szPatches, 0, KEY_WOW64_64KEY|KEY_READ, &patches);
     if (res != ERROR_SUCCESS)
         goto done;
 
-    res = RegOpenKeyExW(patches, squished_patch, 0, KEY_READ, &patch);
+    res = RegOpenKeyExW(patches, squished_patch, 0, KEY_WOW64_64KEY|KEY_READ, &patch);
     if (res != ERROR_SUCCESS)
         goto done;
 
@@ -1585,7 +1585,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
                                   &prod, FALSE) != ERROR_SUCCESS)
             goto done;
 
-        res = RegOpenKeyExW(prod, szPatches, 0, KEY_ALL_ACCESS, &prodpatches);
+        res = RegOpenKeyExW(prod, szPatches, 0, KEY_WOW64_64KEY|KEY_ALL_ACCESS, &prodpatches);
         if (res != ERROR_SUCCESS)
             goto done;
 
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 5db5a4b..353cb6d 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -150,9 +150,11 @@ static const WCHAR szInstaller_LocalClassesFeat[] = {
     'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\',0};
 
 static const WCHAR szInstaller_ClassesUpgradeCode[] = {
+    'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\',
     'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s','\\',0};
 
 static const WCHAR szInstaller_ClassesUpgradeCodes[] = {
+    'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\',
     'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s',0};
 
 static const WCHAR szInstaller_Features[] = {
@@ -991,8 +993,8 @@ UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL cr
     strcpyW(keypath, szInstaller_ClassesUpgradeCode);
     strcatW(keypath, squished_pc);
 
-    if (create) return RegCreateKeyExW(HKEY_CLASSES_ROOT, keypath, 0, NULL, 0, access, NULL, key, NULL);
-    return RegOpenKeyExW(HKEY_CLASSES_ROOT, keypath, 0, access, key);
+    if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
+    return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 }
 
 UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
@@ -1005,7 +1007,7 @@ UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
     if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
     TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
 
-    if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szInstaller_ClassesUpgradeCodes, 0, access, &hkey)) return ERROR_SUCCESS;
+    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_ClassesUpgradeCodes, 0, access, &hkey)) return ERROR_SUCCESS;
     r = RegDeleteTreeW(hkey, squished_pc);
     RegCloseKey(hkey);
     return r;
@@ -1143,6 +1145,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
     UINT r;
     WCHAR szKeyName[SQUISH_GUID_SIZE];
     HKEY key;
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     DWORD machine_count, managed_count, unmanaged_count;
     WCHAR keypath[MAX_PATH];
     LPWSTR usersid = NULL;
@@ -1158,7 +1161,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
         return ERROR_INVALID_PARAMETER;
 
     key = 0;
-    r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProducts, &key);
+    r = RegCreateKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProducts, 0, NULL, 0, access, NULL, &key, NULL);
     if( r != ERROR_SUCCESS ) goto failed;
 
     r = RegQueryInfoKeyW(key, NULL, NULL, NULL, &machine_count, NULL, NULL,
@@ -1188,7 +1191,7 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid)
     sprintfW(keypath, szInstaller_LocalManaged_fmt, usersid);
     LocalFree(usersid);
 
-    r = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, &key);
+    r = RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &key, NULL);
     if( r != ERROR_SUCCESS ) goto failed;
 
     r = RegQueryInfoKeyW(key, NULL, NULL, NULL, &managed_count, NULL, NULL,
@@ -1301,21 +1304,22 @@ UINT WINAPI MsiEnumComponentsA(DWORD index, LPSTR lpguid)
 
 UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid)
 {
-    HKEY hkeyComponents = 0;
-    DWORD r;
+    HKEY hkey;
+    REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     WCHAR szKeyName[SQUISH_GUID_SIZE];
+    DWORD r;
 
     TRACE("%d %p\n", index, lpguid);
 
-    r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_Components, &hkeyComponents);
+    r = RegCreateKeyExW(HKEY_LOCAL_MACHINE, szInstaller_Components, 0, NULL, 0, access, NULL, &hkey, NULL);
     if( r != ERROR_SUCCESS )
         return ERROR_NO_MORE_ITEMS;
 
-    r = RegEnumKeyW(hkeyComponents, index, szKeyName, SQUISH_GUID_SIZE);
+    r = RegEnumKeyW(hkey, index, szKeyName, SQUISH_GUID_SIZE);
     if( r == ERROR_SUCCESS )
         unsquash_guid(szKeyName, lpguid);
-    RegCloseKey(hkeyComponents);
 
+    RegCloseKey(hkey);
     return r;
 }
 
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index 2643e39..1d06509 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -2781,8 +2781,8 @@ static void test_publish_product(void)
     static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
                                   "\\Installer\\Products"
                                   "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
-    static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
-    static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
+    static const CHAR machprod[] = "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
+    static const CHAR machup[] = "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
 
     if (is_process_limited())
     {
@@ -2936,7 +2936,7 @@ currentuser:
     RegCloseKey(hkey);
 
 machprod:
-    res = RegOpenKeyExA(HKEY_CLASSES_ROOT, machprod, 0, access, &hkey);
+    res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
@@ -2982,7 +2982,7 @@ machprod:
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
     RegCloseKey(hkey);
 
-    res = RegOpenKeyExA(HKEY_CLASSES_ROOT, machup, 0, access, &hkey);
+    res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
-- 
1.7.4.1






More information about the wine-patches mailing list