Commit db6dbcf2 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Initialize the installation context from the registry if the product is installed.

parent 70e37907
...@@ -488,14 +488,15 @@ static BOOL needs_ui_sequence(MSIPACKAGE *package) ...@@ -488,14 +488,15 @@ static BOOL needs_ui_sequence(MSIPACKAGE *package)
UINT msi_set_context(MSIPACKAGE *package) UINT msi_set_context(MSIPACKAGE *package)
{ {
int num; UINT r = msi_locate_product( package->ProductCode, &package->Context );
if (r != ERROR_SUCCESS)
package->Context = MSIINSTALLCONTEXT_USERUNMANAGED; {
int num = msi_get_property_int( package->db, szAllUsers, 0 );
num = msi_get_property_int(package->db, szAllUsers, 0); if (num == 1 || num == 2)
if (num == 1 || num == 2) package->Context = MSIINSTALLCONTEXT_MACHINE;
package->Context = MSIINSTALLCONTEXT_MACHINE; else
package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
}
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -54,6 +54,7 @@ UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context) ...@@ -54,6 +54,7 @@ UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
HKEY hkey = NULL; HKEY hkey = NULL;
*context = MSIINSTALLCONTEXT_NONE; *context = MSIINSTALLCONTEXT_NONE;
if (!szProduct) return ERROR_UNKNOWN_PRODUCT;
if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED, if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
&hkey, FALSE) == ERROR_SUCCESS) &hkey, FALSE) == ERROR_SUCCESS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment