James Hawkins : msi: Handle the machine context in MsiQueryFeatureState.
Alexandre Julliard
julliard at winehq.org
Tue Jun 24 06:46:02 CDT 2008
Module: wine
Branch: master
Commit: 72fedf7d88e09125ca274e2d6fd3273d2fda9b48
URL: http://source.winehq.org/git/wine.git/?a=commit;h=72fedf7d88e09125ca274e2d6fd3273d2fda9b48
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Mon Jun 23 23:07:11 2008 -0500
msi: Handle the machine context in MsiQueryFeatureState.
---
dlls/msi/msi.c | 21 +++++++++++++++++----
dlls/msi/tests/msi.c | 45 +++++++++------------------------------------
2 files changed, 26 insertions(+), 40 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index b2e1345..7c83946 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1812,6 +1812,7 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
HKEY hkey;
INSTALLSTATE r;
BOOL missing = FALSE;
+ BOOL machine = FALSE;
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
@@ -1824,7 +1825,11 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
if (MSIREG_OpenManagedFeaturesKey(szProduct, &hkey, FALSE) != ERROR_SUCCESS &&
MSIREG_OpenUserFeaturesKey(szProduct, &hkey, FALSE) != ERROR_SUCCESS)
{
- return INSTALLSTATE_UNKNOWN;
+ rc = MSIREG_OpenLocalClassesFeaturesKey(szProduct, &hkey, FALSE);
+ if (rc != ERROR_SUCCESS)
+ return INSTALLSTATE_UNKNOWN;
+
+ machine = TRUE;
}
parent_feature = msi_reg_get_val_str( hkey, szFeature );
@@ -1838,8 +1843,11 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
if (r == INSTALLSTATE_ABSENT)
return r;
- /* now check if it's complete or advertised */
- rc = MSIREG_OpenUserDataFeaturesKey(szProduct, &hkey, FALSE);
+ if (machine)
+ rc = MSIREG_OpenLocalUserDataFeaturesKey(szProduct, &hkey, FALSE);
+ else
+ rc = MSIREG_OpenUserDataFeaturesKey(szProduct, &hkey, FALSE);
+
if (rc != ERROR_SUCCESS)
return INSTALLSTATE_ADVERTISED;
@@ -1863,7 +1871,12 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
}
StringFromGUID2(&guid, comp, GUID_SIZE);
- rc = MSIREG_OpenUserDataComponentKey(comp, &hkey, FALSE);
+
+ if (machine)
+ rc = MSIREG_OpenLocalUserDataComponentKey(comp, &hkey, FALSE);
+ else
+ rc = MSIREG_OpenUserDataComponentKey(comp, &hkey, FALSE);
+
if (rc != ERROR_SUCCESS)
{
msi_free(components);
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index f094c2d..2ec93ab 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -930,10 +930,7 @@ static void test_MsiQueryFeatureState(void)
/* feature value exists */
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
lstrcatA(keypath, "S-1-5-18\\Products\\");
@@ -945,46 +942,31 @@ static void test_MsiQueryFeatureState(void)
/* userdata features key exists */
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaa", 20);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_BADCONFIG, "Expected INSTALLSTATE_BADCONFIG, got %d\n", state);
res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaa", 21);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)"aaaaaaaaaaaaaaaaaaaaa", 22);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegSetValueExA(localkey, "feature", 0, REG_SZ, (const BYTE *)comp_base85, 21);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
lstrcatA(keypath, "S-1-5-18\\Components\\");
@@ -994,28 +976,19 @@ static void test_MsiQueryFeatureState(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"", 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
- todo_wine
- {
- ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
- }
+ ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(compkey, "");
More information about the wine-cvs
mailing list