changeset 3137:98d994cfc408

Add msitools (and MSVC-specific patches)
author Michael Goffioul <michael.goffioul@gmail.com>
date Sat, 13 Jul 2013 23:52:36 -0400
parents 5481abb52912
children 4cc36e7d6ff5
files dist-files.mk index.html src/msitools.mk src/msvc-msitools-1.patch src/msvc-msitools-2-tests.patch
diffstat 5 files changed, 884 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Sat Jul 13 17:10:35 2013 -0400
+++ b/dist-files.mk	Sat Jul 13 23:52:36 2013 -0400
@@ -293,6 +293,8 @@
   msvc-libidn-1.patch \
   msvc-libssh2-1.patch \
   msvc-libxml2-1.patch \
+  msvc-msitools-1.patch \
+  msvc-msitools-2-tests.patch \
   msvc-nettle-1.patch \
   msvc-ncurses-1.patch \
   msvc-pstoedit-1.patch \
--- a/index.html	Sat Jul 13 17:10:35 2013 -0400
+++ b/index.html	Sat Jul 13 23:52:36 2013 -0400
@@ -1719,6 +1719,11 @@
         <td id="mpfr-website"><a href="http://www.mpfr.org/">mpfr</a></td>
     </tr>
     <tr>
+        <td id="msitools-package">msitools</td>
+        <td id="msitools-version">0.92</td>
+	<td id="msitools-website"><a href="https://wiki.gnome.org/msitools">msitools</a></td>
+    </tr>
+    <tr>
         <td id="msys-bash-package">msys-bash</td>
         <td id="msys-bash-version">3.1.17-4</td>
         <td id="msys-bash-website"><a href="http://www.mingw.org/">MinGW bash</a></td>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/msitools.mk	Sat Jul 13 23:52:36 2013 -0400
@@ -0,0 +1,41 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := msitools
+$(PKG)_IGNORE   :=
+$(PKG)_CHECKSUM := 695933981b679f71a5aed21d14d2fb54ae0e7102
+$(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
+$(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.xz
+$(PKG)_URL      := http://ftp.gnome.org/pub/gnome/sources/$(PKG)/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE)
+$(PKG)_DEPS     := gcab glib libgsf libxml2
+
+$(PKG)_PREFIX   := '$(HOST_PREFIX)'
+
+define $(PKG)_UPDATE
+    $(WGET) -q -O- 'http://git.gnome.org/browse/$(PKG)/refs/tags' | \
+    $(SED) -n "s,.*tag/?id=\([0-9]\+\.[0-9]*[02468]\.[^']*\).*,\1,p" | \
+    head -1
+endef
+
+ifeq ($(MXE_SYSTEM),msvc)
+    $(PKG)_CONFIGURE_EXTRA_OPTIONS := \
+        UUID_CFLAGS=-I. \
+        UUID_LIBS=-lrpcrt4 \
+        WIXL_CFLAGS="`PKG_CONFIG_PATH=$(HOST_LIBDIR)/pkgconfig $(MXE_PKG_CONFIG) --cflags gio-2.0 libgcab-1.0 libxml-2.0`" \
+        WIXL_LIBS="`PKG_CONFIG_PATH=$(HOST_LIBDIR)/pkgconfig $(MXE_PKG_CONFIG) --libs gio-2.0 libgcab-1.0 libxml-2.0` -lrpcrt4"
+    $(PKG)_PREFIX := $(shell cd $(HOST_PREFIX) && pwd -W)
+endif
+
+define $(PKG)_BUILD
+    cd '$(1)' && './configure' \
+        $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \
+        $(ENABLE_SHARED_OR_STATIC) \
+        --prefix='$($(PKG)_PREFIX)' \
+        PKG_CONFIG='$(MXE_PKG_CONFIG)' \
+        PKG_CONFIG_PATH='$(HOST_LIBDIR)/pkgconfig' \
+	$($(PKG)_CONFIGURE_EXTRA_OPTIONS) \
+        && $(CONFIGURE_POST_HOOK)
+
+    $(MAKE) -C '$(1)' -j '$(JOBS)' noinst_PROGRAMS=
+    $(MAKE) -C '$(1)' -j 1 install noinst_PROGRAMS=
+endef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/msvc-msitools-1.patch	Sat Jul 13 23:52:36 2013 -0400
@@ -0,0 +1,579 @@
+diff -urN msitools-0.92-orig/Makefile.in msitools-0.92/Makefile.in
+--- msitools-0.92-orig/Makefile.in	2013-03-07 15:27:29 -0500
++++ msitools-0.92/Makefile.in	2013-07-13 22:25:48 -0400
+@@ -552,7 +552,7 @@
+ 	$(NULL)
+ 
+ wixl_CPPFLAGS = \
+-	-include config.h			\
++	-FI$(top_srcdir)/config.h		\
+ 	-Iinclude				\
+ 	-I$(srcdir)/include			\
+ 	$(WIXL_CFLAGS)				\
+diff -urN msitools-0.92-orig/libmsi/insert.c msitools-0.92/libmsi/insert.c
+--- msitools-0.92-orig/libmsi/insert.c	2013-02-07 20:04:46 -0500
++++ msitools-0.92/libmsi/insert.c	2013-07-13 18:57:31 -0400
+@@ -65,7 +65,7 @@
+     {
+         if( !vl )
+         {
+-            TRACE("Not enough elements in the list to insert\n");
++            TRACE("Not enough elements in the list to insert\n", 0);
+             goto err;
+         }
+         switch( vl->val->type )
+diff -urN msitools-0.92-orig/libmsi/libmsi-database.c msitools-0.92/libmsi/libmsi-database.c
+--- msitools-0.92-orig/libmsi/libmsi-database.c	2013-02-19 17:24:53 -0500
++++ msitools-0.92/libmsi/libmsi-database.c	2013-07-13 19:03:52 -0400
+@@ -134,8 +134,10 @@
+ static void
+ libmsi_database_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ {
++    LibmsiDatabase *self;
++
+     g_return_if_fail (LIBMSI_IS_DATABASE (object));
+-    LibmsiDatabase *self = LIBMSI_DATABASE (object);
++    self = LIBMSI_DATABASE (object);
+ 
+     switch (prop_id) {
+     case PROP_PATH:
+@@ -158,8 +160,10 @@
+ static void
+ libmsi_database_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+ {
++    LibmsiDatabase *self;
++
+     g_return_if_fail (LIBMSI_IS_DATABASE (object));
+-    LibmsiDatabase *self = LIBMSI_DATABASE (object);
++    self = LIBMSI_DATABASE (object);
+ 
+     switch (prop_id) {
+     case PROP_PATH:
+@@ -1231,6 +1235,7 @@
+     count = libmsi_record_get_field_count (row);
+     for (i = start; i <= count; i++) {
+         char *str;
++        const char *sep;
+ 
+         _libmsi_record_get_gsf_input (row, i, &in);
+         if (in) {
+@@ -1252,7 +1257,7 @@
+ 
+         g_free (str);
+ 
+-        const char *sep = (i < count) ? "\t" : "\r\n";
++        sep = (i < count) ? "\t" : "\r\n";
+         if (write (fd, sep, strlen (sep)) != strlen (sep))
+             goto end;
+     }
+@@ -1354,6 +1359,8 @@
+     r = _libmsi_query_open( db, &view, query, table );
+     if (r == LIBMSI_RESULT_SUCCESS)
+     {
++        ExportRow export;
++
+         /* write out row 1, the column names */
+         r = _libmsi_query_get_column_info(view, LIBMSI_COL_INFO_NAMES, &rec);
+         if (r == LIBMSI_RESULT_SUCCESS)
+@@ -1380,11 +1387,9 @@
+         }
+ 
+         /* write out row 4 onwards, the data */
+-        ExportRow export = {
+-            .fd = fd,
+-            .table_dir = g_file_new_for_path (table),
+-            .error = error
+-        };
++        export.fd = fd;
++        export.table_dir = g_file_new_for_path (table);
++        export.error = error;
+         r = _libmsi_query_iterate_records( view, 0, msi_export_row, &export);
+ 
+         g_object_unref (export.table_dir);
+diff -urN msitools-0.92-orig/libmsi/libmsi-istream.c msitools-0.92/libmsi/libmsi-istream.c
+--- msitools-0.92-orig/libmsi/libmsi-istream.c	2013-02-06 18:00:31 -0500
++++ msitools-0.92/libmsi/libmsi-istream.c	2013-07-13 19:04:46 -0400
+@@ -146,9 +146,10 @@
+ libmsi_istream_new (GsfInput *input)
+ {
+     GsfInput *dup = gsf_input_dup (input, NULL);
++    LibmsiIStream *self;
+     g_return_val_if_fail (dup, NULL);
+ 
+-    LibmsiIStream *self = g_object_new (LIBMSI_TYPE_ISTREAM, NULL);
++    self = g_object_new (LIBMSI_TYPE_ISTREAM, NULL);
+     self->input = dup;
+ 
+     return self;
+diff -urN msitools-0.92-orig/libmsi/libmsi-query.c msitools-0.92/libmsi/libmsi-query.c
+--- msitools-0.92-orig/libmsi/libmsi-query.c	2013-02-11 13:33:02 -0500
++++ msitools-0.92/libmsi/libmsi-query.c	2013-07-13 19:05:38 -0400
+@@ -67,8 +67,10 @@
+ static void
+ libmsi_query_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ {
++    LibmsiQuery *self;
++
+     g_return_if_fail (LIBMSI_IS_QUERY (object));
+-    LibmsiQuery *self = LIBMSI_QUERY (object);
++    self = LIBMSI_QUERY (object);
+ 
+     switch (prop_id) {
+     case PROP_DATABASE:
+@@ -88,8 +90,10 @@
+ static void
+ libmsi_query_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+ {
++    LibmsiQuery *self;
++
+     g_return_if_fail (LIBMSI_IS_QUERY (object));
+-    LibmsiQuery *self = LIBMSI_QUERY (object);
++    self = LIBMSI_QUERY (object);
+ 
+     switch (prop_id) {
+     case PROP_DATABASE:
+diff -urN msitools-0.92-orig/libmsi/libmsi-record.c msitools-0.92/libmsi/libmsi-record.c
+--- msitools-0.92-orig/libmsi/libmsi-record.c	2013-02-07 20:04:17 -0500
++++ msitools-0.92/libmsi/libmsi-record.c	2013-07-13 19:07:00 -0400
+@@ -85,8 +85,10 @@
+ static void
+ libmsi_record_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ {
++    LibmsiRecord *self;
++
+     g_return_if_fail (LIBMSI_IS_RECORD (object));
+-    LibmsiRecord *self = LIBMSI_RECORD (object);
++    self = LIBMSI_RECORD (object);
+ 
+     switch (prop_id) {
+     case PROP_COUNT:
+@@ -101,8 +103,10 @@
+ static void
+ libmsi_record_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+ {
++    LibmsiRecord *self;
++
+     g_return_if_fail (LIBMSI_IS_RECORD (object));
+-    LibmsiRecord *self = LIBMSI_RECORD (object);
++    self = LIBMSI_RECORD (object);
+ 
+     switch (prop_id) {
+     case PROP_COUNT:
+@@ -601,6 +605,10 @@
+                           GInputStream *input, gsize count,
+                           GCancellable *cancellable, GError **error)
+ {
++    gsize bytes_read = 0;
++    GsfInput *stm = NULL;
++    guint8 *data;
++
+     g_return_val_if_fail (LIBMSI_IS_RECORD (rec), FALSE);
+     g_return_val_if_fail (G_IS_INPUT_STREAM (input), FALSE);
+     g_return_val_if_fail (field > 0 && field <= rec->count, FALSE);
+@@ -608,9 +616,7 @@
+     g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
+     g_return_val_if_fail (!error || *error == NULL, FALSE);
+ 
+-    gsize bytes_read = 0;
+-    GsfInput *stm = NULL;
+-    guint8 *data = g_malloc (count);
++    data = g_malloc (count);
+ 
+     if (!g_input_stream_read_all (input, data, count, &bytes_read,
+                                   cancellable, error) ||
+diff -urN msitools-0.92-orig/libmsi/libmsi-summary-info.c msitools-0.92/libmsi/libmsi-summary-info.c
+--- msitools-0.92-orig/libmsi/libmsi-summary-info.c	2013-02-07 20:17:23 -0500
++++ msitools-0.92/libmsi/libmsi-summary-info.c	2013-07-13 19:18:27 -0400
+@@ -76,8 +76,10 @@
+ static void
+ summary_info_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ {
++    LibmsiSummaryInfo *self;
++
+     g_return_if_fail (LIBMSI_IS_SUMMARY_INFO (object));
+-    LibmsiSummaryInfo *self = LIBMSI_SUMMARY_INFO (object);
++    self = LIBMSI_SUMMARY_INFO (object);
+ 
+     switch (prop_id) {
+     case PROP_DATABASE:
+@@ -96,8 +98,10 @@
+ static void
+ summary_info_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+ {
++    LibmsiSummaryInfo *self;
++
+     g_return_if_fail (LIBMSI_IS_SUMMARY_INFO (object));
+-    LibmsiSummaryInfo *self = LIBMSI_SUMMARY_INFO (object);
++    self = LIBMSI_SUMMARY_INFO (object);
+ 
+     switch (prop_id) {
+     case PROP_DATABASE:
+@@ -244,19 +248,19 @@
+ 
+ static gchar* filetime_to_string (guint64 ft)
+ {
+-    struct tm tm;
++    struct tm *tm;
+     time_t t;
+ 
+     ft /= 10000000ULL;
+     ft -= 134774ULL * 86400ULL;
+     t = ft;
+ 
+-    if (!gmtime_r (&t, &tm))
++    if (!(tm = gmtime (&t)))
+         return NULL;
+ 
+     return g_strdup_printf ("%d/%d/%d %d:%d:%d",
+-                            tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+-                            tm.tm_hour, tm.tm_min, tm.tm_sec);
++                            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
++                            tm->tm_hour, tm->tm_min, tm->tm_sec);
+ }
+ 
+ static void parse_filetime( const char *str, guint64 *ft )
+diff -urN msitools-0.92-orig/libmsi/string.c msitools-0.92/libmsi/string.c
+--- msitools-0.92-orig/libmsi/string.c	2013-02-07 20:07:52 -0500
++++ msitools-0.92/libmsi/string.c	2013-07-13 19:11:26 -0400
+@@ -562,7 +562,7 @@
+     char *data = NULL;
+     uint8_t *pool = NULL;
+ 
+-    TRACE("\n");
++    TRACE("\n", 0);
+ 
+     /* construct the new table in memory first */
+     string_totalsize( st, &datasize, &poolsize );
+diff -urN msitools-0.92-orig/libmsi/table.c msitools-0.92/libmsi/table.c
+--- msitools-0.92-orig/libmsi/table.c	2013-02-19 17:24:53 -0500
++++ msitools-0.92/libmsi/table.c	2013-07-13 20:00:12 -0400
+@@ -27,6 +27,10 @@
+ 
+ #include "debug.h"
+ 
++#ifdef _MSC_VER
++#include <intrin.h>
++#endif
++
+ 
+ #define LibmsiTable_HASH_TABLE_SIZE 37
+ 
+@@ -263,7 +267,7 @@
+     msi_free(encname);
+     if( !stm )
+     {
+-        TRACE("open stream failed - empty table?\n");
++        TRACE("open stream failed - empty table?\n", 0);
+         return ret;
+     }
+ 
+@@ -1527,7 +1531,7 @@
+             continue;
+ 
+         if ( MSITYPE_IS_BINARY(tv->columns[i].type) )
+-            TRACE("skipping binary column\n");
++            TRACE("skipping binary column\n", 0);
+         else if ( tv->columns[i].type & MSITYPE_STRING )
+         {
+             const char *str;
+@@ -1792,10 +1796,18 @@
+     for (i = 0; i < tv->table->col_count; i++)
+     {
+         if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
++#ifdef _MSC_VER
++            _InterlockedIncrement((long*)(&tv->table->colinfo[i].ref_count));
++#else
+             __sync_add_and_fetch(&tv->table->colinfo[i].ref_count, 1);
++#endif
+     }
+ 
++#ifdef _MSC_VER
++    return _InterlockedIncrement((long*)(&tv->table->ref_count));
++#else
+     return __sync_add_and_fetch(&tv->table->ref_count, 1);
++#endif
+ }
+ 
+ static unsigned table_view_remove_column(LibmsiView *view, const char *table, unsigned number)
+@@ -1844,7 +1856,11 @@
+     {
+         if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY)
+         {
++#ifdef _MSC_VER
++            ref = _InterlockedDecrement((long*)(&tv->table->colinfo[i].ref_count));
++#else
+             ref = __sync_sub_and_fetch(&tv->table->colinfo[i].ref_count, 1);
++#endif
+             if (ref == 0)
+             {
+                 r = table_view_remove_column(view, tv->table->colinfo[i].tablename,
+@@ -1855,7 +1871,11 @@
+         }
+     }
+ 
++#ifdef _MSC_VER
++    ref = _InterlockedDecrement((long*)(&tv->table->ref_count));
++#else
+     ref = __sync_sub_and_fetch(&tv->table->ref_count, 1);
++#endif
+     if (ref == 0)
+     {
+         if (!tv->table->row_count)
+@@ -1900,7 +1920,11 @@
+     {
+         if (!strcmp( msitable->colinfo[i].colname, column ))
+         {
++#ifdef _MSC_VER
++            _InterlockedIncrement((long*)(&msitable->colinfo[i].ref_count));
++#else
+             __sync_add_and_fetch(&msitable->colinfo[i].ref_count, 1);
++#endif
+             break;
+         }
+     }
+@@ -2157,7 +2181,7 @@
+     if( !rec )
+         return rec;
+ 
+-    TRACE("row ->\n");
++    TRACE("row ->\n", 0);
+     for( i=0; i<tv->num_cols; i++ )
+     {
+         if ( (mask&1) && (i>=(mask>>8)) )
+@@ -2236,7 +2260,7 @@
+         const char *sval;
+ 
+         if( libmsi_record_is_null( rec, i ) )
+-            TRACE("row -> []\n");
++            TRACE("row -> []\n", 0);
+         else if( (sval = _libmsi_record_get_string_raw( rec, i )) )
+             TRACE("row -> [%s]\n", debugstr_a(sval));
+         else
+@@ -2511,7 +2535,7 @@
+             }
+             else
+             {
+-                TRACE("inserting row\n");
++                TRACE("inserting row\n", 0);
+                 r = table_view_insert_row( &tv->view, rec, -1, false );
+                 if (r != LIBMSI_RESULT_SUCCESS)
+                     g_warning("failed to insert row %u\n", r);
+diff -urN msitools-0.92-orig/tools/msibuild.c msitools-0.92/tools/msibuild.c
+--- msitools-0.92-orig/tools/msibuild.c	2013-02-07 19:48:42 -0500
++++ msitools-0.92/tools/msibuild.c	2013-07-13 21:38:48 -0400
+@@ -26,7 +26,11 @@
+ #include <sys/stat.h>
+ #include <libmsi.h>
+ #include <limits.h>
++#ifdef _MSC_VER
++#include <uuid-win32.h>
++#else
+ #include <uuid.h>
++#endif
+ 
+ #include "sqldelim.h"
+ 
+diff -urN msitools-0.92-orig/tools/msiinfo.c msitools-0.92/tools/msiinfo.c
+--- msitools-0.92-orig/tools/msiinfo.c	2013-02-07 19:58:42 -0500
++++ msitools-0.92/tools/msiinfo.c	2013-07-13 22:08:12 -0400
+@@ -34,6 +34,15 @@
+ #include <fcntl.h>
+ #include <limits.h>
+ 
++#ifdef _MSC_VER
++#  ifndef ssize_t
++     typedef int ssize_t;
++#  endif
++#  ifndef STDOUT_FILENO
++#    define STDOUT_FILENO 1
++#  endif
++#endif
++
+ struct Command {
+     const char *cmd;
+     const char *desc;
+@@ -43,7 +52,7 @@
+     int (*func)(struct Command *cmd, int argc, char **argv, GError **error);
+ };
+ 
+-static struct Command cmds[];
++static struct Command *cmds;
+ 
+ static void usage(FILE *out)
+ {
+@@ -690,67 +699,97 @@
+     return 0;
+ }
+ 
+-static struct Command cmds[] = {
++static struct Command _cmds[] = {
+     {
+-        .cmd = "help",
+-        .opts = "[SUBCOMMAND]",
+-        .desc = "Show program or subcommand usage",
+-        .func = cmd_help,
++        "help",
++        "Show program or subcommand usage",
++        0,
++        "[SUBCOMMAND]",
++        0,
++        cmd_help
+     },
+     {
+-        .cmd = "streams",
+-        .opts = "FILE",
+-        .desc = "List streams in a .msi file",
+-        .func = cmd_streams,
++        "streams",
++        "List streams in a .msi file",
++        0,
++        "FILE",
++        0,
++        cmd_streams
+     },
+     {
+-        .cmd = "tables",
+-        .opts = "FILE",
+-        .desc = "List tables in a .msi file",
+-        .func = cmd_tables,
++        "tables",
++        "List tables in a .msi file",
++        0,
++        "FILE",
++        0,
++        cmd_tables
+     },
+     {
+-        .cmd = "extract",
+-        .opts = "FILE STREAM",
+-        .desc = "Extract a binary stream from an .msi file",
+-        .func = cmd_extract,
++        "extract",
++        "Extract a binary stream from an .msi file",
++        0,
++        "FILE STREAM",
++        0,
++        cmd_extract
+     },
+     {
+-        .cmd = "export",
+-        .opts = "[-s] FILE TABLE\n\nOptions:\n"
+-                "  -s                Format output as an SQL query",
+-        .desc = "Export a table in text form from an .msi file",
+-        .func = cmd_export,
++        "export",
++        "Export a table in text form from an .msi file",
++        0,
++        "[-s] FILE TABLE\n\nOptions:\n"
++        "  -s                Format output as an SQL query",
++        0,
++        cmd_export
+     },
+     {
+-        .cmd = "suminfo",
+-        .opts = "FILE",
+-        .desc = "Print summary information",
+-        .func = cmd_suminfo,
++        "suminfo",
++        "Print summary information",
++        0,
++        "FILE",
++        0,
++        cmd_suminfo
+     },
+     {
+-        .cmd = "-h",
+-        .func = cmd_help,
++        "-h",
++        0,
++        0,
++        0,
++        0,
++        cmd_help
+     },
+     {
+-        .cmd = "--help",
+-        .func = cmd_help,
++        "--help",
++        0,
++        0,
++        0,
++        0,
++        cmd_help
+     },
+     {
+-        .cmd = "-v",
+-        .func = cmd_version
++        "-v",
++        0,
++        0,
++        0,
++        0,
++        cmd_version
+     },
+     {
+-        .cmd = "--version",
+-        .func = cmd_version
++        "--version",
++        0,
++        0,
++        0,
++        0,
++        cmd_version
+     },
+     { NULL },
+ };
++static struct Command *cmds = _cmds;
+ 
+ int main(int argc, char **argv)
+ {
+     GError *error = NULL;
+     struct Command *cmd = NULL;
++    int result;
+ 
+ #if !GLIB_CHECK_VERSION(2,35,1)
+     g_type_init ();
+@@ -767,7 +806,7 @@
+         usage(stderr);
+     }
+ 
+-    int result = cmd->func(cmd, argc - 1, argv + 1, &error);
++    result = cmd->func(cmd, argc - 1, argv + 1, &error);
+     if (error != NULL) {
+         g_printerr("error: %s\n", error->message);
+         print_libmsi_error(error->code);
+diff -urN msitools-0.92-orig/tools/wixl/util.c msitools-0.92/tools/wixl/util.c
+--- msitools-0.92-orig/tools/wixl/util.c	2013-03-07 15:28:12 -0500
++++ msitools-0.92/tools/wixl/util.c	2013-07-13 22:33:52 -0400
+@@ -82,6 +82,9 @@
+ static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+ static gint _vala_array_length (gpointer array);
+ 
++#ifdef _MSC_VER
++#  include <uuid-win32.h>
++#endif
+ 
+ GQuark wixl_error_quark (void) {
+ 	return g_quark_from_static_string ("wixl_error-quark");
+diff -urN msitools-0.92-orig/uuid-win32.h msitools-0.92/uuid-win32.h
+--- msitools-0.92-orig/uuid-win32.h	1969-12-31 19:00:00 -0500
++++ msitools-0.92/uuid-win32.h	2013-07-13 22:50:42 -0400
+@@ -0,0 +1,18 @@
++#ifndef __UUID_WIN32_H__
++#define __UUID_WIN32_H__
++
++#include <rpc.h>
++
++typedef UUID uuid_t;
++
++#define uuid_generate(uu) UuidCreate(&(uu))
++#define uuid_unparse(uu,str) \
++        do { \
++                RPC_CSTR __buf__; \
++                UuidToString(&(uu), &__buf__); \
++                strcpy(str, __buf__); \
++                RpcStringFree(&__buf__); \
++        } while (0)
++#define uuid_unparse_upper uuid_unparse
++
++#endif /* __UUID_WIN32_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/msvc-msitools-2-tests.patch	Sat Jul 13 23:52:36 2013 -0400
@@ -0,0 +1,257 @@
+diff -urN msitools-0.92-orig/tests/testdatabase.c msitools-0.92/tests/testdatabase.c
+--- msitools-0.92-orig/tests/testdatabase.c	2013-02-06 17:43:05 -0500
++++ msitools-0.92/tests/testdatabase.c	2013-07-13 21:01:19 -0400
+@@ -44,6 +44,10 @@
+ #define O_BINARY 0
+ #endif
+ 
++#ifndef F_OK
++#define F_OK 0
++#endif
++
+ static const char *msifile = "winetest-db.msi";
+ static const char *msifile2 = "winetst2-db.msi";
+ static const char *mstfile = "winetst-db.mst";
+@@ -2484,6 +2488,7 @@
+ static void test_try_transform(void)
+ {
+ #ifdef _WIN32
++    GInputStream *in;
+     LibmsiDatabase *hdb;
+     LibmsiQuery *hquery;
+     LibmsiRecord *hrec;
+@@ -2581,7 +2586,7 @@
+     sql = "select * from `MOO` where `NOO` = 3";
+     r = do_query(hdb, sql, &hrec);
+     ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
+-    ok(hrec == NULL);
++    ok(hrec == NULL, "");
+ 
+     /* check added stream */
+     hrec = 0;
+@@ -2590,7 +2595,7 @@
+     ok(r == LIBMSI_RESULT_SUCCESS, "select query failed\n");
+ 
+     /* check the contents of the stream */
+-    in = libmsi_record_get_stream(rec, 1);
++    in = libmsi_record_get_stream(hrec, 1);
+     ok(in, "Failed to get stream\n");
+     sz = g_input_stream_read(in, buffer, sizeof(buffer), NULL, NULL);
+     ok(!memcmp(buffer, "naengmyon", 9), "stream data was wrong\n");
+@@ -2607,7 +2612,7 @@
+     r = libmsi_query_execute(hquery, 0, NULL);
+     ok(r, "query execute failed\n");
+ 
+-    hrec = libmsi_query_fetch(query, NULL);
++    hrec = libmsi_query_fetch(hquery, NULL);
+     ok(hrec, "Expected result\n");
+ 
+     r = libmsi_record_get_int(hrec, 1);
+@@ -2623,7 +2628,7 @@
+ 
+     g_object_unref(hrec);
+ 
+-    hrec = libmsi_query_fetch(query, NULL);
++    hrec = libmsi_query_fetch(hquery, NULL);
+     ok(hrec, "Expected result\n");
+ 
+     r = libmsi_record_get_int(hrec, 1);
+@@ -4863,7 +4868,7 @@
+     hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
+     ok(hdb, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ 
+-    r = libmsi_database_commit(hdb);
++    r = libmsi_database_commit(hdb, NULL);
+     ok(r == LIBMSI_RESULT_SUCCESS, "Expected LIBMSI_RESULT_SUCCESS, got %d\n", r);
+ 
+     g_object_unref(hdb);
+@@ -5756,6 +5761,7 @@
+ static void test_storages_table(void)
+ {
+ #ifdef _WIN32
++    GInputStream *in;
+     LibmsiDatabase *hdb;
+     LibmsiQuery *hquery;
+     LibmsiRecord *hrec;
+diff -urN msitools-0.92-orig/tests/testsuminfo.c msitools-0.92/tests/testsuminfo.c
+--- msitools-0.92-orig/tests/testsuminfo.c	2013-01-21 11:16:41 -0500
++++ msitools-0.92/tests/testsuminfo.c	2013-07-13 21:17:52 -0400
+@@ -48,7 +48,7 @@
+     DeleteFile(msifile);
+ 
+     /* just libmsi_database_new should not create a file */
+-    hdb = libmsi_database_new(msifile, LIBMSI_DB_OPEN_CREATE, NULL);
++    hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_CREATE, NULL, NULL);
+     ok(hdb, "libmsi_database_new failed\n");
+ 
+     hsuminfo = libmsi_summary_info_new(hdb, 0, NULL);
+@@ -70,11 +70,11 @@
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_TITLE, "Mike", &error);
+     ok(error, "libmsi_summary_info_set_property wrong error\n");
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_CODEPAGE, 1, &error);
+     ok(error, "libmsi_summary_info_set_property wrong error\n");
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     g_object_unref(hsuminfo);
+ 
+@@ -84,50 +84,50 @@
+ 
+     libmsi_summary_info_set_string(hsuminfo, 0, NULL, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_CODEPAGE, NULL, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_TITLE, NULL, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_AUTHOR, 0, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_KEYWORDS, 0, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_filetime(hsuminfo, LIBMSI_PROPERTY_COMMENTS, 0, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_TEMPLATE, 0, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_LASTAUTHOR, NULL, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_INVALID_PARAMETER);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_int(hsuminfo, LIBMSI_PROPERTY_UUID, 0, &error);
+     g_assert_error(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_VERSION, NULL, &error);
+     g_assert(error, LIBMSI_RESULT_ERROR, LIBMSI_RESULT_DATATYPE_MISMATCH);
+-    g_clear_error(error);
++    g_clear_error(&error);
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_TITLE, "Mike", &error);
+     ok(!error, "libmsi_summary_info_set_property failed\n");
+ 
+     str = libmsi_summary_info_get_string(hsuminfo, LIBMSI_PROPERTY_TITLE, &error);
+     ok(!error, "got error");
+-    ok(!strcpy(str, "Mike"));
++    ok(!strcpy(str, "Mike"), "");
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_TITLE, "JungAh", &error);
+     ok(!error, "libmsi_summary_info_set_property failed\n");
+@@ -135,7 +135,7 @@
+     g_object_unref(hsuminfo);
+ 
+     /* try again with a higher update count */
+-    hsuminfo = libmsi_summary_info_new(hdb, 10, NULl);
++    hsuminfo = libmsi_summary_info_new(hdb, 10, NULL);
+     ok(hsuminfo, "libmsi_database_get_summary_info failed\n");
+ 
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_TITLE, "JungAh", &error);
+@@ -154,26 +154,26 @@
+     libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_AUTHOR, "Mike", &error);
+     ok(!error, "libmsi_summary_info_set_property failed\n");
+ 
+-    r = libmsi_summary_info_persist(hsuminfo);
++    r = libmsi_summary_info_persist(hsuminfo, NULL);
+     ok(r, "libmsi_summary_info_persist failed\n");
+ 
+-    libmsi_database_commit(hdb);
++    libmsi_database_commit(hdb, NULL);
+ 
+     g_object_unref(hsuminfo);
+ 
+     g_object_unref(hdb);
+ 
+     /* reread, non-zero update count */
+-    hdb = libmsi_database_new(msifile, LIBMSI_DB_OPEN_TRANSACT, NULL);
++    hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_TRANSACT, NULL, NULL);
+     ok(hdb, "libmsi_database_new failed\n");
+ 
+-    hsuminfo = libmsi_summary_info_new(hdb, 1, NULl);
++    hsuminfo = libmsi_summary_info_new(hdb, 1, NULL);
+     ok(hsuminfo, "libmsi_database_get_summary_info failed\n");
+ 
+     r = libmsi_summary_info_set_string(hsuminfo, LIBMSI_PROPERTY_AUTHOR, "Mike", error);
+     ok(r == LIBMSI_RESULT_SUCCESS, "libmsi_summary_info_set_property wrong error\n");
+ 
+-    r = libmsi_summary_info_persist(hsuminfo);
++    r = libmsi_summary_info_persist(hsuminfo, NULL);
+     ok(r, "libmsi_summary_info_persist failed %u\n", r);
+ 
+     g_object_unref(hsuminfo);
+@@ -181,7 +181,7 @@
+     /* now with zero update count */
+     g_object_unref(hdb);
+ 
+-    hdb = libmsi_database_new(msifile, LIBMSI_DB_OPEN_READONLY, NULL);
++    hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_READONLY, NULL, NULL);
+     ok(hdb, "libmsi_database_new failed\n");
+ 
+     hsuminfo = libmsi_summary_info_new(hdb, 0, NULL);
+@@ -191,7 +191,7 @@
+     todo_wine ok(error, "libmsi_summary_info_set_property wrong error\n");
+     g_clear_error(&error);
+ 
+-    r = libmsi_summary_info_persist(hsuminfo);
++    r = libmsi_summary_info_persist(hsuminfo, NULL);
+     ok(!r, "libmsi_summary_info_persist wrong error %u\n", r);
+ 
+     g_object_unref(hsuminfo);
+@@ -317,6 +317,7 @@
+ 
+ static void test_summary_binary(void)
+ {
++    GArray *props = NULL;
+     GError *error = NULL;
+     LibmsiDatabase *hdb = 0;
+     LibmsiSummaryInfo *hsuminfo = 0;
+@@ -331,7 +332,7 @@
+     ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes(msifile), "file doesn't exist!\n");
+ 
+     /* just libmsi_database_new should not create a file */
+-    hdb = libmsi_database_new(msifile, LIBMSI_DB_OPEN_READONLY, NULl);
++    hdb = libmsi_database_new(msifile, LIBMSI_DB_FLAGS_READONLY, NULL, NULL);
+     ok(hdb, "libmsi_database_new failed\n");
+ 
+     hsuminfo = libmsi_summary_info_new(hdb, 0, NULL);
+@@ -344,7 +345,7 @@
+      * We can still read its type though...?
+      */
+     str = libmsi_summary_info_get_string(hsuminfo, LIBMSI_PROPERTY_LASTPRINTED, error);
+-    ok(!error);
++    ok(!error, "");
+     ok(!strcmp(str, "") || !strcmp(str, "7"),
+         "Expected empty string or \"7\", got \"%s\"\n", str);
+ 
+@@ -362,7 +363,7 @@
+     ok(error, "libmsi_summary_info_set_property failed\n");
+     g_clear_error(&error);
+ 
+-    r = libmsi_summary_info_persist( hsuminfo );
++    r = libmsi_summary_info_persist( hsuminfo, NULL );
+     ok(!r, "libmsi_summary_info_persist failed %u\n", r);
+ 
+     g_object_unref( hsuminfo );