James Hawkins : msi: Open the local user data product key for the machine context.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:45:53 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Mon Jun 23 23:04:04 2008 -0500

msi: Open the local user data product key for the machine context.

---

 dlls/msi/action.c        |   16 +++++++++-------
 dlls/msi/msipriv.h       |    1 +
 dlls/msi/registry.c      |   18 ++++++++++++++++++
 dlls/msi/tests/install.c |   10 ++--------
 4 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 6761b39..955b796 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -3547,17 +3547,23 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
     if (!msi_check_publish(package))
         return ERROR_SUCCESS;
 
-    /* ok there is a lot more done here but i need to figure out what */
-
     if (package->Context == MSIINSTALLCONTEXT_MACHINE)
     {
         rc = MSIREG_OpenLocalClassesProductKey(package->ProductCode, &hukey, TRUE);
         if (rc != ERROR_SUCCESS)
             goto end;
+
+        rc = MSIREG_OpenLocalUserDataProductKey(package->ProductCode, &hudkey, TRUE);
+        if (rc != ERROR_SUCCESS)
+            goto end;
     }
     else
     {
-        rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE);
+        rc = MSIREG_OpenUserProductsKey(package->ProductCode, &hukey, TRUE);
+        if (rc != ERROR_SUCCESS)
+            goto end;
+
+        rc = MSIREG_OpenUserDataProductKey(package->ProductCode, &hudkey, TRUE);
         if (rc != ERROR_SUCCESS)
             goto end;
     }
@@ -3568,10 +3574,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
 
     RegCloseKey(source);
 
-    rc = MSIREG_OpenUserDataProductKey(package->ProductCode,&hudkey,TRUE);
-    if (rc != ERROR_SUCCESS)
-        goto end;
-
     rc = msi_publish_upgrade_code(package);
     if (rc != ERROR_SUCCESS)
         goto end;
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index e2c18e4..096bb88 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -773,6 +773,7 @@ extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL
 extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create);
+extern UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenLocalSystemInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
 extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index c3d425d..1d308d4 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -809,6 +809,24 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create)
     return rc;
 }
 
+UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create)
+{
+    WCHAR squished_pc[GUID_SIZE];
+    WCHAR keypath[0x200];
+
+    TRACE("%s\n", debugstr_w(szProduct));
+    if (!squash_guid(szProduct, squished_pc))
+        return ERROR_FUNCTION_FAILED;
+    TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+    sprintfW(keypath, szUserDataProd_fmt, localsid, squished_pc);
+
+    if (create)
+        return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+    return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+}
+
 static UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
                                     HKEY *key, BOOL create)
 {
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 23e0c76..7598023 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2589,16 +2589,10 @@ static void test_publish_publishproduct(void)
 
     sprintf(keypath, prodpath, "S-1-5-18");
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
-    todo_wine
-    {
-        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    }
+    ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
     res = RegOpenKeyA(hkey, "InstallProperties", &props);
-    todo_wine
-    {
-        ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
-    }
+    ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
 
     res = RegOpenKeyA(hkey, "Patches", &patches);
     todo_wine




More information about the wine-cvs mailing list