Commit 1d124f88 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi/tests: Compile with -D__WINESRC__.

parent 0354af64
TESTDLL = msi.dll TESTDLL = msi.dll
IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
action.c \ action.c \
......
...@@ -2443,9 +2443,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -2443,9 +2443,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
{ {
MSIHANDLE db; MSIHANDLE db;
UINT r; UINT r;
int j; WCHAR *nameW;
int j, len;
r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */ /* import the tables into the database */
...@@ -2467,6 +2472,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -2467,6 +2472,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(db); MsiCloseHandle(db);
HeapFree( GetProcessHeap(), 0, nameW );
} }
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
......
...@@ -275,9 +275,14 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t ...@@ -275,9 +275,14 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
{ {
MSIHANDLE db; MSIHANDLE db;
UINT r; UINT r;
int j; WCHAR *nameW;
int j, len;
len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */ /* import the tables into the database */
...@@ -299,6 +304,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t ...@@ -299,6 +304,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(db); MsiCloseHandle(db);
HeapFree( GetProcessHeap(), 0, nameW );
} }
static BOOL create_package(LPWSTR path) static BOOL create_package(LPWSTR path)
......
...@@ -203,7 +203,7 @@ static MSIHANDLE create_package_db(void) ...@@ -203,7 +203,7 @@ static MSIHANDLE create_package_db(void)
DeleteFileW(msifileW); DeleteFileW(msifileW);
/* create an empty database */ /* create an empty database */
res = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb ); res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res ); ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if( res != ERROR_SUCCESS ) if( res != ERROR_SUCCESS )
return 0; return 0;
...@@ -267,11 +267,19 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle ) ...@@ -267,11 +267,19 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
{ {
MSIHANDLE hPackage, suminfo, hdb = 0; MSIHANDLE hPackage, suminfo, hdb = 0;
UINT res; UINT res;
WCHAR *nameW;
int len;
DeleteFileA(szName); DeleteFileA(szName);
len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 );
if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szName, -1, nameW, len );
/* create an empty database */ /* create an empty database */
res = MsiOpenDatabaseA( szName, MSIDBOPEN_CREATEDIRECT, &hdb ); res = MsiOpenDatabaseW( nameW, MSIDBOPEN_CREATEDIRECT, &hdb );
HeapFree( GetProcessHeap(), 0, nameW );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res ); ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
return res; return res;
......
...@@ -2306,9 +2306,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -2306,9 +2306,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
{ {
MSIHANDLE db; MSIHANDLE db;
UINT r; UINT r;
int j; WCHAR *nameW;
int j, len;
r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */ /* import the tables into the database */
...@@ -2330,6 +2335,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -2330,6 +2335,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(db); MsiCloseHandle(db);
HeapFree( GetProcessHeap(), 0, nameW );
} }
static void check_service_is_installed(void) static void check_service_is_installed(void)
...@@ -2729,6 +2735,7 @@ static void test_packagecoltypes(void) ...@@ -2729,6 +2735,7 @@ static void test_packagecoltypes(void)
{ {
MSIHANDLE hdb, view, rec; MSIHANDLE hdb, view, rec;
char path[MAX_PATH]; char path[MAX_PATH];
WCHAR pathW[MAX_PATH];
LPCSTR query; LPCSTR query;
UINT r, count; UINT r, count;
...@@ -2739,8 +2746,9 @@ static void test_packagecoltypes(void) ...@@ -2739,8 +2746,9 @@ static void test_packagecoltypes(void)
lstrcpyA(path, CURR_DIR); lstrcpyA(path, CURR_DIR);
lstrcatA(path, "\\"); lstrcatA(path, "\\");
lstrcatA(path, msifile); lstrcatA(path, msifile);
MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
r = MsiOpenDatabaseA(path, MSIDBOPEN_READONLY, &hdb); r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
query = "SELECT * FROM `Media`"; query = "SELECT * FROM `Media`";
...@@ -3413,13 +3421,13 @@ static void generate_transform(void) ...@@ -3413,13 +3421,13 @@ static void generate_transform(void)
/* start with two identical databases */ /* start with two identical databases */
CopyFileA(msifile, msifile2, FALSE); CopyFileA(msifile, msifile2, FALSE);
r = MsiOpenDatabaseA(msifile2, MSIDBOPEN_TRANSACT, &hdb1); r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
ok(r == ERROR_SUCCESS , "Failed to create database\n"); ok(r == ERROR_SUCCESS , "Failed to create database\n");
r = MsiDatabaseCommit(hdb1); r = MsiDatabaseCommit(hdb1);
ok(r == ERROR_SUCCESS , "Failed to commit database\n"); ok(r == ERROR_SUCCESS , "Failed to commit database\n");
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb2); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
ok(r == ERROR_SUCCESS , "Failed to create database\n"); ok(r == ERROR_SUCCESS , "Failed to create database\n");
query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )"; query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
...@@ -3629,12 +3637,12 @@ error: ...@@ -3629,12 +3637,12 @@ error:
RemoveDirectoryA("diffdir"); RemoveDirectoryA("diffdir");
} }
static void set_admin_summary_info(const CHAR *name) static void set_admin_summary_info(const WCHAR *name)
{ {
MSIHANDLE db, summary; MSIHANDLE db, summary;
UINT r; UINT r;
r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db); r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiGetSummaryInformationA(db, NULL, 1, &summary); r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
...@@ -3663,7 +3671,7 @@ static void test_admin(void) ...@@ -3663,7 +3671,7 @@ static void test_admin(void)
create_file("msitest\\augustus", 500); create_file("msitest\\augustus", 500);
create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table)); create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
set_admin_summary_info(msifile); set_admin_summary_info(msifileW);
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
...@@ -3740,7 +3748,7 @@ static void test_adminprops(void) ...@@ -3740,7 +3748,7 @@ static void test_adminprops(void)
create_file("msitest\\augustus", 500); create_file("msitest\\augustus", 500);
create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table)); create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
set_admin_summary_info(msifile); set_admin_summary_info(msifileW);
set_admin_property_stream(msifile); set_admin_property_stream(msifile);
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
...@@ -4615,6 +4623,9 @@ error: ...@@ -4615,6 +4623,9 @@ error:
static void test_int_widths( void ) static void test_int_widths( void )
{ {
static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
static const WCHAR slashW[] = {'\\',0};
static const char int0[] = "int0\ni0\nint0\tint0\n1"; static const char int0[] = "int0\ni0\nint0\tint0\n1";
static const char int1[] = "int1\ni1\nint1\tint1\n1"; static const char int1[] = "int1\ni1\nint1\tint1\n1";
static const char int2[] = "int2\ni2\nint2\tint2\n1"; static const char int2[] = "int2\ni2\nint2\tint2\n1";
...@@ -4638,41 +4649,43 @@ static void test_int_widths( void ) ...@@ -4638,41 +4649,43 @@ static void test_int_widths( void )
{ int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED }, { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
{ int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED } { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
}; };
char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH]; WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
MSIHANDLE db; MSIHANDLE db;
UINT r, i; UINT r, i;
GetTempPathA(MAX_PATH, tmpdir); GetTempPathW(MAX_PATH, tmpdir);
CreateDirectoryA(tmpdir, NULL); CreateDirectoryW(tmpdir, NULL);
lstrcpyA(msitable, tmpdir); lstrcpyW(msitable, tmpdir);
lstrcatA(msitable, "\\msitable.idt"); lstrcatW(msitable, slashW);
lstrcatW(msitable, msitableW);
lstrcpyA(msidb, tmpdir); lstrcpyW(msidb, tmpdir);
lstrcatA(msidb, "\\msitest.msi"); lstrcatW(msidb, slashW);
lstrcatW(msidb, msitestW);
r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db); r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
{ {
DWORD count; DWORD count;
HANDLE handle = CreateFileA(msitable, GENERIC_WRITE, 0, NULL, HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
WriteFile(handle, tests[i].data, tests[i].size, &count, NULL); WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
CloseHandle(handle); CloseHandle(handle);
r = MsiDatabaseImportA(db, tmpdir, "msitable.idt"); r = MsiDatabaseImportW(db, tmpdir, msitableW);
ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r); ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
r = MsiDatabaseCommit(db); r = MsiDatabaseCommit(db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
DeleteFileA(msitable); DeleteFileW(msitable);
} }
MsiCloseHandle(db); MsiCloseHandle(db);
DeleteFileA(msidb); DeleteFileW(msidb);
RemoveDirectoryA(tmpdir); RemoveDirectoryW(tmpdir);
} }
static void test_shortcut(void) static void test_shortcut(void)
...@@ -5254,7 +5267,7 @@ static void test_icon_table(void) ...@@ -5254,7 +5267,7 @@ static void test_icon_table(void)
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
res = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb); res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res); ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)"; query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
......
...@@ -1045,9 +1045,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -1045,9 +1045,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
{ {
MSIHANDLE db; MSIHANDLE db;
UINT r; UINT r;
int j; WCHAR *nameW;
int j, len;
r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db); len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */ /* import the tables into the database */
...@@ -1069,6 +1074,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables, ...@@ -1069,6 +1074,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(db); MsiCloseHandle(db);
HeapFree( GetProcessHeap(), 0, nameW );
} }
static UINT run_query(MSIHANDLE hdb, const char *query) static UINT run_query(MSIHANDLE hdb, const char *query)
...@@ -1140,7 +1146,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode) ...@@ -1140,7 +1146,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode)
DeleteFileA(msifile); DeleteFileA(msifile);
/* create an empty database */ /* create an empty database */
res = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok( res == ERROR_SUCCESS , "Failed to create database\n" ); ok( res == ERROR_SUCCESS , "Failed to create database\n" );
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
return hdb; return hdb;
......
...@@ -759,7 +759,7 @@ static MSIHANDLE create_package_db(void) ...@@ -759,7 +759,7 @@ static MSIHANDLE create_package_db(void)
DeleteFileA(msifile); DeleteFileA(msifile);
/* create an empty database */ /* create an empty database */
res = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb ); res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res ); ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if( res != ERROR_SUCCESS ) if( res != ERROR_SUCCESS )
return hdb; return hdb;
...@@ -2435,7 +2435,7 @@ static void test_msipackage(void) ...@@ -2435,7 +2435,7 @@ static void test_msipackage(void)
r = MsiOpenPackageA(name, &hpack); r = MsiOpenPackageA(name, &hpack);
ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r); ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* database exists, but is emtpy */ /* database exists, but is emtpy */
...@@ -2466,7 +2466,7 @@ static void test_msipackage(void) ...@@ -2466,7 +2466,7 @@ static void test_msipackage(void)
DeleteFileA(msifile); DeleteFileA(msifile);
/* start with a clean database to show what constitutes a valid package */ /* start with a clean database to show what constitutes a valid package */
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sprintf(name, "#%d", hdb); sprintf(name, "#%d", hdb);
...@@ -2650,6 +2650,12 @@ static void test_states(void) ...@@ -2650,6 +2650,12 @@ static void test_states(void)
static char msifile2[] = "winetest2-package.msi"; static char msifile2[] = "winetest2-package.msi";
static char msifile3[] = "winetest3-package.msi"; static char msifile3[] = "winetest3-package.msi";
static char msifile4[] = "winetest4-package.msi"; static char msifile4[] = "winetest4-package.msi";
static const WCHAR msifile2W[] =
{'w','i','n','e','t','e','s','t','2','-','p','a','c','k','a','g','e','.','m','s','i',0};
static const WCHAR msifile3W[] =
{'w','i','n','e','t','e','s','t','3','-','p','a','c','k','a','g','e','.','m','s','i',0};
static const WCHAR msifile4W[] =
{'w','i','n','e','t','e','s','t','4','-','p','a','c','k','a','g','e','.','m','s','i',0};
MSIHANDLE hpkg; MSIHANDLE hpkg;
UINT r; UINT r;
MSIHANDLE hdb; MSIHANDLE hdb;
...@@ -3098,7 +3104,7 @@ static void test_states(void) ...@@ -3098,7 +3104,7 @@ static void test_states(void)
r = MsiInstallProductA(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten"); r = MsiInstallProductA(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r); ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
/* these properties must not be in the saved msi file */ /* these properties must not be in the saved msi file */
...@@ -3182,7 +3188,7 @@ static void test_states(void) ...@@ -3182,7 +3188,7 @@ static void test_states(void)
r = MsiInstallProductA(msifile2, "ADDLOCAL=ALL"); r = MsiInstallProductA(msifile2, "ADDLOCAL=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiOpenDatabaseA(msifile2, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r); ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
/* these properties must not be in the saved msi file */ /* these properties must not be in the saved msi file */
...@@ -3249,7 +3255,7 @@ static void test_states(void) ...@@ -3249,7 +3255,7 @@ static void test_states(void)
r = MsiInstallProductA(msifile3, "ADDSOURCE=ALL"); r = MsiInstallProductA(msifile3, "ADDSOURCE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiOpenDatabaseA(msifile3, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifile3W, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r); ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
/* this property must not be in the saved msi file */ /* this property must not be in the saved msi file */
...@@ -3318,7 +3324,7 @@ static void test_states(void) ...@@ -3318,7 +3324,7 @@ static void test_states(void)
r = MsiInstallProductA(msifile3, "REINSTALL=ALL"); r = MsiInstallProductA(msifile3, "REINSTALL=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiOpenDatabaseA(msifile4, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifile4W, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r); ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
/* this property must not be in the saved msi file */ /* this property must not be in the saved msi file */
...@@ -6826,7 +6832,7 @@ static void test_MsiGetSourcePath(void) ...@@ -6826,7 +6832,7 @@ static void test_MsiGetSourcePath(void)
/* compressed source */ /* compressed source */
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed); set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
...@@ -7340,7 +7346,7 @@ static void test_shortlongsource(void) ...@@ -7340,7 +7346,7 @@ static void test_shortlongsource(void)
/* short file names */ /* short file names */
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_DIRECT, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN); set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
...@@ -7960,7 +7966,7 @@ static void test_access(void) ...@@ -7960,7 +7966,7 @@ static void test_access(void)
MSIHANDLE hdb; MSIHANDLE hdb;
UINT r; UINT r;
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
test_file_access(msifile, create); test_file_access(msifile, create);
...@@ -7974,7 +7980,7 @@ static void test_access(void) ...@@ -7974,7 +7980,7 @@ static void test_access(void)
test_file_access(msifile, create_close); test_file_access(msifile, create_close);
DeleteFileA(msifile); DeleteFileA(msifile);
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
test_file_access(msifile, create); test_file_access(msifile, create);
...@@ -8177,7 +8183,7 @@ static void test_MsiGetProductProperty(void) ...@@ -8177,7 +8183,7 @@ static void test_MsiGetProductProperty(void)
if (is_wow64) if (is_wow64)
access |= KEY_WOW64_64KEY; access |= KEY_WOW64_64KEY;
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiDatabaseCommit(hdb); r = MsiDatabaseCommit(hdb);
......
...@@ -266,12 +266,12 @@ static void write_file( const char *filename, const char *data, DWORD data_size ...@@ -266,12 +266,12 @@ static void write_file( const char *filename, const char *data, DWORD data_size
CloseHandle( file ); CloseHandle( file );
} }
static void set_suminfo( const char *filename ) static void set_suminfo( const WCHAR *filename )
{ {
UINT r; UINT r;
MSIHANDLE hsi, hdb; MSIHANDLE hsi, hdb;
r = MsiOpenDatabaseA( filename, MSIDBOPEN_DIRECT, &hdb ); r = MsiOpenDatabaseW( filename, MSIDBOPEN_DIRECT, &hdb );
ok( r == ERROR_SUCCESS, "failed to open database %u\n", r ); ok( r == ERROR_SUCCESS, "failed to open database %u\n", r );
r = MsiGetSummaryInformationA( hdb, NULL, 7, &hsi ); r = MsiGetSummaryInformationA( hdb, NULL, 7, &hsi );
...@@ -312,8 +312,14 @@ static void create_database( const char *filename, const struct msi_table *table ...@@ -312,8 +312,14 @@ static void create_database( const char *filename, const struct msi_table *table
{ {
MSIHANDLE hdb; MSIHANDLE hdb;
UINT r, i; UINT r, i;
WCHAR *filenameW;
int len;
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
if (!(filenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len );
r = MsiOpenDatabaseA( filename, MSIDBOPEN_CREATE, &hdb ); r = MsiOpenDatabaseW( filenameW, MSIDBOPEN_CREATE, &hdb );
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */ /* import the tables into the database */
...@@ -333,7 +339,8 @@ static void create_database( const char *filename, const struct msi_table *table ...@@ -333,7 +339,8 @@ static void create_database( const char *filename, const struct msi_table *table
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
set_suminfo( filename ); set_suminfo( filenameW );
HeapFree( GetProcessHeap(), 0, filenameW );
} }
/* data for generating a patch */ /* data for generating a patch */
...@@ -712,6 +719,7 @@ static void test_simple_patch( void ) ...@@ -712,6 +719,7 @@ static void test_simple_patch( void )
DWORD size; DWORD size;
char path[MAX_PATH], install_source[MAX_PATH], buffer[32]; char path[MAX_PATH], install_source[MAX_PATH], buffer[32];
const char *query; const char *query;
WCHAR pathW[MAX_PATH];
MSIHANDLE hpackage, hdb, hview, hrec; MSIHANDLE hpackage, hdb, hview, hrec;
if (!pMsiApplyPatchA) if (!pMsiApplyPatchA)
...@@ -860,7 +868,8 @@ static void test_simple_patch( void ) ...@@ -860,7 +868,8 @@ static void test_simple_patch( void )
"LocalPackage", path, &size ); "LocalPackage", path, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiOpenDatabaseA( path, MSIDBOPEN_READONLY, &hdb ); MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
r = MsiOpenDatabaseW( pathW, MSIDBOPEN_READONLY, &hdb );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiDatabaseOpenViewA( hdb, query, &hview ); r = MsiDatabaseOpenViewA( hdb, query, &hview );
...@@ -902,25 +911,25 @@ static void test_MsiOpenDatabase( void ) ...@@ -902,25 +911,25 @@ static void test_MsiOpenDatabase( void )
UINT r; UINT r;
MSIHANDLE hdb; MSIHANDLE hdb;
r = MsiOpenDatabaseA( mspfile, MSIDBOPEN_CREATE, &hdb ); r = MsiOpenDatabaseW( mspfileW, MSIDBOPEN_CREATE, &hdb );
ok(r == ERROR_SUCCESS, "failed to open database %u\n", r); ok(r == ERROR_SUCCESS, "failed to open database %u\n", r);
r = MsiDatabaseCommit( hdb ); r = MsiDatabaseCommit( hdb );
ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r); ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
r = MsiOpenDatabaseA( mspfile, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb ); r = MsiOpenDatabaseW( mspfileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
ok(r == ERROR_OPEN_FAILED, "expected ERROR_OPEN_FAILED, got %u\n", r); ok(r == ERROR_OPEN_FAILED, "expected ERROR_OPEN_FAILED, got %u\n", r);
DeleteFileA( mspfile ); DeleteFileA( mspfile );
r = MsiOpenDatabaseA( mspfile, MSIDBOPEN_CREATE + MSIDBOPEN_PATCHFILE, &hdb ); r = MsiOpenDatabaseW( mspfileW, MSIDBOPEN_CREATE + MSIDBOPEN_PATCHFILE, &hdb );
ok(r == ERROR_SUCCESS , "failed to open database %u\n", r); ok(r == ERROR_SUCCESS , "failed to open database %u\n", r);
r = MsiDatabaseCommit( hdb ); r = MsiDatabaseCommit( hdb );
ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r); ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
r = MsiOpenDatabaseA( mspfile, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb ); r = MsiOpenDatabaseW( mspfileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
ok(r == ERROR_SUCCESS, "failed to open database %u\n", r); ok(r == ERROR_SUCCESS, "failed to open database %u\n", r);
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
DeleteFileA( mspfile ); DeleteFileA( mspfile );
...@@ -928,10 +937,10 @@ static void test_MsiOpenDatabase( void ) ...@@ -928,10 +937,10 @@ static void test_MsiOpenDatabase( void )
create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) ); create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
create_patch( mspfile ); create_patch( mspfile );
r = MsiOpenDatabaseA( msifile, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb ); r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
ok(r == ERROR_OPEN_FAILED, "failed to open database %u\n", r ); ok(r == ERROR_OPEN_FAILED, "failed to open database %u\n", r );
r = MsiOpenDatabaseA( mspfile, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb ); r = MsiOpenDatabaseW( mspfileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
ok(r == ERROR_SUCCESS, "failed to open database %u\n", r ); ok(r == ERROR_SUCCESS, "failed to open database %u\n", r );
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
......
...@@ -547,7 +547,7 @@ static void test_fieldzero(void) ...@@ -547,7 +547,7 @@ static void test_fieldzero(void)
MsiCloseHandle(rec); MsiCloseHandle(rec);
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
query = "CREATE TABLE `drone` ( " query = "CREATE TABLE `drone` ( "
......
...@@ -79,7 +79,7 @@ static void test_suminfo(void) ...@@ -79,7 +79,7 @@ static void test_suminfo(void)
DeleteFileA(msifile); DeleteFileA(msifile);
/* just MsiOpenDatabase should not create a file */ /* just MsiOpenDatabase should not create a file */
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
r = MsiGetSummaryInformationA(hdb, NULL, 0, NULL); r = MsiGetSummaryInformationA(hdb, NULL, 0, NULL);
...@@ -411,7 +411,7 @@ static void test_summary_binary(void) ...@@ -411,7 +411,7 @@ static void test_summary_binary(void)
ok(GetFileAttributesA(msifile) != INVALID_FILE_ATTRIBUTES, "file doesn't exist!\n"); ok(GetFileAttributesA(msifile) != INVALID_FILE_ATTRIBUTES, "file doesn't exist!\n");
/* just MsiOpenDatabase should not create a file */ /* just MsiOpenDatabase should not create a file */
r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb); r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo); r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
......
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