[11/11] msi/tests: Compile with -D__WINESRC__.

Hans Leidekker hans at codeweavers.com
Tue Oct 15 03:35:01 CDT 2013


---
 dlls/msi/tests/Makefile.in  |   1 -
 dlls/msi/tests/action.c     |  10 +++-
 dlls/msi/tests/automation.c |  10 +++-
 dlls/msi/tests/db.c         | 139 ++++++++++++++++++++++----------------------
 dlls/msi/tests/format.c     |  12 +++-
 dlls/msi/tests/install.c    |  59 +++++++++++--------
 dlls/msi/tests/msi.c        |  12 +++-
 dlls/msi/tests/package.c    |  30 ++++++----
 dlls/msi/tests/patch.c      |  31 ++++++----
 dlls/msi/tests/record.c     |   2 +-
 dlls/msi/tests/suminfo.c    |   4 +-
 11 files changed, 182 insertions(+), 128 deletions(-)

diff --git a/dlls/msi/tests/Makefile.in b/dlls/msi/tests/Makefile.in
index 20c0512..1a0fba8 100644
--- a/dlls/msi/tests/Makefile.in
+++ b/dlls/msi/tests/Makefile.in
@@ -1,6 +1,5 @@
 TESTDLL   = msi.dll
 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 = \
 	action.c \
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c
index d5ebab1..8386038 100644
--- a/dlls/msi/tests/action.c
+++ b/dlls/msi/tests/action.c
@@ -2443,9 +2443,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
 {
     MSIHANDLE db;
     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);
 
     /* import the tables into the database */
@@ -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);
 
     MsiCloseHandle(db);
+    HeapFree( GetProcessHeap(), 0, nameW );
 }
 
 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index c27031e..550afc2 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -275,9 +275,14 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
 {
     MSIHANDLE db;
     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);
 
     /* import the tables into the database */
@@ -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);
 
     MsiCloseHandle(db);
+    HeapFree( GetProcessHeap(), 0, nameW );
 }
 
 static BOOL create_package(LPWSTR path)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index bb59f44..058ed83 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -41,19 +41,19 @@ static void test_msidatabase(void)
     MSIHANDLE hdb = 0, hdb2 = 0;
     UINT res;
 
-    DeleteFileA(msifile);
+    DeleteFileW(msifileW);
 
-    res = MsiOpenDatabaseA( msifile, msifile2, &hdb );
+    res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb );
     ok( res == ERROR_OPEN_FAILED, "expected failure\n");
 
-    res = MsiOpenDatabaseA( msifile, (LPSTR)0xff, &hdb );
+    res = MsiOpenDatabaseW( msifileW, (LPWSTR)0xff, &hdb );
     ok( res == ERROR_INVALID_PARAMETER, "expected failure\n");
 
     res = MsiCloseHandle( hdb );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
 
     /* 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" );
 
     res = MsiDatabaseCommit( hdb );
@@ -63,7 +63,7 @@ static void test_msidatabase(void)
 
     res = MsiCloseHandle( hdb );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
-    res = MsiOpenDatabaseA( msifile, msifile2, &hdb2 );
+    res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     ok( GetFileAttributesA( msifile2 ) != INVALID_FILE_ATTRIBUTES, "database should exist\n");
@@ -74,7 +74,7 @@ static void test_msidatabase(void)
     res = MsiCloseHandle( hdb2 );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
 
-    res = MsiOpenDatabaseA( msifile, msifile2, &hdb2 );
+    res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     res = MsiCloseHandle( hdb2 );
@@ -82,7 +82,7 @@ static void test_msidatabase(void)
 
     ok( GetFileAttributesA( msifile2 ) == INVALID_FILE_ATTRIBUTES, "uncommitted database should not exist\n");
 
-    res = MsiOpenDatabaseA( msifile, msifile2, &hdb2 );
+    res = MsiOpenDatabaseW( msifileW, msifile2W, &hdb2 );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
 
     res = MsiDatabaseCommit( hdb2 );
@@ -93,7 +93,7 @@ static void test_msidatabase(void)
 
     ok( GetFileAttributesA( msifile2 ) != INVALID_FILE_ATTRIBUTES, "committed database should exist\n");
 
-    res = MsiOpenDatabaseA( msifile, MSIDBOPEN_READONLY, &hdb );
+    res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     res = MsiDatabaseCommit( hdb );
@@ -102,13 +102,13 @@ static void test_msidatabase(void)
     res = MsiCloseHandle( hdb );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
 
-    res = MsiOpenDatabaseA( msifile, MSIDBOPEN_DIRECT, &hdb );
+    res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_DIRECT, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     res = MsiCloseHandle( hdb );
     ok( res == ERROR_SUCCESS , "Failed to close database\n" );
 
-    res = MsiOpenDatabaseA( msifile, MSIDBOPEN_TRANSACT, &hdb );
+    res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_TRANSACT, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     res = MsiCloseHandle( hdb );
@@ -116,7 +116,7 @@ static void test_msidatabase(void)
     ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n");
 
     /* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */
-    res = MsiOpenDatabaseA( msifile, MSIDBOPEN_CREATE, &hdb );
+    res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     ok( GetFileAttributesA( msifile ) != INVALID_FILE_ATTRIBUTES, "database should exist\n");
@@ -126,7 +126,7 @@ static void test_msidatabase(void)
 
     ok( GetFileAttributesA( msifile ) == INVALID_FILE_ATTRIBUTES, "database should exist\n");
 
-    res = MsiOpenDatabaseA( msifile, MSIDBOPEN_CREATE, &hdb );
+    res = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to open database\n" );
 
     res = MsiDatabaseCommit( hdb );
@@ -306,7 +306,7 @@ static void test_msiinsert(void)
     DeleteFileA(msifile);
 
     /* 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");
 
     /* create a table */
@@ -574,7 +574,7 @@ static void test_msibadqueries(void)
     DeleteFileA(msifile);
 
     /* 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");
 
     r = MsiDatabaseCommit( hdb );
@@ -584,7 +584,7 @@ static void test_msibadqueries(void)
     ok(r == ERROR_SUCCESS , "Failed to close database\n");
 
     /* open it readonly */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb );
     ok(r == ERROR_SUCCESS , "Failed to open database r/o\n");
 
     /* add a table to it */
@@ -595,7 +595,7 @@ static void test_msibadqueries(void)
     ok(r == ERROR_SUCCESS , "Failed to close database r/o\n");
 
     /* open it read/write */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb );
     ok(r == ERROR_SUCCESS , "Failed to open database r/w\n");
 
     /* a bunch of test queries that fail with the native MSI */
@@ -797,7 +797,7 @@ static void test_viewmodify(void)
     DeleteFileA(msifile);
 
     /* 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");
 
     query = "CREATE TABLE `phone` ( "
@@ -1140,10 +1140,10 @@ static MSIHANDLE create_db(void)
     MSIHANDLE hdb = 0;
     UINT res;
 
-    DeleteFileA(msifile);
+    DeleteFileW(msifileW);
 
     /* 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" );
     if( res != ERROR_SUCCESS )
         return hdb;
@@ -1397,10 +1397,10 @@ static void test_msiexport(void)
         "phone\tid\r\n"
         "1\tAbe\t8675309\r\n";
 
-    DeleteFileA(msifile);
+    DeleteFileW(msifileW);
 
     /* 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");
 
     /* create a table */
@@ -1466,9 +1466,9 @@ static void test_longstrings(void)
     UINT r;
     const DWORD STRING_LENGTH = 0x10005;
 
-    DeleteFileA(msifile);
+    DeleteFileW(msifileW);
     /* 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");
 
     /* create a table */
@@ -1491,7 +1491,7 @@ static void test_longstrings(void)
     ok(r == ERROR_SUCCESS, "MsiDatabaseCommit failed\n");
     MsiCloseHandle(hdb);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     r = MsiDatabaseOpenViewA(hdb, "select * from `strings` where `id` = 1", &hview);
@@ -1564,7 +1564,7 @@ static void test_streamtable(void)
 
     MsiCloseHandle( hdb );
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb );
     ok( r == ERROR_SUCCESS , "Failed to open database\n" );
 
     /* check the column types */
@@ -1777,7 +1777,7 @@ static void test_binary(void)
     UINT r;
 
     /* insert a file into the Binary table */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb );
     ok( r == ERROR_SUCCESS , "Failed to open database\n" );
 
     query = "CREATE TABLE `Binary` ( `Name` CHAR(72) NOT NULL, `ID` INT NOT NULL, `Data` OBJECT  PRIMARY KEY `Name`, `ID`)";
@@ -1804,7 +1804,7 @@ static void test_binary(void)
     ok( r == ERROR_SUCCESS , "Failed to close database\n" );
 
     /* read file from the Stream table */
-    r = MsiOpenDatabaseA( msifile, MSIDBOPEN_READONLY, &hdb );
+    r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY, &hdb );
     ok( r == ERROR_SUCCESS , "Failed to open database\n" );
 
     query = "SELECT * FROM `_Streams`";
@@ -2162,7 +2162,7 @@ static void test_suminfo_import(void)
 
     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
     r = add_table_to_db(hdb, suminfo);
@@ -2282,7 +2282,7 @@ static void test_msiimport(void)
 
     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     r = add_table_to_db(hdb, test_data);
@@ -2499,7 +2499,7 @@ static void test_binary_import(void)
     create_file_data("bin_import/filename1.ibd", "just some words", 15);
 
     /* import files into database */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok( r == ERROR_SUCCESS , "Failed to open database\n");
 
     GetCurrentDirectoryA(MAX_PATH, path);
@@ -2766,13 +2766,13 @@ static void generate_transform(void)
     /* start with two identical databases */
     CopyFileA(msifile2, msifile, FALSE);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb1 );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb1 );
     ok( r == ERROR_SUCCESS , "Failed to create database\n" );
 
     r = MsiDatabaseCommit( hdb1 );
     ok( r == ERROR_SUCCESS , "Failed to commit database\n" );
 
-    r = MsiOpenDatabaseA(msifile2, MSIDBOPEN_READONLY, &hdb2 );
+    r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_READONLY, &hdb2 );
     ok( r == ERROR_SUCCESS , "Failed to create database\n" );
 
     /* the transform between two identical database should be empty */
@@ -3018,15 +3018,15 @@ static UINT set_summary_info(MSIHANDLE hdb)
     return res;
 }
 
-static MSIHANDLE create_package_db(LPCSTR filename)
+static MSIHANDLE create_package_db(const WCHAR *filename)
 {
     MSIHANDLE hdb = 0;
     UINT res;
 
-    DeleteFileA(msifile);
+    DeleteFileW(msifileW);
 
     /* create an empty database */
-    res = MsiOpenDatabaseA(filename, MSIDBOPEN_CREATE, &hdb );
+    res = MsiOpenDatabaseW(filename, MSIDBOPEN_CREATE, &hdb );
     ok( res == ERROR_SUCCESS , "Failed to create database\n" );
     if( res != ERROR_SUCCESS )
         return hdb;
@@ -3077,7 +3077,7 @@ static void test_try_transform(void)
     DeleteFileA(mstfile);
 
     /* create the database */
-    hdb = create_package_db(msifile);
+    hdb = create_package_db(msifileW);
     ok(hdb, "Failed to create package db\n");
 
     query = "CREATE TABLE `MOO` ( `NOO` SHORT NOT NULL, `OOO` CHAR(255) PRIMARY KEY `NOO`)";
@@ -3130,7 +3130,7 @@ static void test_try_transform(void)
     else
         generate_transform_manual();
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_DIRECT, &hdb );
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb );
     ok( r == ERROR_SUCCESS , "Failed to create database\n" );
 
     r = MsiDatabaseApplyTransformA( hdb, mstfile, 0 );
@@ -4297,7 +4297,7 @@ static void test_integers(void)
     UINT r;
 
     /* 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");
 
     /* create a table */
@@ -4425,7 +4425,7 @@ static void test_update(void)
     UINT r;
 
     /* 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");
 
     /* create the Control table */
@@ -4728,7 +4728,7 @@ static void test_special_tables(void)
     MSIHANDLE hdb = 0;
     UINT r;
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `_Properties` ( "
@@ -4768,7 +4768,7 @@ static void test_tables_order(void)
     char buffer[100];
     DWORD sz;
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `foo` ( "
@@ -4922,7 +4922,7 @@ static void test_rows_order(void)
     char buffer[100];
     DWORD sz;
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `foo` ( "
@@ -5087,7 +5087,7 @@ static void test_collation(void)
     WCHAR bufferW[100];
     DWORD sz;
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `bar` ( "
@@ -5366,7 +5366,7 @@ static void test_viewmodify_update(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `table` (`A` INT, `B` INT PRIMARY KEY `A`)";
@@ -5624,7 +5624,7 @@ static void test_viewmodify_assign(void)
     /* setup database */
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `table` (`A` INT, `B` INT PRIMARY KEY `A`)";
@@ -5786,7 +5786,7 @@ static void test_stringtable(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `MOO` (`A` INT, `B` CHAR(72) PRIMARY KEY `A`)";
@@ -5848,7 +5848,7 @@ static void test_stringtable(void)
     r = MsiCloseHandle(hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "SELECT * FROM `MOO`";
@@ -6014,7 +6014,7 @@ static void test_viewmodify_delete(void)
     DeleteFileA(msifile);
 
     /* just MsiOpenDatabase should not create a file */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `phone` ( "
@@ -6188,7 +6188,7 @@ static void test_defaultdatabase(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     r = MsiDatabaseCommit(hdb);
@@ -6472,7 +6472,7 @@ static void test_viewmodify_delete_temporary(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table` ( `A` SHORT PRIMARY KEY `A` )";
@@ -6590,7 +6590,7 @@ static void test_deleterow(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
@@ -6614,7 +6614,7 @@ static void test_deleterow(void)
 
     MsiCloseHandle(hdb);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "SELECT * FROM `Table`";
@@ -6657,7 +6657,7 @@ static void test_quotes(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
@@ -6763,7 +6763,7 @@ static void test_carriagereturn(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table`\r ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
@@ -6949,7 +6949,7 @@ static void test_noquotes(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE Table ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
@@ -7158,7 +7158,7 @@ static void test_forcecodepage(void)
     DeleteFileA(msifile);
     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "SELECT * FROM `_ForceCodepage`";
@@ -7182,7 +7182,7 @@ static void test_forcecodepage(void)
 
     MsiCloseHandle(hdb);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_DIRECT, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "SELECT * FROM `_ForceCodepage`";
@@ -7228,7 +7228,7 @@ static void test_viewmodify_refresh(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL, `B` INT PRIMARY KEY `A` )";
@@ -7316,7 +7316,7 @@ static void test_where_viewmodify(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "CREATE TABLE `Table` ( `A` INT, `B` INT PRIMARY KEY `A` )";
@@ -7461,7 +7461,7 @@ static void test_storages_table(void)
 
     MsiCloseHandle(hdb);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
     ok(r == ERROR_SUCCESS , "Failed to open database\n");
 
     /* check the column types */
@@ -7571,7 +7571,7 @@ static void test_dbtopackage(void)
     UINT r;
 
     /* create an empty database, transact mode */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "Failed to create database\n");
 
     set_summary_info(hdb);
@@ -7635,7 +7635,7 @@ static void test_dbtopackage(void)
     MsiCloseHandle(hpkg);
 
     /* create an empty database, direct mode */
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb);
     ok(r == ERROR_SUCCESS, "Failed to create database\n");
 
     set_summary_info(hdb);
@@ -7705,7 +7705,7 @@ static void test_droptable(void)
     DWORD size;
     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);
 
     query = "CREATE TABLE `One` ( `A` INT PRIMARY KEY `A` )";
@@ -7918,16 +7918,17 @@ static void test_droptable(void)
 
 static void test_dbmerge(void)
 {
+    static const WCHAR refdbW[] = {'r','e','f','d','b','.','m','s','i',0};
     MSIHANDLE hdb, href, hview, hrec;
     CHAR buf[MAX_PATH];
     LPCSTR query;
     DWORD size;
     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);
 
-    r = MsiOpenDatabaseA("refdb.msi", MSIDBOPEN_CREATE, &href);
+    r = MsiOpenDatabaseW(refdbW, MSIDBOPEN_CREATE, &href);
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     /* hDatabase is invalid */
@@ -8536,7 +8537,7 @@ static void test_dbmerge(void)
     MsiCloseHandle(hdb);
     MsiCloseHandle(href);
     DeleteFileA(msifile);
-    DeleteFileA("refdb.msi");
+    DeleteFileW(refdbW);
     DeleteFileA("codepage.idt");
     DeleteFileA("binary.dat");
 }
@@ -9322,7 +9323,7 @@ static void test_createtable(void)
         res = MsiCloseHandle(hdb);
         ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
-        res = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb );
+        res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb );
         ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
 
         query = "SELECT * FROM `a`";
@@ -9368,7 +9369,7 @@ static void test_embedded_nulls(void)
     MSIHANDLE hdb, hrec;
     char buffer[32];
 
-    r = MsiOpenDatabaseA( msifile, MSIDBOPEN_CREATE, &hdb );
+    r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb );
     ok( r == ERROR_SUCCESS, "failed to open database %u\n", r );
 
     GetCurrentDirectoryA( MAX_PATH, CURR_DIR );
@@ -9399,7 +9400,7 @@ static void test_select_column_names(void)
 
     DeleteFileA(msifile);
 
-    r = MsiOpenDatabaseA( msifile, MSIDBOPEN_CREATE, &hdb );
+    r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_CREATE, &hdb );
     ok( r == ERROR_SUCCESS , "failed to open database: %u\n", r );
 
     r = try_query( hdb, "CREATE TABLE `t` (`a` CHAR NOT NULL, `b` CHAR PRIMARY KEY `a`)");
diff --git a/dlls/msi/tests/format.c b/dlls/msi/tests/format.c
index 975776c..8ed4bbb 100644
--- a/dlls/msi/tests/format.c
+++ b/dlls/msi/tests/format.c
@@ -203,7 +203,7 @@ static MSIHANDLE create_package_db(void)
     DeleteFileW(msifileW);
 
     /* 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 );
     if( res != ERROR_SUCCESS )
         return 0;
@@ -267,11 +267,19 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
 {
     MSIHANDLE hPackage, suminfo, hdb = 0;
     UINT res;
+    WCHAR *nameW;
+    int len;
 
     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 */
-    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 );
     if (res != ERROR_SUCCESS)
         return res;
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 6604e02..24f87eb 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2306,9 +2306,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
 {
     MSIHANDLE db;
     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);
 
     /* import the tables into the database */
@@ -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);
 
     MsiCloseHandle(db);
+    HeapFree( GetProcessHeap(), 0, nameW );
 }
 
 static void check_service_is_installed(void)
@@ -2729,6 +2735,7 @@ static void test_packagecoltypes(void)
 {
     MSIHANDLE hdb, view, rec;
     char path[MAX_PATH];
+    WCHAR pathW[MAX_PATH];
     LPCSTR query;
     UINT r, count;
 
@@ -2739,8 +2746,9 @@ static void test_packagecoltypes(void)
     lstrcpyA(path, CURR_DIR);
     lstrcatA(path, "\\");
     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);
 
     query = "SELECT * FROM `Media`";
@@ -3413,13 +3421,13 @@ static void generate_transform(void)
     /* start with two identical databases */
     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");
 
     r = MsiDatabaseCommit(hdb1);
     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");
 
     query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
@@ -3629,12 +3637,12 @@ error:
     RemoveDirectoryA("diffdir");
 }
 
-static void set_admin_summary_info(const CHAR *name)
+static void set_admin_summary_info(const WCHAR *name)
 {
     MSIHANDLE db, summary;
     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);
 
     r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
@@ -3663,7 +3671,7 @@ static void test_admin(void)
     create_file("msitest\\augustus", 500);
 
     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);
 
@@ -3740,7 +3748,7 @@ static void test_adminprops(void)
     create_file("msitest\\augustus", 500);
 
     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);
 
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -4615,6 +4623,9 @@ error:
 
 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 int1[] = "int1\ni1\nint1\tint1\n1";
     static const char int2[] = "int2\ni2\nint2\tint2\n1";
@@ -4638,41 +4649,43 @@ static void test_int_widths( void )
         { int5, sizeof(int5) - 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;
     UINT r, i;
 
-    GetTempPathA(MAX_PATH, tmpdir);
-    CreateDirectoryA(tmpdir, NULL);
+    GetTempPathW(MAX_PATH, tmpdir);
+    CreateDirectoryW(tmpdir, NULL);
 
-    lstrcpyA(msitable, tmpdir);
-    lstrcatA(msitable, "\\msitable.idt");
+    lstrcpyW(msitable, tmpdir);
+    lstrcatW(msitable, slashW);
+    lstrcatW(msitable, msitableW);
 
-    lstrcpyA(msidb, tmpdir);
-    lstrcatA(msidb, "\\msitest.msi");
+    lstrcpyW(msidb, tmpdir);
+    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);
 
     for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
     {
         DWORD count;
-        HANDLE handle = CreateFileA(msitable, GENERIC_WRITE, 0, NULL,
+        HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
                                     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
         WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
         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);
 
         r = MsiDatabaseCommit(db);
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-        DeleteFileA(msitable);
+        DeleteFileW(msitable);
     }
 
     MsiCloseHandle(db);
-    DeleteFileA(msidb);
-    RemoveDirectoryA(tmpdir);
+    DeleteFileW(msidb);
+    RemoveDirectoryW(tmpdir);
 }
 
 static void test_shortcut(void)
@@ -5254,7 +5267,7 @@ static void test_icon_table(void)
 
     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);
 
     query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL  PRIMARY KEY `Name`)";
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index 0f1e8fa..c2deb31 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -1045,9 +1045,14 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
 {
     MSIHANDLE db;
     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);
 
     /* import the tables into the database */
@@ -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);
 
     MsiCloseHandle(db);
+    HeapFree( GetProcessHeap(), 0, nameW );
 }
 
 static UINT run_query(MSIHANDLE hdb, const char *query)
@@ -1140,7 +1146,7 @@ static MSIHANDLE create_package_db(LPSTR prodcode)
     DeleteFileA(msifile);
 
     /* 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" );
     if (res != ERROR_SUCCESS)
         return hdb;
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 4f99256..c527118 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -759,7 +759,7 @@ static MSIHANDLE create_package_db(void)
     DeleteFileA(msifile);
 
     /* 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 );
     if( res != ERROR_SUCCESS )
         return hdb;
@@ -2435,7 +2435,7 @@ static void test_msipackage(void)
     r = MsiOpenPackageA(name, &hpack);
     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);
 
     /* database exists, but is emtpy */
@@ -2466,7 +2466,7 @@ static void test_msipackage(void)
     DeleteFileA(msifile);
 
     /* 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);
 
     sprintf(name, "#%d", hdb);
@@ -2650,6 +2650,12 @@ static void test_states(void)
     static char msifile2[] = "winetest2-package.msi";
     static char msifile3[] = "winetest3-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;
     UINT r;
     MSIHANDLE hdb;
@@ -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");
     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);
 
     /* these properties must not be in the saved msi file */
@@ -3182,7 +3188,7 @@ static void test_states(void)
     r = MsiInstallProductA(msifile2, "ADDLOCAL=ALL");
     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);
 
     /* these properties must not be in the saved msi file */
@@ -3249,7 +3255,7 @@ static void test_states(void)
     r = MsiInstallProductA(msifile3, "ADDSOURCE=ALL");
     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);
 
     /* this property must not be in the saved msi file */
@@ -3318,7 +3324,7 @@ static void test_states(void)
     r = MsiInstallProductA(msifile3, "REINSTALL=ALL");
     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);
 
     /* this property must not be in the saved msi file */
@@ -6826,7 +6832,7 @@ static void test_MsiGetSourcePath(void)
 
     /* 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);
 
     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
@@ -7340,7 +7346,7 @@ static void test_shortlongsource(void)
 
     /* 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);
 
     set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
@@ -7960,7 +7966,7 @@ static void test_access(void)
     MSIHANDLE hdb;
     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);
 
     test_file_access(msifile, create);
@@ -7974,7 +7980,7 @@ static void test_access(void)
     test_file_access(msifile, create_close);
     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);
 
     test_file_access(msifile, create);
@@ -8177,7 +8183,7 @@ static void test_MsiGetProductProperty(void)
     if (is_wow64)
         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);
 
     r = MsiDatabaseCommit(hdb);
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index 23126a9..3168c85 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -266,12 +266,12 @@ static void write_file( const char *filename, const char *data, DWORD data_size
     CloseHandle( file );
 }
 
-static void set_suminfo( const char *filename )
+static void set_suminfo( const WCHAR *filename )
 {
     UINT r;
     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 );
 
     r = MsiGetSummaryInformationA( hdb, NULL, 7, &hsi );
@@ -312,8 +312,14 @@ static void create_database( const char *filename, const struct msi_table *table
 {
     MSIHANDLE hdb;
     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);
 
     /* import the tables into the database */
@@ -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);
 
     MsiCloseHandle( hdb );
-    set_suminfo( filename );
+    set_suminfo( filenameW );
+    HeapFree( GetProcessHeap(), 0, filenameW );
 }
 
 /* data for generating a patch */
@@ -712,6 +719,7 @@ static void test_simple_patch( void )
     DWORD size;
     char path[MAX_PATH], install_source[MAX_PATH], buffer[32];
     const char *query;
+    WCHAR pathW[MAX_PATH];
     MSIHANDLE hpackage, hdb, hview, hrec;
 
     if (!pMsiApplyPatchA)
@@ -860,7 +868,8 @@ static void test_simple_patch( void )
                             "LocalPackage", path, &size );
     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 );
 
     r = MsiDatabaseOpenViewA( hdb, query, &hview );
@@ -902,25 +911,25 @@ static void test_MsiOpenDatabase( void )
     UINT r;
     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);
 
     r = MsiDatabaseCommit( hdb );
     ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
     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);
     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);
 
     r = MsiDatabaseCommit( hdb );
     ok(r == ERROR_SUCCESS, "failed to commit database %u\n", r);
     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);
     MsiCloseHandle( hdb );
     DeleteFileA( mspfile );
@@ -928,10 +937,10 @@ static void test_MsiOpenDatabase( void )
     create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
     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 );
 
-    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 );
     MsiCloseHandle( hdb );
 
diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c
index 5e64e24..90d8bb8 100644
--- a/dlls/msi/tests/record.c
+++ b/dlls/msi/tests/record.c
@@ -547,7 +547,7 @@ static void test_fieldzero(void)
 
     MsiCloseHandle(rec);
 
-    r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
+    r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
     ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
 
     query = "CREATE TABLE `drone` ( "
diff --git a/dlls/msi/tests/suminfo.c b/dlls/msi/tests/suminfo.c
index 0e39cd4..8c2e292 100644
--- a/dlls/msi/tests/suminfo.c
+++ b/dlls/msi/tests/suminfo.c
@@ -79,7 +79,7 @@ static void test_suminfo(void)
     DeleteFileA(msifile);
 
     /* 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");
 
     r = MsiGetSummaryInformationA(hdb, NULL, 0, NULL);
@@ -411,7 +411,7 @@ static void test_summary_binary(void)
     ok(GetFileAttributesA(msifile) != INVALID_FILE_ATTRIBUTES, "file doesn't exist!\n");
 
     /* 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");
 
     r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
-- 
1.8.1.5






More information about the wine-patches mailing list