msi: Handle features installed as source in MsiQueryFeatureState.
This commit is contained in:
parent
ad156168d1
commit
63064f7a45
|
@ -1905,6 +1905,7 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
|
|||
INSTALLSTATE r;
|
||||
BOOL missing = FALSE;
|
||||
BOOL machine = FALSE;
|
||||
BOOL source = FALSE;
|
||||
|
||||
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szFeature));
|
||||
|
||||
|
@ -1978,6 +1979,12 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
|
|||
path = msi_reg_get_val_str(hkey, squishProduct);
|
||||
if (!path)
|
||||
missing = TRUE;
|
||||
else if (lstrlenW(path) > 2 &&
|
||||
path[0] >= '0' && path[0] <= '9' &&
|
||||
path[1] >= '0' && path[1] <= '9')
|
||||
{
|
||||
source = TRUE;
|
||||
}
|
||||
|
||||
msi_free(path);
|
||||
}
|
||||
|
@ -1988,6 +1995,9 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
|
|||
if (missing)
|
||||
return INSTALLSTATE_ADVERTISED;
|
||||
|
||||
if (source)
|
||||
return INSTALLSTATE_SOURCE;
|
||||
|
||||
return INSTALLSTATE_LOCAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -920,6 +920,35 @@ static void test_MsiQueryFeatureState(void)
|
|||
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"apple", 1);
|
||||
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");
|
||||
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
|
||||
|
||||
|
|
|
@ -3730,20 +3730,14 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "one", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "two", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
|
@ -4477,20 +4471,14 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "one", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "two", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
|
@ -4521,20 +4509,14 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "six", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "seven", &state, &action);
|
||||
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);
|
||||
|
||||
state = 0xdeadbee;
|
||||
|
@ -5221,21 +5203,15 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "one", &state, &action);
|
||||
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;
|
||||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "two", &state, &action);
|
||||
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;
|
||||
action = 0xdeadbee;
|
||||
|
@ -5265,21 +5241,15 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "six", &state, &action);
|
||||
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;
|
||||
action = 0xdeadbee;
|
||||
r = MsiGetFeatureState(hpkg, "seven", &state, &action);
|
||||
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;
|
||||
action = 0xdeadbee;
|
||||
|
|
Loading…
Reference in New Issue