msi: Test the states of a component with a compressed file.
This commit is contained in:
parent
5842af1b95
commit
59a706bc2b
|
@ -83,6 +83,21 @@ static UINT create_feature_components_table( MSIHANDLE hdb )
|
|||
"PRIMARY KEY `Feature_`, `Component_` )" );
|
||||
}
|
||||
|
||||
static UINT create_file_table( MSIHANDLE hdb )
|
||||
{
|
||||
return run_query( hdb,
|
||||
"CREATE TABLE `File` ("
|
||||
"`File` CHAR(72) NOT NULL, "
|
||||
"`Component_` CHAR(72) NOT NULL, "
|
||||
"`FileName` CHAR(255) NOT NULL, "
|
||||
"`FileSize` LONG NOT NULL, "
|
||||
"`Version` CHAR(72), "
|
||||
"`Language` CHAR(20), "
|
||||
"`Attributes` SHORT, "
|
||||
"`Sequence` SHORT NOT NULL "
|
||||
"PRIMARY KEY `File`)" );
|
||||
}
|
||||
|
||||
static UINT add_component_entry( MSIHANDLE hdb, char *values )
|
||||
{
|
||||
char insert[] = "INSERT INTO `Component` "
|
||||
|
@ -130,6 +145,22 @@ static UINT add_feature_components_entry( MSIHANDLE hdb, char *values )
|
|||
return r;
|
||||
}
|
||||
|
||||
static UINT add_file_entry( MSIHANDLE hdb, char *values )
|
||||
{
|
||||
char insert[] = "INSERT INTO `File` "
|
||||
"(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
|
||||
"VALUES( %s )";
|
||||
char *query;
|
||||
UINT sz, r;
|
||||
|
||||
sz = strlen(values) + sizeof insert;
|
||||
query = HeapAlloc(GetProcessHeap(),0,sz);
|
||||
sprintf(query,insert,values);
|
||||
r = run_query( hdb, query );
|
||||
HeapFree(GetProcessHeap(), 0, query);
|
||||
return r;
|
||||
}
|
||||
|
||||
static UINT set_summary_info(MSIHANDLE hdb)
|
||||
{
|
||||
UINT res;
|
||||
|
@ -1267,15 +1298,15 @@ static void test_states(void)
|
|||
ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
|
||||
r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', ''" );
|
||||
r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
|
||||
r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', ''" );
|
||||
r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
|
||||
r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', ''" );
|
||||
r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource */
|
||||
|
@ -1283,15 +1314,23 @@ static void test_states(void)
|
|||
ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
|
||||
r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', ''" );
|
||||
r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
|
||||
r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', ''" );
|
||||
r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
|
||||
r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', ''" );
|
||||
r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource */
|
||||
r = add_feature_entry( hdb, "'three', '', 2, 1, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
|
||||
|
||||
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
|
||||
r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
|
||||
|
||||
r = create_feature_components_table( hdb );
|
||||
|
@ -1315,6 +1354,34 @@ static void test_states(void)
|
|||
r = add_feature_components_entry( hdb, "'two', 'zeta'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
|
||||
|
||||
r = add_feature_components_entry( hdb, "'three', 'eta'" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
|
||||
|
||||
r = create_file_table( hdb );
|
||||
ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
|
||||
|
||||
r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
/* compressed file */
|
||||
r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
|
||||
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
|
||||
|
||||
hpkg = package_from_db( hdb );
|
||||
ok( hpkg, "failed to create package\n");
|
||||
|
||||
|
@ -1332,6 +1399,13 @@ static void test_states(void)
|
|||
ok( state == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", state);
|
||||
ok( action == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetFeatureState(hpkg, "three", &state, &action);
|
||||
ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
|
||||
ok( state == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", state);
|
||||
ok( action == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
|
@ -1374,6 +1448,13 @@ static void test_states(void)
|
|||
ok( state == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", state);
|
||||
ok( action == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "eta", &state, &action);
|
||||
ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
|
||||
ok( state == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", state);
|
||||
ok( action == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", action);
|
||||
|
||||
r = MsiDoAction( hpkg, "CostInitialize");
|
||||
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
||||
|
||||
|
@ -1397,6 +1478,16 @@ static void test_states(void)
|
|||
}
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetFeatureState(hpkg, "three", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
|
||||
}
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
|
@ -1457,6 +1548,16 @@ static void test_states(void)
|
|||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "eta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
}
|
||||
|
||||
r = MsiDoAction( hpkg, "FileCost");
|
||||
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
||||
|
||||
|
@ -1480,6 +1581,16 @@ static void test_states(void)
|
|||
}
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetFeatureState(hpkg, "three", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
|
||||
}
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
|
@ -1540,6 +1651,16 @@ static void test_states(void)
|
|||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "eta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
|
||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||
}
|
||||
|
||||
r = MsiDoAction( hpkg, "CostFinalize");
|
||||
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
||||
|
||||
|
@ -1563,6 +1684,16 @@ static void test_states(void)
|
|||
ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetFeatureState(hpkg, "three", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
||||
todo_wine
|
||||
{
|
||||
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
|
@ -1607,6 +1738,16 @@ static void test_states(void)
|
|||
{
|
||||
ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
action = 0xdeadbeef;
|
||||
r = MsiGetComponentState(hpkg, "eta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
||||
todo_wine
|
||||
{
|
||||
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
|
||||
}
|
||||
|
||||
MsiCloseHandle( hpkg );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue