[MSI_WINETEST] Sync with Wine 3.0. CORE-14225

This commit is contained in:
Amine Khaldi 2018-01-20 12:30:30 +01:00
parent f8b992f2d3
commit f860a7802c
5 changed files with 1492 additions and 2294 deletions

View file

@ -193,7 +193,7 @@ static UINT run_queryW( MSIHANDLE hdb, MSIHANDLE hrec, const WCHAR *query )
static UINT create_component_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
UINT r = run_query( hdb, 0,
"CREATE TABLE `Component` ( "
"`Component` CHAR(72) NOT NULL, "
"`ComponentId` CHAR(38), "
@ -202,87 +202,99 @@ static UINT create_component_table( MSIHANDLE hdb )
"`Condition` CHAR(255), "
"`KeyPath` CHAR(72) "
"PRIMARY KEY `Component`)" );
ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
return r;
}
static UINT create_custom_action_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
UINT r = run_query( hdb, 0,
"CREATE TABLE `CustomAction` ( "
"`Action` CHAR(72) NOT NULL, "
"`Type` SHORT NOT NULL, "
"`Source` CHAR(72), "
"`Target` CHAR(255) "
"PRIMARY KEY `Action`)" );
ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
return r;
}
static UINT create_directory_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
UINT r = run_query( hdb, 0,
"CREATE TABLE `Directory` ( "
"`Directory` CHAR(255) NOT NULL, "
"`Directory_Parent` CHAR(255), "
"`DefaultDir` CHAR(255) NOT NULL "
"PRIMARY KEY `Directory`)" );
ok(r == ERROR_SUCCESS, "Failed to create Directory table: %u\n", r);
return r;
}
static UINT create_feature_components_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
UINT r = run_query( hdb, 0,
"CREATE TABLE `FeatureComponents` ( "
"`Feature_` CHAR(38) NOT NULL, "
"`Component_` CHAR(72) NOT NULL "
"PRIMARY KEY `Feature_`, `Component_` )" );
ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
return r;
}
static UINT create_std_dlls_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
UINT r = run_query( hdb, 0,
"CREATE TABLE `StdDlls` ( "
"`File` CHAR(255) NOT NULL, "
"`Binary_` CHAR(72) NOT NULL "
"PRIMARY KEY `File` )" );
ok(r == ERROR_SUCCESS, "Failed to create StdDlls table: %u\n", r);
return r;
}
static UINT create_binary_table( MSIHANDLE hdb )
{
return run_query( hdb, 0,
"CREATE TABLE `Binary` ( "
UINT r = run_query( hdb, 0,
"CREATE TABLE `Binary` ( "
"`Name` CHAR(72) NOT NULL, "
"`Data` CHAR(72) NOT NULL "
"PRIMARY KEY `Name` )" );
ok(r == ERROR_SUCCESS, "Failed to create Binary table: %u\n", r);
return r;
}
#define make_add_entry(type, qtext) \
static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
{ \
char insert[] = qtext; \
char *query; \
UINT sz, r; \
sz = strlen(values) + sizeof insert; \
query = HeapAlloc(GetProcessHeap(),0,sz); \
sprintf(query,insert,values); \
r = run_query( hdb, 0, query ); \
HeapFree(GetProcessHeap(), 0, query); \
return r; \
}
static inline UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
{
char *query;
UINT sz, r;
make_add_entry(component,
"INSERT INTO `Component` "
"(`Component`, `ComponentId`, `Directory_`, "
sz = strlen(values) + strlen(insert) + 1;
query = HeapAlloc(GetProcessHeap(), 0, sz);
sprintf(query, insert, values);
r = run_query(hdb, 0, query);
HeapFree(GetProcessHeap(), 0, query);
ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r);
return r;
}
#define add_component_entry(hdb, values) add_entry(__FILE__, __LINE__, "Component", hdb, values, \
"INSERT INTO `Component` " \
"(`Component`, `ComponentId`, `Directory_`, " \
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
make_add_entry(custom_action,
"INSERT INTO `CustomAction` "
#define add_custom_action_entry(hdb, values) add_entry(__FILE__, __LINE__, "CustomAction", hdb, values, \
"INSERT INTO `CustomAction` " \
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
make_add_entry(feature_components,
"INSERT INTO `FeatureComponents` "
#define add_feature_components_entry(hdb, values) add_entry(__FILE__, __LINE__, "FeatureComponents", hdb, values, \
"INSERT INTO `FeatureComponents` " \
"(`Feature_`, `Component_`) VALUES( %s )")
make_add_entry(std_dlls,
#define add_std_dlls_entry(hdb, values) add_entry(__FILE__, __LINE__, "StdDlls", hdb, values, \
"INSERT INTO `StdDlls` (`File`, `Binary_`) VALUES( %s )")
make_add_entry(binary,
#define add_binary_entry(hdb, values) add_entry(__FILE__, __LINE__, "Binary", hdb, values, \
"INSERT INTO `Binary` (`Name`, `Data`) VALUES( %s )")
static void test_msiinsert(void)
@ -3117,8 +3129,7 @@ static MSIHANDLE create_package_db(const WCHAR *filename)
res = set_summary_info(hdb);
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = create_directory_table(hdb);
ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
create_directory_table(hdb);
return hdb;
}
@ -3447,62 +3458,28 @@ static void test_join(void)
hdb = create_db();
ok( hdb, "failed to create db\n");
r = create_component_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
create_component_table( hdb );
add_component_entry( hdb, "'zygomatic', 'malar', 'INSTALLDIR', 0, '', ''" );
add_component_entry( hdb, "'maxilla', 'alveolar', 'INSTALLDIR', 0, '', ''" );
add_component_entry( hdb, "'nasal', 'septum', 'INSTALLDIR', 0, '', ''" );
add_component_entry( hdb, "'mandible', 'ramus', 'INSTALLDIR', 0, '', ''" );
r = add_component_entry( hdb, "'zygomatic', 'malar', 'INSTALLDIR', 0, '', ''" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
create_feature_components_table( hdb );
add_feature_components_entry( hdb, "'procerus', 'maxilla'" );
add_feature_components_entry( hdb, "'procerus', 'nasal'" );
add_feature_components_entry( hdb, "'nasalis', 'nasal'" );
add_feature_components_entry( hdb, "'nasalis', 'mandible'" );
add_feature_components_entry( hdb, "'nasalis', 'notacomponent'" );
add_feature_components_entry( hdb, "'mentalis', 'zygomatic'" );
r = add_component_entry( hdb, "'maxilla', 'alveolar', 'INSTALLDIR', 0, '', ''" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
create_std_dlls_table( hdb );
add_std_dlls_entry( hdb, "'msvcp.dll', 'msvcp.dll.01234'" );
add_std_dlls_entry( hdb, "'msvcr.dll', 'msvcr.dll.56789'" );
r = add_component_entry( hdb, "'nasal', 'septum', 'INSTALLDIR', 0, '', ''" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
r = add_component_entry( hdb, "'mandible', 'ramus', 'INSTALLDIR', 0, '', ''" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
r = create_feature_components_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
r = add_feature_components_entry( hdb, "'procerus', 'maxilla'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = add_feature_components_entry( hdb, "'procerus', 'nasal'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = add_feature_components_entry( hdb, "'nasalis', 'nasal'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = add_feature_components_entry( hdb, "'nasalis', 'mandible'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = add_feature_components_entry( hdb, "'nasalis', 'notacomponent'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = add_feature_components_entry( hdb, "'mentalis', 'zygomatic'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
r = create_std_dlls_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create StdDlls table: %d\n", r );
r = add_std_dlls_entry( hdb, "'msvcp.dll', 'msvcp.dll.01234'" );
ok( r == ERROR_SUCCESS, "cannot add std dlls: %d\n", r );
r = add_std_dlls_entry( hdb, "'msvcr.dll', 'msvcr.dll.56789'" );
ok( r == ERROR_SUCCESS, "cannot add std dlls: %d\n", r );
r = create_binary_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create Binary table: %d\n", r );
r = add_binary_entry( hdb, "'msvcp.dll.01234', 'abcdefgh'" );
ok( r == ERROR_SUCCESS, "cannot add binary: %d\n", r );
r = add_binary_entry( hdb, "'msvcr.dll.56789', 'ijklmnop'" );
ok( r == ERROR_SUCCESS, "cannot add binary: %d\n", r );
r = add_binary_entry( hdb, "'single.dll.31415', 'msvcp.dll'" );
ok( r == ERROR_SUCCESS, "cannot add binary: %d\n", r );
create_binary_table( hdb );
add_binary_entry( hdb, "'msvcp.dll.01234', 'abcdefgh'" );
add_binary_entry( hdb, "'msvcr.dll.56789', 'ijklmnop'" );
add_binary_entry( hdb, "'single.dll.31415', 'msvcp.dll'" );
query = "CREATE TABLE `One` (`A` SHORT, `B` SHORT PRIMARY KEY `A`)";
r = run_query( hdb, 0, query);
@ -4790,7 +4767,7 @@ static void test_update(void)
MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec);
ok(r == ERROR_NO_MORE_ITEMS, "Expectd ERROR_NO_MORE_ITEMS, got %d\n", r);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(view);
MsiCloseHandle(view);
@ -7657,14 +7634,10 @@ static void test_dbtopackage(void)
set_summary_info(hdb);
r = create_directory_table(hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
create_directory_table(hdb);
r = create_custom_action_table(hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
create_custom_action_table(hdb);
add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
sprintf(package, "#%u", hdb);
r = MsiOpenPackageA(package, &hpkg);
@ -7721,14 +7694,10 @@ static void test_dbtopackage(void)
set_summary_info(hdb);
r = create_directory_table(hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
create_directory_table(hdb);
r = create_custom_action_table(hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
create_custom_action_table(hdb);
add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
sprintf(package, "#%u", hdb);
r = MsiOpenPackageA(package, &hpkg);

View file

@ -22,206 +22,6 @@
#include "precomp.h"
static const char msifile[] = "winetest-format.msi";
static const WCHAR msifileW[] =
{'w','i','n','e','t','e','s','t','-','f','o','r','m','a','t','.','m','s','i',0};
static UINT run_query( MSIHANDLE hdb, const char *query )
{
MSIHANDLE hview = 0;
UINT r;
r = MsiDatabaseOpenViewA(hdb, query, &hview);
if( r != ERROR_SUCCESS )
return r;
r = MsiViewExecute(hview, 0);
if( r == ERROR_SUCCESS )
r = MsiViewClose(hview);
MsiCloseHandle(hview);
return r;
}
static UINT create_feature_table( MSIHANDLE hdb )
{
return run_query( hdb,
"CREATE TABLE `Feature` ( "
"`Feature` CHAR(38) NOT NULL, "
"`Feature_Parent` CHAR(38), "
"`Title` CHAR(64), "
"`Description` CHAR(255), "
"`Display` SHORT NOT NULL, "
"`Level` SHORT NOT NULL, "
"`Directory_` CHAR(72), "
"`Attributes` SHORT NOT NULL "
"PRIMARY KEY `Feature`)" );
}
static UINT create_component_table( MSIHANDLE hdb )
{
return run_query( hdb,
"CREATE TABLE `Component` ( "
"`Component` CHAR(72) NOT NULL, "
"`ComponentId` CHAR(38), "
"`Directory_` CHAR(72) NOT NULL, "
"`Attributes` SHORT NOT NULL, "
"`Condition` CHAR(255), "
"`KeyPath` CHAR(72) "
"PRIMARY KEY `Component`)" );
}
static UINT create_feature_components_table( MSIHANDLE hdb )
{
return run_query( hdb,
"CREATE TABLE `FeatureComponents` ( "
"`Feature_` CHAR(38) NOT NULL, "
"`Component_` CHAR(72) NOT NULL "
"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 create_custom_action_table( MSIHANDLE hdb )
{
return run_query( hdb,
"CREATE TABLE `CustomAction` ("
"`Action` CHAR(72) NOT NULL, "
"`Type` SHORT NOT NULL, "
"`Source` CHAR(75), "
"`Target` CHAR(255) "
"PRIMARY KEY `Action`)" );
}
#define make_add_entry(type, qtext) \
static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
{ \
char insert[] = qtext; \
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; \
}
make_add_entry(feature,
"INSERT INTO `Feature` "
"(`Feature`, `Feature_Parent`, `Title`, `Description`, "
"`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
make_add_entry(component,
"INSERT INTO `Component` "
"(`Component`, `ComponentId`, `Directory_`, "
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
make_add_entry(feature_components,
"INSERT INTO `FeatureComponents` "
"(`Feature_`, `Component_`) VALUES( %s )")
make_add_entry(file,
"INSERT INTO `File` "
"(`File`, `Component_`, `FileName`, `FileSize`, "
"`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
make_add_entry(directory,
"INSERT INTO `Directory` "
"(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
make_add_entry(custom_action,
"INSERT INTO `CustomAction` "
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
static UINT set_summary_info(MSIHANDLE hdb)
{
UINT res;
MSIHANDLE suminfo;
/* build summary info */
res = MsiGetSummaryInformationA(hdb, NULL, 7, &suminfo);
ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
res = MsiSummaryInfoSetPropertyA(suminfo,2, VT_LPSTR, 0,NULL,
"Installation Database");
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo,3, VT_LPSTR, 0,NULL,
"Installation Database");
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo,4, VT_LPSTR, 0,NULL,
"Wine Hackers");
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo,7, VT_LPSTR, 0,NULL,
";1033");
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo,9, VT_LPSTR, 0,NULL,
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo, 14, VT_I4, 100, NULL, NULL);
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoSetPropertyA(suminfo, 15, VT_I4, 0, NULL, NULL);
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
res = MsiSummaryInfoPersist(suminfo);
ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
res = MsiCloseHandle( suminfo);
ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
return res;
}
static MSIHANDLE create_package_db(void)
{
MSIHANDLE hdb = 0;
UINT res;
DeleteFileW(msifileW);
/* create an empty database */
res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if( res != ERROR_SUCCESS )
return 0;
res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
if( res != ERROR_SUCCESS )
return 0;
res = set_summary_info(hdb);
ok( res == ERROR_SUCCESS , "Failed to set summary info %u\n", res );
if( res != ERROR_SUCCESS )
return 0;
res = run_query( hdb,
"CREATE TABLE `Directory` ( "
"`Directory` CHAR(255) NOT NULL, "
"`Directory_Parent` CHAR(255), "
"`DefaultDir` CHAR(255) NOT NULL "
"PRIMARY KEY `Directory`)" );
ok( res == ERROR_SUCCESS , "Failed to create directory table %u\n", res );
return hdb;
}
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
{
@ -245,18 +45,6 @@ static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
return ERROR_SUCCESS;
}
static void create_test_file(const CHAR *name)
{
HANDLE file;
DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
WriteFile(file, name, strlen(name), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
CloseHandle(file);
}
static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
{
MSIHANDLE hPackage, suminfo, hdb = 0;
@ -2476,304 +2264,6 @@ static void test_formatrecord_package(void)
DeleteFileA( msifile );
}
static void test_formatrecord_tables(void)
{
MSIHANDLE hdb, hrec, hpkg = 0;
CHAR buf[MAX_PATH];
CHAR curr_dir[MAX_PATH];
CHAR expected[MAX_PATH];
CHAR root[MAX_PATH];
DWORD size;
UINT r;
GetCurrentDirectoryA( MAX_PATH, curr_dir );
hdb = create_package_db();
ok ( hdb, "failed to create package database\n");
r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r);
r = add_directory_entry( hdb, "'ReallyLongDir', 'TARGETDIR', "
"'I am a really long directory'" );
ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r);
r = create_feature_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r);
r = add_feature_entry( hdb, "'occipitofrontalis', '', '', '', 2, 1, '', 0" );
ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
r = create_component_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r);
r = add_component_entry( hdb, "'frontal', '', 'TARGETDIR', 0, '', 'frontal_file'" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r);
r = add_component_entry( hdb, "'parietal', '', 'TARGETDIR', 1, '', 'parietal_file'" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r);
r = add_component_entry( hdb, "'temporal', '', 'ReallyLongDir', 0, '', 'temporal_file'" );
ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r);
r = create_feature_components_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r);
r = add_feature_components_entry( hdb, "'occipitofrontalis', 'frontal'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r);
r = add_feature_components_entry( hdb, "'occipitofrontalis', 'parietal'" );
ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r);
r = add_feature_components_entry( hdb, "'occipitofrontalis', 'temporal'" );
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, "'frontal_file', 'frontal', 'frontal.txt', 0, '', '1033', 8192, 1" );
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
r = add_file_entry( hdb, "'parietal_file', 'parietal', 'parietal.txt', 0, '', '1033', 8192, 1" );
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
r = add_file_entry( hdb, "'temporal_file', 'temporal', 'temporal.txt', 0, '', '1033', 8192, 1" );
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
r = create_custom_action_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create CustomAction table: %d\n", r);
r = add_custom_action_entry( hdb, "'MyCustom', 51, 'prop', '[!temporal_file]'" );
ok( r == ERROR_SUCCESS, "cannot add custom action: %d\n", r);
r = add_custom_action_entry( hdb, "'EscapeIt1', 51, 'prop', '[\\[]Bracket Text[\\]]'" );
ok( r == ERROR_SUCCESS, "cannot add custom action: %d\n", r);
r = add_custom_action_entry( hdb, "'EscapeIt2', 51, 'prop', '[\\xabcd]'" );
ok( r == ERROR_SUCCESS, "cannot add custom action: %d\n", r);
r = add_custom_action_entry( hdb, "'EscapeIt3', 51, 'prop', '[abcd\\xefgh]'" );
ok( r == ERROR_SUCCESS, "cannot add custom action: %d\n", r);
r = add_custom_action_entry( hdb, "'EmbedNull', 51, 'prop', '[~]np'" );
ok( r == ERROR_SUCCESS, "cannot add custom action: %d\n", r);
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
MsiCloseHandle( hdb );
DeleteFileA( msifile );
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
r = MsiSetPropertyA( hpkg, "imaprop", "ringer" );
ok( r == ERROR_SUCCESS, "cannot set property: %d\n", r);
hrec = MsiCreateRecord( 1 );
/* property doesn't exist */
size = MAX_PATH;
/*MsiRecordSetStringA( hrec, 0, "[1]" ); */
MsiRecordSetStringA( hrec, 1, "[idontexist]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
/* property exists */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[imaprop]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: ringer " ), "Expected '1: ringer ', got %s\n", buf );
size = MAX_PATH;
MsiRecordSetStringA( hrec, 0, "1: [1] " );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: ringer " ), "Expected '1: ringer ', got %s\n", buf );
/* environment variable doesn't exist */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[%idontexist]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
/* environment variable exists */
size = MAX_PATH;
SetEnvironmentVariableA( "crazyvar", "crazyval" );
MsiRecordSetStringA( hrec, 1, "[%crazyvar]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: crazyval " ), "Expected '1: crazyval ', got %s\n", buf );
/* file key before CostInitialize */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[#frontal_file]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiDoActionA(hpkg, "CostInitialize");
ok( r == ERROR_SUCCESS, "CostInitialize failed: %d\n", r);
r = MsiDoActionA(hpkg, "FileCost");
ok( r == ERROR_SUCCESS, "FileCost failed: %d\n", r);
r = MsiDoActionA(hpkg, "CostFinalize");
ok( r == ERROR_SUCCESS, "CostFinalize failed: %d\n", r);
size = MAX_PATH;
MsiGetPropertyA( hpkg, "ROOTDRIVE", root, &size );
sprintf( expected, "1: %sfrontal.txt ", root);
/* frontal full file key */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[#frontal_file]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* frontal short file key */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[!frontal_file]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
sprintf( expected, "1: %sI am a really long directory\\temporal.txt ", root);
/* temporal full file key */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[#temporal_file]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* temporal short file key */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[!temporal_file]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* custom action 51, files don't exist */
r = MsiDoActionA( hpkg, "MyCustom" );
ok( r == ERROR_SUCCESS, "MyCustom failed: %d\n", r);
sprintf( expected, "%sI am a really long directory\\temporal.txt", root);
size = MAX_PATH;
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
sprintf( buf, "%sI am a really long directory", root );
CreateDirectoryA( buf, NULL );
lstrcatA( buf, "\\temporal.txt" );
create_test_file( buf );
/* custom action 51, files exist */
r = MsiDoActionA( hpkg, "MyCustom" );
ok( r == ERROR_SUCCESS, "MyCustom failed: %d\n", r);
size = MAX_PATH;
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
todo_wine
{
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
}
/* custom action 51, escaped text 1 */
r = MsiDoActionA( hpkg, "EscapeIt1" );
ok( r == ERROR_SUCCESS, "EscapeIt1 failed: %d\n", r);
size = MAX_PATH;
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmpA( buf, "[Bracket Text]" ), "Expected '[Bracket Text]', got %s\n", buf);
/* custom action 51, escaped text 2 */
r = MsiDoActionA( hpkg, "EscapeIt2" );
ok( r == ERROR_SUCCESS, "EscapeIt2 failed: %d\n", r);
size = MAX_PATH;
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmpA( buf, "x" ), "Expected 'x', got %s\n", buf);
/* custom action 51, escaped text 3 */
r = MsiDoActionA( hpkg, "EscapeIt3" );
ok( r == ERROR_SUCCESS, "EscapeIt3 failed: %d\n", r);
size = MAX_PATH;
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmpA( buf, "" ), "Expected '', got %s\n", buf);
/* custom action 51, embedded null */
r = MsiDoActionA( hpkg, "EmbedNull" );
ok( r == ERROR_SUCCESS, "EmbedNull failed: %d\n", r);
size = MAX_PATH;
memset( buf, 'a', sizeof(buf) );
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !memcmp( buf, "\0np", sizeof("\0np") ), "wrong value\n");
ok( size == sizeof("\0np") - 1, "got %u\n", size );
r = MsiSetPropertyA( hpkg, "prop", "[~]np" );
ok( r == ERROR_SUCCESS, "cannot set property: %d\n", r);
size = MAX_PATH;
memset( buf, 'a', sizeof(buf) );
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmpA( buf, "[~]np" ), "Expected '[~]np', got %s\n", buf);
sprintf( expected, "1: %sI am a really long directory\\ ", root);
/* component with INSTALLSTATE_LOCAL */
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[$temporal]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
r = MsiSetComponentStateA( hpkg, "temporal", INSTALLSTATE_SOURCE );
ok( r == ERROR_SUCCESS, "failed to set install state: %d\n", r);
/* component with INSTALLSTATE_SOURCE */
lstrcpyA( expected, "1: " );
lstrcatA( expected, curr_dir );
if (strlen(curr_dir) > 3) lstrcatA( expected, "\\" );
lstrcatA( expected, " " );
size = MAX_PATH;
MsiRecordSetStringA( hrec, 1, "[$parietal]" );
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmpA( buf, expected ), "Expected '%s', got '%s'\n", expected, buf);
sprintf( buf, "%sI am a really long directory\\temporal.txt", root );
DeleteFileA( buf );
sprintf( buf, "%sI am a really long directory", root );
RemoveDirectoryA( buf );
MsiCloseHandle( hrec );
MsiCloseHandle( hpkg );
DeleteFileA( msifile );
}
static void test_processmessage(void)
{
MSIHANDLE hrec, package;
@ -2845,6 +2335,5 @@ START_TEST(format)
test_createpackage();
test_formatrecord();
test_formatrecord_package();
test_formatrecord_tables();
test_processmessage();
}

View file

@ -1269,6 +1269,27 @@ static const char ft_install_exec_seq_dat[] =
"PublishProduct\t\t1400\n"
"InstallFinalize\t\t1500\n";
static const char da_custom_action_dat[] =
"Action\tType\tSource\tTarget\tISComments\n"
"s72\ti2\tS64\tS0\tS255\n"
"CustomAction\tAction\n"
"deferred\t1074\tCMDEXE\t/c if exist msitest (exit 0) else (exit 1)\t\n"
"immediate\t50\tCMDEXE\t/c mkdir msitest\t\n"
"cleanup\t50\tCMDEXE\t/c rmdir msitest\t\n";
static const char da_install_exec_seq_dat[] =
"Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
"CostInitialize\t\t200\n"
"FileCost\t\t300\n"
"CostFinalize\t\t400\n"
"InstallInitialize\t\t500\n"
"deferred\t\t600\n"
"immediate\t\t700\n"
"InstallFinalize\t\t1100\n"
"cleanup\t\t1200\n";
typedef struct _msi_table
{
const CHAR *filename;
@ -1923,6 +1944,19 @@ static const msi_table ft_tables[] =
ADD_TABLE(property)
};
static const msi_table da_tables[] =
{
ADD_TABLE(media),
ADD_TABLE(directory),
ADD_TABLE(file),
ADD_TABLE(component),
ADD_TABLE(feature),
ADD_TABLE(feature_comp),
ADD_TABLE(property),
ADD_TABLE(da_install_exec_seq),
ADD_TABLE(da_custom_action),
};
/* cabinet definitions */
/* make the max size large so there is only one cab file */
@ -2390,6 +2424,22 @@ static void delete_test_files(void)
RemoveDirectoryA("msitest");
}
static void delete_pf_files(void)
{
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
}
static void write_file(const CHAR *filename, const char *data, int data_size)
{
DWORD size;
@ -2570,18 +2620,7 @@ static void test_MsiInstallProduct(void)
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2617,18 +2656,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2640,18 +2668,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2663,18 +2680,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2686,18 +2692,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -2709,18 +2704,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
@ -2731,18 +2715,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
@ -2753,18 +2726,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
@ -2775,18 +2737,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
@ -2797,18 +2748,7 @@ static void test_MsiInstallProduct(void)
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
@ -3844,6 +3784,7 @@ static void test_admin(void)
ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
r = MsiInstallProductA(msifile, "ACTION=ADMIN");
todo_wine
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
ok(!delete_pf("msitest", FALSE), "Directory created\n");
@ -4721,18 +4662,7 @@ static void test_adminimage(void)
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
error:
DeleteFileA("msifile");
@ -4900,19 +4830,8 @@ static void test_shortcut(void)
CoUninitialize();
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
error:
delete_test_files();
@ -5006,18 +4925,7 @@ static void test_installed_prop(void)
r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -5051,18 +4959,7 @@ static void test_allusers_prop(void)
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -5076,18 +4973,7 @@ static void test_allusers_prop(void)
r = MsiInstallProductA(msifile, "FULL=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -5101,18 +4987,7 @@ static void test_allusers_prop(void)
r = MsiInstallProductA(msifile, "FULL=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "Directory not created\n");
delete_pf_files();
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@ -6029,6 +5904,27 @@ static void test_feature_tree(void)
DeleteFileA( msifile );
}
static void test_deferred_action(void)
{
UINT r;
create_database(msifile, da_tables, sizeof(da_tables) / sizeof(da_tables[0]));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, "CMDEXE=\"cmd.exe\"");
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
todo_wine
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
error:
DeleteFileA(msifile);
}
START_TEST(install)
{
DWORD len;
@ -6117,6 +6013,7 @@ START_TEST(install)
test_shared_component();
test_remove_upgrade_code();
test_feature_tree();
test_deferred_action();
DeleteFileA(log_file);

File diff suppressed because it is too large Load diff

View file

@ -506,7 +506,7 @@ static void test_fieldzero(void)
r = MsiRecordGetStringA(rec, 0, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expectd 0, got %d\n", sz);
ok(sz == 0, "Expected 0, got %d\n", sz);
r = MsiRecordIsNull(rec, 0);
ok(r == TRUE, "Expected TRUE, got %d\n", r);
@ -525,7 +525,7 @@ static void test_fieldzero(void)
r = MsiRecordGetStringA(rec, 0, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expectd 0, got %d\n", sz);
ok(sz == 0, "Expected 0, got %d\n", sz);
r = MsiRecordIsNull(rec, 0);
ok(r == TRUE, "Expected TRUE, got %d\n", r);
@ -544,7 +544,7 @@ static void test_fieldzero(void)
r = MsiRecordGetStringA(rec, 0, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expectd 0, got %d\n", sz);
ok(sz == 0, "Expected 0, got %d\n", sz);
r = MsiRecordIsNull(rec, 0);
ok(r == TRUE, "Expected TRUE, got %d\n", r);
@ -554,7 +554,7 @@ static void test_fieldzero(void)
r = MsiRecordGetStringA(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "bologna"), "Expected \"bologna\", got \"%s\"\n", buf);
ok(sz == 7, "Expectd 7, got %d\n", sz);
ok(sz == 7, "Expected 7, got %d\n", sz);
MsiCloseHandle(rec);
@ -595,7 +595,7 @@ static void test_fieldzero(void)
r = MsiRecordGetStringA(rec, 0, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "drone"), "Expected \"drone\", got \"%s\"\n", buf);
ok(sz == 5, "Expectd 5, got %d\n", sz);
ok(sz == 5, "Expected 5, got %d\n", sz);
r = MsiRecordIsNull(rec, 0);
ok(r == FALSE, "Expected FALSE, got %d\n", r);