msi [1/5]: Implement MsiDatabaseImport

James Hawkins truiken at gmail.com
Mon Sep 25 22:01:51 CDT 2006


Hi,

Changelog:
* Implement MsiDatabaseImport.

 dlls/msi/database.c      |  397 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/msi/tests/db.c      |   86 ++++------
 dlls/msi/tests/install.c |   96 ++++-------
 3 files changed, 457 insertions(+), 122 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/database.c b/dlls/msi/database.c
index d984613..2969f0f 100644
--- a/dlls/msi/database.c
+++ b/dlls/msi/database.c
@@ -28,6 +28,7 @@ #include "winbase.h"
 #include "winreg.h"
 #include "winnls.h"
 #include "wine/debug.h"
+#include "wine/unicode.h"
 #include "msi.h"
 #include "msiquery.h"
 #include "msipriv.h"
@@ -245,14 +246,402 @@ end:
     return r;
 }
 
-UINT MSI_DatabaseImport( MSIDATABASE *db, LPCWSTR folder, LPCWSTR file )
+static LPWSTR msi_read_text_archive(LPCWSTR path)
 {
-    FIXME("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) );
+    HANDLE file;
+    LPSTR data = NULL;
+    DWORD read, size = 0;
+
+    file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
+    if (file == INVALID_HANDLE_VALUE)
+        return NULL;
+
+    size = GetFileSize( file, NULL );
+    data = msi_alloc( size + 1 );
+    if (!data)
+        return NULL;
+
+    if (!ReadFile( file, data, size, &read, NULL ))
+        return NULL;
+
+    data[size] = '\0';
+    return strdupAtoW( data );
+}
+
+static void msi_parse_line(LPWSTR *line, LPWSTR **entries, DWORD *num_entries)
+{
+    LPWSTR ptr = *line, save;
+    DWORD i, count = 1;
+
+    *entries = NULL;
+
+    /* stay on this line */
+    while (*ptr && *ptr != '\n')
+    {
+        /* entries are separated by tabs */
+        if (*ptr == '\t')
+            count++;
+
+        ptr++;
+    }
+
+    *entries = msi_alloc(count * sizeof(LPWSTR));
+    if (!*entries)
+        return;
+
+    /* store pointers into the data */
+    for (i = 0, ptr = *line; i < count; i++)
+    {
+        save = ptr;
+
+        while (*ptr && *ptr != '\t' && *ptr != '\n') ptr++;
+
+        /* NULL-separate the data */
+        if (*ptr)
+            *ptr++ = '\0';
+
+        (*entries)[i] = save;
+    }
+
+    /* move to the next line if there's more, else EOF */
+    *line = ptr;
+
+    if (num_entries)
+        *num_entries = count;
+}
+
+static const WCHAR create_fmts[][25] =
+{
+    {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','%','s','`',' ','(',' ',0},
+    {' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','%','s','`',')',' ','H','O','L','D',0},
+    {'`','%','s','`',' ','%','s','%','s','%','s','%','s',' ',0},
+};
+
+static const WCHAR type_strs[][11] =
+{
+    {'C','H','A','R',0},
+    {'I','N','T',0},
+    {'L','O','N','G',0},
+    {' ','N','O','T',' ','N','U','L','L',0},
+};
+
+#define IDX_CHAR    0
+#define IDX_INT     1
+#define IDX_LONG    2
+#define IDX_NOTNULL 3
+
+static UINT msi_add_table_to_db(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types, LPWSTR *labels, DWORD num_columns)
+{
+    UINT r;
+    MSIQUERY *view;
+    LPWSTR create_sql, sql_ptr;
+    DWORD size, i;
+    WCHAR expanded[128];
+    WCHAR *ptr;
+    DWORD len;
+
+    size = lstrlenW(create_fmts[0]) + lstrlenW(labels[0]) - 1;
+
+    for (i = 0; i < num_columns; i++)
+    {
+        if (i == num_columns - 1)
+            size--;
+
+        size += lstrlenW(create_fmts[2]) + lstrlenW(columns[i]) - 9;
+
+        ptr = &types[i][1];
+        len = atolW(ptr);
+
+        switch (types[i][0])
+        {
+            case 'l':
+            case 's':
+                size += lstrlenW(type_strs[IDX_NOTNULL]);
+            case 'L':
+            case 'S':
+                size += lstrlenW(ptr) + 2;
+                size += lstrlenW(type_strs[IDX_CHAR]);
+                break;
+            case 'I':
+            case 'i':
+                if (len == 2)
+                    size += lstrlenW(type_strs[IDX_INT]);
+                else
+                    size += lstrlenW(type_strs[IDX_LONG]);
+                break;
+            default:
+                return ERROR_FUNCTION_FAILED;
+        }
+    }
+
+    size += lstrlenW(create_fmts[1]) + lstrlenW(labels[1]) - 2;
+
+    create_sql = msi_alloc(size * sizeof(WCHAR));
+    if (!create_sql)
+        return ERROR_OUTOFMEMORY;
+
+    /* construct the CREATE sql statement */
+    sql_ptr = create_sql;
+    sprintfW(sql_ptr, create_fmts[0], labels[0]);
+
+    for (i = 0; i < num_columns; i++)
+    {
+        static const WCHAR size_fmt[] = {'(','%','s',')',0};
+        WCHAR size[10], comma[2], extra[10];
+        LPCWSTR type = NULL;
+
+        comma[1] = size[0] = extra[0] = '\0';
+
+        if (i == num_columns - 1)
+            comma[0] = '\0';
+        else
+            comma[0] = ',';
+
+        ptr = &types[i][1];
+        len = atolW(ptr);
+
+        switch (types[i][0])
+        {
+            case 'l': case 's':
+                lstrcpyW(extra, type_strs[IDX_NOTNULL]);
+            case 'L': case 'S':
+                type = type_strs[IDX_CHAR];
+                sprintfW(size, size_fmt, ptr);
+                break;
+            case 'I': case 'i':
+                if (len == 2)
+                    type = type_strs[IDX_INT];
+                else
+                    type = type_strs[IDX_LONG];
+                break;
+        }
+
+        sprintfW(expanded, create_fmts[2], columns[i], type, size, extra, comma);
+        lstrcatW(sql_ptr, expanded);
+    }
+
+    sql_ptr += lstrlenW(sql_ptr);
+    sprintfW(sql_ptr, create_fmts[1], labels[1]);
+
+    r = MSI_DatabaseOpenViewW( db, create_sql, &view );
+    msi_free(create_sql);
+    if (r != ERROR_SUCCESS)
+        return r;
+
+    r = MSI_ViewExecute(view, NULL);
+    MSI_ViewClose(view);
+    msiobj_release(&view->hdr);
+
+    return r;
+}
+
+static const WCHAR insert_fmts[][100] =
+{
+    {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','%','s','`',' ','(',' ',0},
+    {'`','%','s','`',',',' ',0},
+    {' ',')',' ','V','A','L','U','E','S',' ','(',' ',0},
+    {'\'','%','s','\'',',',' ',0},
+    {'%','s',',',' ',0},
+    {' ',')',0},
+};
+
+static UINT msi_add_records_to_table(MSIDATABASE *db, LPWSTR *columns, LPWSTR *types,
+                                     LPWSTR *labels, LPWSTR **records,
+                                     int num_columns, int num_records)
+{
+    MSIQUERY *view;
+    LPWSTR insert_sql;
+    LPWSTR expanded;
+    DWORD sql_size, size, exp_size = 10;
+    DWORD i, j;
+    UINT r = ERROR_SUCCESS;
+
+    expanded = msi_alloc(exp_size * sizeof(WCHAR));
+    if (!expanded)
+        return ERROR_OUTOFMEMORY;
+
+    for (i = 0; i < num_records; i++)
+    {
+        sql_size = lstrlenW(insert_fmts[0]) + lstrlenW(labels[0]) - 1;
+        sql_size += lstrlenW(insert_fmts[2]) + lstrlenW(insert_fmts[5]);
+        sql_size += (lstrlenW(insert_fmts[1]) - 2) * num_columns - 1;
+
+        for (j = 0; j < num_columns; j++)
+        {
+            sql_size += lstrlenW(columns[j]);
+            sql_size += lstrlenW(records[i][j]);
+
+            switch (types[j][0])
+            {
+                case 'L': case 'l': case 'S': case 's':
+                    sql_size += lstrlenW(insert_fmts[3]) - 2;
+                    break;
+                case 'I': case 'i':
+                    sql_size += lstrlenW(insert_fmts[4]) - 2;
+                    break;
+                default:
+                    return ERROR_FUNCTION_FAILED;
+            }
+        }
+
+        insert_sql = msi_alloc(sql_size * sizeof(WCHAR));
+        if (!insert_sql)
+            return ERROR_OUTOFMEMORY;
+
+        /* create the INSERT sql query */
+        sprintfW(insert_sql, insert_fmts[0], labels[0]);
+
+        for (j = 0; j < num_columns; j++)
+        {
+            size = lstrlenW(insert_fmts[1]) + lstrlenW(columns[j]) - 1;
+            if (size > exp_size)
+            {
+                exp_size = size;
+                expanded = msi_realloc(expanded, exp_size * sizeof(WCHAR));
+                if (!expanded)
+                    return ERROR_OUTOFMEMORY;
+            }
+
+            sprintfW(expanded, insert_fmts[1], columns[j]);
+            if (j == num_columns - 1)
+                expanded[size - 3] = '\0';
+
+            lstrcatW(insert_sql, expanded);
+        }
+
+        lstrcatW(insert_sql, insert_fmts[2]);
+
+        for (j = 0; j < num_columns; j++)
+        {
+            static const WCHAR empty[] = {'\'','\'',0};
+
+            size = lstrlenW(records[i][j]) + 1;
+            switch (types[j][0])
+            {
+                case 'L': case 'l': case 'S': case 's':
+                    size += lstrlenW(insert_fmts[3]) - 2;
+                    break;
+                case 'I': case 'i':
+                    if (*records[i][j])
+                        size += lstrlenW(insert_fmts[4]) - 2;
+                    else
+                        size += lstrlenW(empty);
+                    break;
+            }
+
+            if (size > exp_size)
+            {
+                exp_size = size;
+                expanded = msi_realloc(expanded, exp_size * sizeof(WCHAR));
+                if (!expanded)
+                    return ERROR_OUTOFMEMORY;
+            }
+
+            switch (types[j][0])
+            {
+                case 'L': case 'l': case 'S': case 's':
+                    sprintfW(expanded, insert_fmts[3], records[i][j]);
+                    break;
+                case 'I': case 'i':
+                    if (*records[i][j])
+                        sprintfW(expanded, insert_fmts[4], records[i][j]);
+                    else
+                        sprintfW(expanded, insert_fmts[4], empty);
+                    break;
+            }
+
+            if (j == num_columns - 1)
+                expanded[size - 3] = '\0';
+
+            lstrcatW(insert_sql, expanded);
+        }
+
+        lstrcatW(insert_sql, insert_fmts[5]);
+
+        r = MSI_DatabaseOpenViewW( db, insert_sql, &view );
+        msi_free(insert_sql);
+        if (r != ERROR_SUCCESS)
+        {
+            msi_free(expanded);
+            return r;
+        }
+
+        r = MSI_ViewExecute(view, NULL);
+        MSI_ViewClose(view);
+        msiobj_release(&view->hdr);
+    }
+
+    msi_free(expanded);
+    return r;
+}
+
+UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
+{
+    UINT r;
+    DWORD len, i;
+    DWORD num_columns;
+    DWORD num_records = 0;
+    LPWSTR path, ptr;
+    LPWSTR data;
+    LPWSTR *columns, *types, *labels;
+    LPWSTR **records;
+
+    static const WCHAR backslash[] = {'\\',0};
+
+    TRACE("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) );
 
     if( folder == NULL || file == NULL )
         return ERROR_INVALID_PARAMETER;
-   
-    return ERROR_CALL_NOT_IMPLEMENTED;
+
+    len = lstrlenW(folder) + lstrlenW(backslash) + lstrlenW(file) + 1;
+    path = msi_alloc( len * sizeof(WCHAR) );
+    if (!path)
+        return ERROR_OUTOFMEMORY;
+
+    lstrcpyW( path, folder );
+    lstrcatW( path, backslash );
+    lstrcatW( path, file );
+
+    data = msi_read_text_archive( path );
+
+    ptr = data;
+    msi_parse_line( &ptr, &columns, &num_columns );
+    msi_parse_line( &ptr, &types, NULL );
+    msi_parse_line( &ptr, &labels, NULL );
+
+    records = msi_alloc(sizeof(LPWSTR *));
+    if (!records)
+        return ERROR_OUTOFMEMORY;
+
+    /* read in the table records */
+    while (*ptr)
+    {
+        msi_parse_line( &ptr, &records[num_records], NULL );
+
+        num_records++;
+        records = msi_realloc(records, (num_records + 1) * sizeof(LPWSTR *));
+        if (!records)
+            return ERROR_OUTOFMEMORY;
+    }
+
+    r = msi_add_table_to_db( db, columns, types, labels, num_columns );
+    if (r != ERROR_SUCCESS)
+        goto done;
+
+    r = msi_add_records_to_table( db, columns, types, labels, records, num_columns, num_records );
+
+done:
+    msi_free(path);
+    msi_free(data);
+    msi_free(columns);
+    msi_free(types);
+
+    for (i = 0; i < num_records; i++)
+        msi_free(records[i]);
+
+    msi_free(records);
+
+    return r;
 }
 
 UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFilename)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 5ccd731..ce2338c 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1396,91 +1396,67 @@ static void test_msiimport(void)
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     r = add_table_to_db(hdb, test_data);
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    }
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     query = "SELECT * FROM `TestTable`";
     r = MsiDatabaseOpenView(hdb, query, &view);
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    }
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec);
     count = MsiRecordGetFieldCount(rec);
-    todo_wine
-    {
-        ok(count == 9, "Expected 9, got %d\n", count);
-        ok(check_record(rec, 1, "FirstPrimaryColumn"), "Expected FirstPrimaryColumn\n");
-        ok(check_record(rec, 2, "SecondPrimaryColumn"), "Expected SecondPrimaryColumn\n");
-        ok(check_record(rec, 3, "ShortInt"), "Expected ShortInt\n");
-        ok(check_record(rec, 4, "ShortIntNullable"), "Expected ShortIntNullalble\n");
-        ok(check_record(rec, 5, "LongInt"), "Expected LongInt\n");
-        ok(check_record(rec, 6, "LongIntNullable"), "Expected LongIntNullalble\n");
-        ok(check_record(rec, 7, "String"), "Expected String\n");
-        ok(check_record(rec, 8, "LocalizableString"), "Expected LocalizableString\n");
-        ok(check_record(rec, 9, "LocalizableStringNullable"), "Expected LocalizableStringNullable\n");
-    }
+    ok(count == 9, "Expected 9, got %d\n", count);
+    ok(check_record(rec, 1, "FirstPrimaryColumn"), "Expected FirstPrimaryColumn\n");
+    ok(check_record(rec, 2, "SecondPrimaryColumn"), "Expected SecondPrimaryColumn\n");
+    ok(check_record(rec, 3, "ShortInt"), "Expected ShortInt\n");
+    ok(check_record(rec, 4, "ShortIntNullable"), "Expected ShortIntNullalble\n");
+    ok(check_record(rec, 5, "LongInt"), "Expected LongInt\n");
+    ok(check_record(rec, 6, "LongIntNullable"), "Expected LongIntNullalble\n");
+    ok(check_record(rec, 7, "String"), "Expected String\n");
+    ok(check_record(rec, 8, "LocalizableString"), "Expected LocalizableString\n");
+    ok(check_record(rec, 9, "LocalizableStringNullable"), "Expected LocalizableStringNullable\n");
 
     r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec);
     count = MsiRecordGetFieldCount(rec);
+    ok(count == 9, "Expected 9, got %d\n", count);
+    ok(check_record(rec, 1, "s255"), "Expected s255\n");
     todo_wine
     {
-        ok(count == 9, "Expected 9, got %d\n", count);
-        ok(check_record(rec, 1, "s255"), "Expected s255\n");
         ok(check_record(rec, 2, "i2"), "Expected i2\n");
         ok(check_record(rec, 3, "i2"), "Expected i2\n");
-        ok(check_record(rec, 4, "I2"), "Expected I2\n");
         ok(check_record(rec, 5, "i4"), "Expected i4\n");
-        ok(check_record(rec, 6, "I4"), "Expected I4\n");
-        ok(check_record(rec, 7, "S255"), "Expected S255\n");
-        ok(check_record(rec, 8, "S0"), "Expected S0\n");
-        ok(check_record(rec, 9, "s0"), "Expected s0\n");
     }
+    ok(check_record(rec, 4, "I2"), "Expected I2\n");
+    ok(check_record(rec, 6, "I4"), "Expected I4\n");
+    ok(check_record(rec, 7, "S255"), "Expected S255\n");
+    ok(check_record(rec, 8, "S0"), "Expected S0\n");
+    ok(check_record(rec, 9, "s0"), "Expected s0\n");
 
     query = "SELECT * FROM `TestTable`";
     r = do_query(hdb, query, &rec);
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
-    }
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
-    todo_wine
-    {
-        ok(check_record(rec, 1, "stringage"), "Expected 'stringage'\n");
-        ok(check_record(rec, 7, "another string"), "Expected 'another string'\n");
-        ok(check_record(rec, 8, "localizable"), "Expected 'localizable'\n");
-        ok(check_record(rec, 9, "duh"), "Expected 'duh'\n");
-    }
+    ok(check_record(rec, 1, "stringage"), "Expected 'stringage'\n");
+    ok(check_record(rec, 7, "another string"), "Expected 'another string'\n");
+    ok(check_record(rec, 8, "localizable"), "Expected 'localizable'\n");
+    ok(check_record(rec, 9, "duh"), "Expected 'duh'\n");
 
     i = MsiRecordGetInteger(rec, 2);
-    todo_wine
-    {
-        ok(i == 5, "Expected 5, got %d\n", i);
-    }
+    ok(i == 5, "Expected 5, got %d\n", i);
 
     i = MsiRecordGetInteger(rec, 3);
-    todo_wine
-    {
-        ok(i == 2, "Expected 2, got %d\n", i);
-    }
+    ok(i == 2, "Expected 2, got %d\n", i);
 
     i = MsiRecordGetInteger(rec, 4);
-    ok(i == 0x80000000, "Expected 0x80000000, got %d\n", i);
-
-    i = MsiRecordGetInteger(rec, 5);
     todo_wine
     {
-        ok(i == 2147483640, "Expected 2147483640, got %d\n", i);
+        ok(i == 0x80000000, "Expected 0x80000000, got %d\n", i);
     }
 
+    i = MsiRecordGetInteger(rec, 5);
+    ok(i == 2147483640, "Expected 2147483640, got %d\n", i);
+
     i = MsiRecordGetInteger(rec, 6);
-    todo_wine
-    {
-        ok(i == -2147483640, "Expected -2147483640, got %d\n", i);
-    }
+    ok(i == -2147483640, "Expected -2147483640, got %d\n", i);
 
     MsiCloseHandle(rec);
     MsiCloseHandle(view);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 33f34b3..e9d177e 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -441,7 +441,6 @@ static BOOL init_function_pointers(void)
 static BOOL get_program_files_dir(LPSTR buf)
 {
     HKEY hkey;
-    CHAR temp[MAX_PATH];
     DWORD type = REG_EXPAND_SZ, size;
 
     if (RegOpenKey(HKEY_LOCAL_MACHINE,
@@ -449,11 +448,9 @@ static BOOL get_program_files_dir(LPSTR 
         return FALSE;
 
     size = MAX_PATH;
-    if (RegQueryValueEx(hkey, "ProgramFilesPath", 0, &type, (LPBYTE)temp, &size))
+    if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size))
         return FALSE;
 
-    ExpandEnvironmentStrings(temp, buf, MAX_PATH);
-
     RegCloseKey(hkey);
     return TRUE;
 }
@@ -579,10 +576,7 @@ static void create_database(const CHAR *
         write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
 
         r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
-        todo_wine
-        {
-            ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-        }
+        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
         DeleteFileA(table->filename);
     }
@@ -604,39 +598,27 @@ static void test_MsiInstallProduct(void)
     DWORD num, size, type;
 
     r = MsiInstallProductA(msifile, NULL);
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-    }
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
-    todo_wine
-    {
-        ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
-        ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
-        ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
-        ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
-        ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
-        ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
-        ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
-        ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
-        ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
-        ok(delete_pf("msitest", FALSE), "File not installed\n");
-    }
+    ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
+    ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
+    ok(delete_pf("msitest", FALSE), "File not installed\n");
 
     res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
-    todo_wine
-    {
-        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
-    }
+    ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
 
     size = MAX_PATH;
     type = REG_SZ;
     res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
-    todo_wine
-    {
-        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
-        ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
-    }
+    ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
+    ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
 
     size = MAX_PATH;
     type = REG_SZ;
@@ -649,11 +631,8 @@ static void test_MsiInstallProduct(void)
     size = sizeof(num);
     type = REG_DWORD;
     res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
-    todo_wine
-    {
-        ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
-        ok(num == 314, "Expected 314, got %ld\n", num);
-    }
+    ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
+    ok(num == 314, "Expected 314, got %ld\n", num);
 
     RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
 }
@@ -683,10 +662,7 @@ static void test_MsiSetComponentState(vo
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
     r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-    }
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
 
     MsiCloseHandle(package);
     CoUninitialize();
@@ -710,38 +686,32 @@ static void test_packagecoltypes(void)
 
     query = "SELECT * FROM `Media`";
     r = MsiDatabaseOpenView( hdb, query, &view );
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
-    }
+    ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
 
     r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
     count = MsiRecordGetFieldCount( rec );
-    todo_wine
-    {
-        ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
-        ok(count == 6, "Expected 6, got %d\n", count);
-        ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
-        ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
-        ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
-        ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
-        ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
-        ok(check_record(rec, 6, "Source"), "wrong column label\n");
-    }
+    ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
+    ok(count == 6, "Expected 6, got %d\n", count);
+    ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
+    ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
+    ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
+    ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
+    ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
+    ok(check_record(rec, 6, "Source"), "wrong column label\n");
 
     r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
     count = MsiRecordGetFieldCount( rec );
+    ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
+    ok(count == 6, "Expected 6, got %d\n", count);
     todo_wine
     {
-        ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
-        ok(count == 6, "Expected 6, got %d\n", count);
         ok(check_record(rec, 1, "i2"), "wrong column label\n");
         ok(check_record(rec, 2, "i4"), "wrong column label\n");
         ok(check_record(rec, 3, "L64"), "wrong column label\n");
-        ok(check_record(rec, 4, "S255"), "wrong column label\n");
-        ok(check_record(rec, 5, "S32"), "wrong column label\n");
-        ok(check_record(rec, 6, "S72"), "wrong column label\n");
     }
+    ok(check_record(rec, 4, "S255"), "wrong column label\n");
+    ok(check_record(rec, 5, "S32"), "wrong column label\n");
+    ok(check_record(rec, 6, "S72"), "wrong column label\n");
 
     MsiCloseHandle(hdb);
     DeleteFile(msifile);
-- 
1.4.2.1


More information about the wine-patches mailing list