[5/7] msi: Initialize the installation context from the registry if the product is installed.

Hans Leidekker hans at codeweavers.com
Tue Aug 23 07:42:15 CDT 2011


---
 dlls/msi/action.c |   17 +++++++++--------
 dlls/msi/msi.c    |    1 +
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index bea3052..71f4f6a 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -488,14 +488,15 @@ static BOOL needs_ui_sequence(MSIPACKAGE *package)
 
 UINT msi_set_context(MSIPACKAGE *package)
 {
-    int num;
-
-    package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
-
-    num = msi_get_property_int(package->db, szAllUsers, 0);
-    if (num == 1 || num == 2)
-        package->Context = MSIINSTALLCONTEXT_MACHINE;
-
+    UINT r = msi_locate_product( package->ProductCode, &package->Context );
+    if (r != ERROR_SUCCESS)
+    {
+        int num = msi_get_property_int( package->db, szAllUsers, 0 );
+        if (num == 1 || num == 2)
+            package->Context = MSIINSTALLCONTEXT_MACHINE;
+        else
+            package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
+    }
     return ERROR_SUCCESS;
 }
 
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 2a8fa72..7506338 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -54,6 +54,7 @@ UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
     HKEY hkey = NULL;
 
     *context = MSIINSTALLCONTEXT_NONE;
+    if (!szProduct) return ERROR_UNKNOWN_PRODUCT;
 
     if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
                               &hkey, FALSE) == ERROR_SUCCESS)
-- 
1.7.4.1







More information about the wine-patches mailing list