Commit 63064f7a authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Handle features installed as source in MsiQueryFeatureState.

parent ad156168
...@@ -1905,6 +1905,7 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature) ...@@ -1905,6 +1905,7 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
INSTALLSTATE r; INSTALLSTATE r;
BOOL missing = FALSE; BOOL missing = FALSE;
BOOL machine = FALSE; BOOL machine = FALSE;
BOOL source = FALSE;
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature)); TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
...@@ -1978,6 +1979,12 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature) ...@@ -1978,6 +1979,12 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
path = msi_reg_get_val_str(hkey, squishProduct); path = msi_reg_get_val_str(hkey, squishProduct);
if (!path) if (!path)
missing = TRUE; missing = TRUE;
else if (lstrlenW(path) > 2 &&
path[0] >= '0' && path[0] <= '9' &&
path[1] >= '0' && path[1] <= '9')
{
source = TRUE;
}
msi_free(path); msi_free(path);
} }
...@@ -1988,6 +1995,9 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature) ...@@ -1988,6 +1995,9 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
if (missing) if (missing)
return INSTALLSTATE_ADVERTISED; return INSTALLSTATE_ADVERTISED;
if (source)
return INSTALLSTATE_SOURCE;
return INSTALLSTATE_LOCAL; return INSTALLSTATE_LOCAL;
} }
......
...@@ -920,6 +920,35 @@ static void test_MsiQueryFeatureState(void) ...@@ -920,6 +920,35 @@ static void test_MsiQueryFeatureState(void)
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1); res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* INSTALLSTATE_LOCAL */
state = MsiQueryFeatureStateA(prodcode, "feature");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"01\\", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* INSTALLSTATE_SOURCE */
state = MsiQueryFeatureStateA(prodcode, "feature");
ok(state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"01", 3);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* bad INSTALLSTATE_SOURCE */
state = MsiQueryFeatureStateA(prodcode, "feature");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"01a", 4);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* INSTALLSTATE_SOURCE */
state = MsiQueryFeatureStateA(prodcode, "feature");
ok(state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"01", 3);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* bad INSTALLSTATE_SOURCE */
state = MsiQueryFeatureStateA(prodcode, "feature"); state = MsiQueryFeatureStateA(prodcode, "feature");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
......
...@@ -3730,20 +3730,14 @@ static void test_states(void) ...@@ -3730,20 +3730,14 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "one", &state, &action); r = MsiGetFeatureState(hpkg, "one", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "two", &state, &action); r = MsiGetFeatureState(hpkg, "two", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
...@@ -4477,20 +4471,14 @@ static void test_states(void) ...@@ -4477,20 +4471,14 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "one", &state, &action); r = MsiGetFeatureState(hpkg, "one", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "two", &state, &action); r = MsiGetFeatureState(hpkg, "two", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
...@@ -4521,20 +4509,14 @@ static void test_states(void) ...@@ -4521,20 +4509,14 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "six", &state, &action); r = MsiGetFeatureState(hpkg, "six", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "seven", &state, &action); r = MsiGetFeatureState(hpkg, "seven", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
...@@ -5221,21 +5203,15 @@ static void test_states(void) ...@@ -5221,21 +5203,15 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "one", &state, &action); r = MsiGetFeatureState(hpkg, "one", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "two", &state, &action); r = MsiGetFeatureState(hpkg, "two", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
...@@ -5265,21 +5241,15 @@ static void test_states(void) ...@@ -5265,21 +5241,15 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "six", &state, &action); r = MsiGetFeatureState(hpkg, "six", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "seven", &state, &action); r = MsiGetFeatureState(hpkg, "seven", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
}
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
......
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