summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/debug.h78
-rw-r--r--include/libmsi-database.h36
-rw-r--r--include/libmsi-query.h30
-rw-r--r--include/libmsi-record.h37
-rw-r--r--include/libmsi-summary-info.h30
-rw-r--r--include/libmsi-types.h153
-rw-r--r--include/libmsi.h198
-rw-r--r--libmsi/Makefile.am8
-rw-r--r--libmsi/alter.c2
-rw-r--r--libmsi/create.c2
-rw-r--r--libmsi/delete.c2
-rw-r--r--libmsi/distinct.c8
-rw-r--r--libmsi/drop.c2
-rw-r--r--libmsi/insert.c2
-rw-r--r--libmsi/libmsi-database.c (renamed from libmsi/database.c)6
-rw-r--r--libmsi/libmsi-query.c (renamed from libmsi/msiquery.c)0
-rw-r--r--libmsi/libmsi-record.c (renamed from libmsi/record.c)2
-rw-r--r--libmsi/libmsi-summary-info.c (renamed from libmsi/suminfo.c)16
-rw-r--r--libmsi/msipriv.h32
-rw-r--r--libmsi/select.c2
-rw-r--r--libmsi/sql-parser.y2
-rw-r--r--libmsi/storages.c2
-rw-r--r--libmsi/streams.c2
-rw-r--r--libmsi/table.c10
-rw-r--r--libmsi/update.c2
-rw-r--r--libmsi/where.c8
-rw-r--r--tests/Makefile.am2
-rw-r--r--tools/msiinfo.c2
28 files changed, 363 insertions, 313 deletions
diff --git a/include/debug.h b/include/debug.h
index c3bc2be..a4393c1 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -22,15 +22,11 @@
#define __WINE_WINE_DEBUG_H
#include <stdarg.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <windef.h>
-#include <winbase.h>
-#include <winnls.h>
-#ifndef GUID_DEFINED
-#include <guiddef.h>
-#endif
+#include <glib.h>
#ifdef __cplusplus
extern "C" {
@@ -62,23 +58,6 @@ static inline const char *wine_dbgstr_an( const char * s, int n )
if (!s) return "";
return s;
}
-static inline const char *wine_dbgstr_wn( const WCHAR *s, int n )
-{
- static char *p_ret[10];
- static int i;
-
- char *ret;
- unsigned len;
-
- if (!s) return "";
- i = (i + 1) % 10;
- ret = p_ret[i];
- len = WideCharToMultiByte( CP_ACP, 0, s, -1, NULL, 0, NULL, NULL);
- ret = realloc( ret, len );
- if (ret)
- WideCharToMultiByte( CP_ACP, 0, s, -1, ret, len, NULL, NULL );
- return ret;
-}
static inline const char *wine_dbg_sprintf( const char *format, ...)
{
@@ -90,17 +69,15 @@ static inline const char *wine_dbg_sprintf( const char *format, ...)
va_list ap;
va_start(ap, format);
- len = _vscprintf(format, ap);
+ ret = g_strdup_vprintf(format, ap);
+ len = strlen(ret);
va_end(ap);
i = (i + 1) % 10;
- ret = p_ret[i];
- ret = realloc(ret, len + 1);
-
- va_start(ap, format);
- vsprintf(ret, format, ap);
- va_end(ap);
- return ret;
+ p_ret[i] = realloc(p_ret[i], len + 1);
+ strcpy(p_ret[i], ret);
+ g_free(ret);
+ return p_ret[i];
}
#define wine_dbg_printf(format,...) (printf(format, ## __VA_ARGS__), fflush(stdout))
@@ -112,38 +89,11 @@ static inline const char *wine_dbgstr_a( const char *s )
return wine_dbgstr_an( s, -1 );
}
-static inline const char *wine_dbgstr_w( const WCHAR *s )
-{
- return wine_dbgstr_wn( s, -1 );
-}
-
-static inline const char *wine_dbgstr_guid( const GUID *id )
-{
- if (!id) return "(null)";
- if (!((uintptr_t)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(uintptr_t)id );
- return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- id->Data1, id->Data2, id->Data3,
- id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
- id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
-}
-
-static inline const char *wine_dbgstr_point( const POINT *pt )
-{
- if (!pt) return "(null)";
- return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
-}
-
-static inline const char *wine_dbgstr_size( const SIZE *size )
-{
- if (!size) return "(null)";
- return wine_dbg_sprintf( "(%d,%d)", size->cx, size->cy );
-}
-
-static inline const char *wine_dbgstr_rect( const RECT *rect )
+static inline const char *wine_dbgstr_guid( const uint8_t *id )
{
- if (!rect) return "(null)";
- return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
- rect->right, rect->bottom );
+ return wine_dbg_sprintf( "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7],
+ id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]);
}
static inline const char *wine_dbgstr_longlong( unsigned long long ll )
@@ -156,10 +106,8 @@ static inline const char *wine_dbgstr_longlong( unsigned long long ll )
/* Wine uses shorter names that are very likely to conflict with other software */
static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
-static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
-static inline const char *debugstr_guid( const GUID *id ) { return wine_dbgstr_guid( id ); }
+static inline const char *debugstr_guid( const uint8_t *id ) { return wine_dbgstr_guid( id ); }
static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
-static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
#define TRACE(fmt, ...) (void)0 // WINE_DPRINTF(TRACE, __func__, fmt, ## __VA_ARGS__)
diff --git a/include/libmsi-database.h b/include/libmsi-database.h
new file mode 100644
index 0000000..a8199ab
--- /dev/null
+++ b/include/libmsi-database.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2002,2003 Mike McCormack
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _LIBMSI_DATABASE_H
+#define _LIBMSI_DATABASE_H
+
+#include "libmsi-types.h"
+
+LibmsiResult libmsi_database_open (const char *, const char *, LibmsiDatabase **);
+LibmsiResult libmsi_database_open_query (LibmsiDatabase *,const char *,LibmsiQuery **);
+LibmsiDBState libmsi_database_get_state (LibmsiDatabase *);
+LibmsiResult libmsi_database_get_primary_keys (LibmsiDatabase *,const char *,LibmsiRecord **);
+LibmsiResult libmsi_database_apply_transform (LibmsiDatabase *,const char *,int);
+LibmsiResult libmsi_database_export (LibmsiDatabase *, const char *, int fd);
+LibmsiResult libmsi_database_import (LibmsiDatabase *, const char *, const char *);
+LibmsiCondition libmsi_database_is_table_persistent (LibmsiDatabase *, const char *);
+LibmsiResult libmsi_database_merge (LibmsiDatabase *, LibmsiDatabase *, const char *);
+LibmsiResult libmsi_database_get_summary_info (LibmsiDatabase *, unsigned, LibmsiSummaryInfo **);
+LibmsiResult libmsi_database_commit (LibmsiDatabase *);
+
+#endif /* _LIBMSI_DATABASE_H */
diff --git a/include/libmsi-query.h b/include/libmsi-query.h
new file mode 100644
index 0000000..e473769
--- /dev/null
+++ b/include/libmsi-query.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2002,2003 Mike McCormack
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _LIBMSI_QUERY_H
+#define _LIBMSI_QUERY_H
+
+#include "libmsi-types.h"
+
+LibmsiResult libmsi_query_fetch (LibmsiQuery *,LibmsiRecord **);
+LibmsiResult libmsi_query_execute (LibmsiQuery *,LibmsiRecord *);
+LibmsiResult libmsi_query_close (LibmsiQuery *);
+LibmsiDBError libmsi_query_get_error (LibmsiQuery *,char *,unsigned *);
+LibmsiResult libmsi_query_get_column_info (LibmsiQuery *, LibmsiColInfo, LibmsiRecord **);
+
+#endif /* _LIBMSI_QUERY_H */
diff --git a/include/libmsi-record.h b/include/libmsi-record.h
new file mode 100644
index 0000000..c59a043
--- /dev/null
+++ b/include/libmsi-record.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2002,2003 Mike McCormack
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _LIBMSI_RECORD_H
+#define _LIBMSI_RECORD_H
+
+#include "libmsi-types.h"
+
+LibmsiRecord * libmsi_record_create (guint count);
+LibmsiResult libmsi_record_clear_data (LibmsiRecord *);
+LibmsiResult libmsi_record_set_int (LibmsiRecord *,unsigned,int);
+LibmsiResult libmsi_record_set_string (LibmsiRecord *,unsigned,const char *);
+LibmsiResult libmsi_record_get_string (const LibmsiRecord *,unsigned,char *,unsigned *);
+unsigned libmsi_record_get_field_count (const LibmsiRecord *);
+int libmsi_record_get_integer (const LibmsiRecord *,unsigned);
+unsigned libmsi_record_get_field_size (const LibmsiRecord *,unsigned);
+gboolean libmsi_record_is_null (const LibmsiRecord *,unsigned);
+
+LibmsiResult libmsi_record_load_stream (LibmsiRecord *,unsigned,const char *);
+LibmsiResult libmsi_record_save_stream (LibmsiRecord *,unsigned,char*,unsigned *);
+
+#endif /* _LIBMSI_RECORD_H */
diff --git a/include/libmsi-summary-info.h b/include/libmsi-summary-info.h
new file mode 100644
index 0000000..41036a0
--- /dev/null
+++ b/include/libmsi-summary-info.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2002,2003 Mike McCormack
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _LIBMSI_SUMMARY_INFO_H
+#define _LIBMSI_SUMMARY_INFO_H
+
+#include "libmsi-types.h"
+
+LibmsiSummaryInfo * libmsi_summary_info_new (LibmsiDatabase *database, unsigned update_count, GError **error);
+LibmsiResult libmsi_summary_info_get_property (LibmsiSummaryInfo *, LibmsiPropertyType,unsigned *,int *,guint64*,char *,unsigned *);
+LibmsiResult libmsi_summary_info_set_property (LibmsiSummaryInfo *, LibmsiPropertyType, unsigned, int, guint64*, const char *);
+LibmsiResult libmsi_summary_info_persist (LibmsiSummaryInfo *);
+LibmsiResult libmsi_summary_info_get_property_count (LibmsiSummaryInfo *,unsigned *);
+
+#endif /* _LIBMSI_SUMMARY_INFO_H */
diff --git a/include/libmsi-types.h b/include/libmsi-types.h
new file mode 100644
index 0000000..71f01e7
--- /dev/null
+++ b/include/libmsi-types.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2002,2003 Mike McCormack
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _LIBMSI_TYPES_H
+#define _LIBMSI_TYPES_H
+
+#include <glib.h>
+
+typedef struct _LibmsiDatabase LibmsiDatabase;
+typedef struct _LibmsiQuery LibmsiQuery;
+typedef struct _LibmsiRecord LibmsiRecord;
+typedef struct _LibmsiSummaryInfo LibmsiSummaryInfo;
+
+typedef enum LibmsiCondition
+{
+ LIBMSI_CONDITION_FALSE = 0,
+ LIBMSI_CONDITION_TRUE = 1,
+ LIBMSI_CONDITION_NONE = 2,
+ LIBMSI_CONDITION_ERROR = 3,
+} LibmsiCondition;
+
+typedef enum LibmsiResult
+{
+ LIBMSI_RESULT_SUCCESS = 0,
+ LIBMSI_RESULT_ACCESS_DENIED = 5,
+ LIBMSI_RESULT_INVALID_HANDLE = 6,
+ LIBMSI_RESULT_NOT_ENOUGH_MEMORY = 8,
+ LIBMSI_RESULT_INVALID_DATA = 13,
+ LIBMSI_RESULT_OUTOFMEMORY = 14,
+ LIBMSI_RESULT_INVALID_PARAMETER = 87,
+ LIBMSI_RESULT_OPEN_FAILED = 110,
+ LIBMSI_RESULT_CALL_NOT_IMPLEMENTED = 120,
+ LIBMSI_RESULT_MORE_DATA = 234,
+ LIBMSI_RESULT_NO_MORE_ITEMS = 259,
+ LIBMSI_RESULT_NOT_FOUND = 1168,
+ LIBMSI_RESULT_CONTINUE = 1246,
+ LIBMSI_RESULT_UNKNOWN_PROPERTY = 1608,
+ LIBMSI_RESULT_BAD_QUERY_SYNTAX = 1615,
+ LIBMSI_RESULT_INVALID_FIELD = 1616,
+ LIBMSI_RESULT_FUNCTION_FAILED = 1627,
+ LIBMSI_RESULT_INVALID_TABLE = 1628,
+ LIBMSI_RESULT_DATATYPE_MISMATCH = 1629,
+ LIBMSI_RESULT_INVALID_DATATYPE = 1804
+} LibmsiResult;
+
+typedef enum LibmsiPropertyType
+{
+ LIBMSI_PROPERTY_TYPE_EMPTY = 0,
+ LIBMSI_PROPERTY_TYPE_INT = 1,
+ LIBMSI_PROPERTY_TYPE_STRING = 2,
+ LIBMSI_PROPERTY_TYPE_FILETIME = 3,
+} LibmsiPropertyType;
+
+#define MSI_NULL_INTEGER 0x80000000
+
+typedef enum LibmsiColInfo
+{
+ LIBMSI_COL_INFO_NAMES = 0,
+ LIBMSI_COL_INFO_TYPES = 1
+} LibmsiColInfo;
+
+#define LIBMSI_DB_OPEN_READONLY (const char *)0
+#define LIBMSI_DB_OPEN_TRANSACT (const char *)1
+#define LIBMSI_DB_OPEN_CREATE (const char *)2
+
+#define LIBMSI_DB_OPEN_PATCHFILE 32 / sizeof(*LIBMSI_DB_OPEN_READONLY)
+
+typedef enum LibmsiDBError
+{
+ LIBMSI_DB_ERROR_INVALIDARG = -3,
+ LIBMSI_DB_ERROR_MOREDATA = -2,
+ LIBMSI_DB_ERROR_FUNCTIONERROR = -1,
+ LIBMSI_DB_ERROR_NOERROR = 0,
+ LIBMSI_DB_ERROR_DUPLICATEKEY = 1,
+ LIBMSI_DB_ERROR_REQUIRED = 2,
+ LIBMSI_DB_ERROR_BADLINK = 3,
+ LIBMSI_DB_ERROR_OVERFLOW = 4,
+ LIBMSI_DB_ERROR_UNDERFLOW = 5,
+ LIBMSI_DB_ERROR_NOTINSET = 6,
+ LIBMSI_DB_ERROR_BADVERSION = 7,
+ LIBMSI_DB_ERROR_BADCASE = 8,
+ LIBMSI_DB_ERROR_BADGUID = 9,
+ LIBMSI_DB_ERROR_BADWILDCARD = 10,
+ LIBMSI_DB_ERROR_BADIDENTIFIER = 11,
+ LIBMSI_DB_ERROR_BADLANGUAGE = 12,
+ LIBMSI_DB_ERROR_BADFILENAME = 13,
+ LIBMSI_DB_ERROR_BADPATH = 14,
+ LIBMSI_DB_ERROR_BADCONDITION = 15,
+ LIBMSI_DB_ERROR_BADFORMATTED = 16,
+ LIBMSI_DB_ERROR_BADTEMPLATE = 17,
+ LIBMSI_DB_ERROR_BADDEFAULTDIR = 18,
+ LIBMSI_DB_ERROR_BADREGPATH = 19,
+ LIBMSI_DB_ERROR_BADCUSTOMSOURCE = 20,
+ LIBMSI_DB_ERROR_BADPROPERTY = 21,
+ LIBMSI_DB_ERROR_MISSINGDATA = 22,
+ LIBMSI_DB_ERROR_BADCATEGORY = 23,
+ LIBMSI_DB_ERROR_BADKEYTABLE = 24,
+ LIBMSI_DB_ERROR_BADMAXMINVALUES = 25,
+ LIBMSI_DB_ERROR_BADCABINET = 26,
+ LIBMSI_DB_ERROR_BADSHORTCUT= 27,
+ LIBMSI_DB_ERROR_STRINGOVERFLOW = 28,
+ LIBMSI_DB_ERROR_BADLOCALIZEATTRIB = 29
+} LibmsiDBError;
+
+typedef enum LibmsiDBState
+{
+ LIBMSI_DB_STATE_ERROR = -1,
+ LIBMSI_DB_STATE_READ = 0,
+ LIBMSI_DB_STATE_WRITE = 1
+} LibmsiDBState;
+
+#define MSI_PID_DICTIONARY (0)
+#define MSI_PID_CODEPAGE (0x1)
+#define MSI_PID_FIRST_USABLE 2
+#define MSI_PID_TITLE 2
+#define MSI_PID_SUBJECT 3
+#define MSI_PID_AUTHOR 4
+#define MSI_PID_KEYWORDS 5
+#define MSI_PID_COMMENTS 6
+#define MSI_PID_TEMPLATE 7
+#define MSI_PID_LASTAUTHOR 8
+#define MSI_PID_REVNUMBER 9
+#define MSI_PID_EDITTIME 10
+#define MSI_PID_LASTPRINTED 11
+#define MSI_PID_CREATE_DTM 12
+#define MSI_PID_LASTSAVE_DTM 13
+#define MSI_PID_PAGECOUNT 14
+#define MSI_PID_WORDCOUNT 15
+#define MSI_PID_CHARCOUNT 16
+#define MSI_PID_THUMBNAIL 17
+#define MSI_PID_APPNAME 18
+#define MSI_PID_SECURITY 19
+
+#define MSI_PID_MSIVERSION MSI_PID_PAGECOUNT
+#define MSI_PID_MSISOURCE MSI_PID_WORDCOUNT
+#define MSI_PID_MSIRESTRICT MSI_PID_CHARCOUNT
+
+#endif /* _LIBMSI_TYPES_H */
diff --git a/include/libmsi.h b/include/libmsi.h
index fdf199e..fc39237 100644
--- a/include/libmsi.h
+++ b/include/libmsi.h
@@ -19,198 +19,10 @@
#ifndef _LIBMSI_H
#define _LIBMSI_H
-#include <stdint.h>
-#include <stdbool.h>
-
-typedef struct LibmsiQuery LibmsiQuery;
-typedef struct LibmsiDatabase LibmsiDatabase;
-typedef struct LibmsiRecord LibmsiRecord;
-typedef struct LibmsiSummaryInfo LibmsiSummaryInfo;
-
-typedef enum LibmsiCondition
-{
- LIBMSI_CONDITION_FALSE = 0,
- LIBMSI_CONDITION_TRUE = 1,
- LIBMSI_CONDITION_NONE = 2,
- LIBMSI_CONDITION_ERROR = 3,
-} LibmsiCondition;
-
-typedef enum LibmsiResult
-{
- LIBMSI_RESULT_SUCCESS = 0,
- LIBMSI_RESULT_ACCESS_DENIED = 5,
- LIBMSI_RESULT_INVALID_HANDLE = 6,
- LIBMSI_RESULT_NOT_ENOUGH_MEMORY = 8,
- LIBMSI_RESULT_INVALID_DATA = 13,
- LIBMSI_RESULT_OUTOFMEMORY = 14,
- LIBMSI_RESULT_INVALID_PARAMETER = 87,
- LIBMSI_RESULT_OPEN_FAILED = 110,
- LIBMSI_RESULT_CALL_NOT_IMPLEMENTED = 120,
- LIBMSI_RESULT_MORE_DATA = 234,
- LIBMSI_RESULT_NO_MORE_ITEMS = 259,
- LIBMSI_RESULT_NOT_FOUND = 1168,
- LIBMSI_RESULT_CONTINUE = 1246,
- LIBMSI_RESULT_UNKNOWN_PROPERTY = 1608,
- LIBMSI_RESULT_BAD_QUERY_SYNTAX = 1615,
- LIBMSI_RESULT_INVALID_FIELD = 1616,
- LIBMSI_RESULT_FUNCTION_FAILED = 1627,
- LIBMSI_RESULT_INVALID_TABLE = 1628,
- LIBMSI_RESULT_DATATYPE_MISMATCH = 1629,
- LIBMSI_RESULT_INVALID_DATATYPE = 1804
-} LibmsiResult;
-
-typedef enum LibmsiPropertyType
-{
- LIBMSI_PROPERTY_TYPE_EMPTY = 0,
- LIBMSI_PROPERTY_TYPE_INT = 1,
- LIBMSI_PROPERTY_TYPE_STRING = 2,
- LIBMSI_PROPERTY_TYPE_FILETIME = 3,
-} LibmsiPropertyType;
-
-#define MSI_NULL_INTEGER 0x80000000
-
-typedef enum LibmsiColInfo
-{
- LIBMSI_COL_INFO_NAMES = 0,
- LIBMSI_COL_INFO_TYPES = 1
-} LibmsiColInfo;
-
-#define LIBMSI_DB_OPEN_READONLY (const char *)0
-#define LIBMSI_DB_OPEN_TRANSACT (const char *)1
-#define LIBMSI_DB_OPEN_CREATE (const char *)2
-
-#define LIBMSI_DB_OPEN_PATCHFILE 32 / sizeof(*LIBMSI_DB_OPEN_READONLY)
-
-typedef enum LibmsiDBError
-{
- LIBMSI_DB_ERROR_INVALIDARG = -3,
- LIBMSI_DB_ERROR_MOREDATA = -2,
- LIBMSI_DB_ERROR_FUNCTIONERROR = -1,
- LIBMSI_DB_ERROR_NOERROR = 0,
- LIBMSI_DB_ERROR_DUPLICATEKEY = 1,
- LIBMSI_DB_ERROR_REQUIRED = 2,
- LIBMSI_DB_ERROR_BADLINK = 3,
- LIBMSI_DB_ERROR_OVERFLOW = 4,
- LIBMSI_DB_ERROR_UNDERFLOW = 5,
- LIBMSI_DB_ERROR_NOTINSET = 6,
- LIBMSI_DB_ERROR_BADVERSION = 7,
- LIBMSI_DB_ERROR_BADCASE = 8,
- LIBMSI_DB_ERROR_BADGUID = 9,
- LIBMSI_DB_ERROR_BADWILDCARD = 10,
- LIBMSI_DB_ERROR_BADIDENTIFIER = 11,
- LIBMSI_DB_ERROR_BADLANGUAGE = 12,
- LIBMSI_DB_ERROR_BADFILENAME = 13,
- LIBMSI_DB_ERROR_BADPATH = 14,
- LIBMSI_DB_ERROR_BADCONDITION = 15,
- LIBMSI_DB_ERROR_BADFORMATTED = 16,
- LIBMSI_DB_ERROR_BADTEMPLATE = 17,
- LIBMSI_DB_ERROR_BADDEFAULTDIR = 18,
- LIBMSI_DB_ERROR_BADREGPATH = 19,
- LIBMSI_DB_ERROR_BADCUSTOMSOURCE = 20,
- LIBMSI_DB_ERROR_BADPROPERTY = 21,
- LIBMSI_DB_ERROR_MISSINGDATA = 22,
- LIBMSI_DB_ERROR_BADCATEGORY = 23,
- LIBMSI_DB_ERROR_BADKEYTABLE = 24,
- LIBMSI_DB_ERROR_BADMAXMINVALUES = 25,
- LIBMSI_DB_ERROR_BADCABINET = 26,
- LIBMSI_DB_ERROR_BADSHORTCUT= 27,
- LIBMSI_DB_ERROR_STRINGOVERFLOW = 28,
- LIBMSI_DB_ERROR_BADLOCALIZEATTRIB = 29
-} LibmsiDBError;
-
-typedef enum LibmsiDBState
-{
- LIBMSI_DB_STATE_ERROR = -1,
- LIBMSI_DB_STATE_READ = 0,
- LIBMSI_DB_STATE_WRITE = 1
-} LibmsiDBState;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MSI_PID_DICTIONARY (0)
-#define MSI_PID_CODEPAGE (0x1)
-#define MSI_PID_FIRST_USABLE 2
-#define MSI_PID_TITLE 2
-#define MSI_PID_SUBJECT 3
-#define MSI_PID_AUTHOR 4
-#define MSI_PID_KEYWORDS 5
-#define MSI_PID_COMMENTS 6
-#define MSI_PID_TEMPLATE 7
-#define MSI_PID_LASTAUTHOR 8
-#define MSI_PID_REVNUMBER 9
-#define MSI_PID_EDITTIME 10
-#define MSI_PID_LASTPRINTED 11
-#define MSI_PID_CREATE_DTM 12
-#define MSI_PID_LASTSAVE_DTM 13
-#define MSI_PID_PAGECOUNT 14
-#define MSI_PID_WORDCOUNT 15
-#define MSI_PID_CHARCOUNT 16
-#define MSI_PID_THUMBNAIL 17
-#define MSI_PID_APPNAME 18
-#define MSI_PID_SECURITY 19
-
-#define MSI_PID_MSIVERSION MSI_PID_PAGECOUNT
-#define MSI_PID_MSISOURCE MSI_PID_WORDCOUNT
-#define MSI_PID_MSIRESTRICT MSI_PID_CHARCOUNT
-
-
-/* view manipulation */
-LibmsiResult libmsi_query_fetch(LibmsiQuery *,LibmsiRecord **);
-LibmsiResult libmsi_query_execute(LibmsiQuery *,LibmsiRecord *);
-LibmsiResult libmsi_query_close(LibmsiQuery *);
-LibmsiResult libmsi_database_open_query(LibmsiDatabase *,const char *,LibmsiQuery **);
-LibmsiDBError libmsi_query_get_error(LibmsiQuery *,char *,unsigned *);
-
-LibmsiDBState libmsi_database_get_state(LibmsiDatabase *);
-
-/* record manipulation */
-LibmsiRecord * libmsi_record_create(unsigned);
-LibmsiResult libmsi_record_clear_data(LibmsiRecord *);
-LibmsiResult libmsi_record_set_int(LibmsiRecord *,unsigned,int);
-LibmsiResult libmsi_record_set_string(LibmsiRecord *,unsigned,const char *);
-LibmsiResult libmsi_record_get_string(const LibmsiRecord *,unsigned,char *,unsigned *);
-unsigned libmsi_record_get_field_count(const LibmsiRecord *);
-int libmsi_record_get_integer(const LibmsiRecord *,unsigned);
-unsigned libmsi_record_get_field_size(const LibmsiRecord *,unsigned);
-bool libmsi_record_is_null(const LibmsiRecord *,unsigned);
-
-LibmsiResult libmsi_record_load_stream(LibmsiRecord *,unsigned,const char *);
-LibmsiResult libmsi_record_save_stream(LibmsiRecord *,unsigned,char*,unsigned *);
-
-LibmsiResult libmsi_database_get_primary_keys(LibmsiDatabase *,const char *,LibmsiRecord **);
-
-/* database transforms */
-LibmsiResult libmsi_database_apply_transform(LibmsiDatabase *,const char *,int);
-
-LibmsiResult libmsi_query_get_column_info(LibmsiQuery *, LibmsiColInfo, LibmsiRecord **);
-
-LibmsiResult libmsi_summary_info_get_property(LibmsiSummaryInfo *, LibmsiPropertyType,unsigned *,int *,uint64_t*,char *,unsigned *);
-
-LibmsiResult libmsi_summary_info_set_property(LibmsiSummaryInfo *, LibmsiPropertyType, unsigned, int, uint64_t*, const char *);
-
-LibmsiResult libmsi_database_export(LibmsiDatabase *, const char *, int fd);
-
-LibmsiResult libmsi_database_import(LibmsiDatabase *, const char *, const char *);
-
-LibmsiResult libmsi_database_open(const char *, const char *, LibmsiDatabase **);
-
-LibmsiCondition libmsi_database_is_table_persistent(LibmsiDatabase *, const char *);
-
-LibmsiResult libmsi_summary_info_persist(LibmsiSummaryInfo *);
-LibmsiResult libmsi_summary_info_get_property_count(LibmsiSummaryInfo *,unsigned *);
-
-LibmsiResult libmsi_database_merge(LibmsiDatabase *, LibmsiDatabase *, const char *);
-
-/* Non Unicode */
-LibmsiResult libmsi_database_get_summary_info(LibmsiDatabase *, unsigned, LibmsiSummaryInfo **);
-LibmsiResult libmsi_database_commit(LibmsiDatabase *);
-LibmsiResult libmsi_unref(void *);
-
-#ifdef __cplusplus
-}
-#endif
+#include <libmsi-types.h>
+#include <libmsi-database.h>
+#include <libmsi-query.h>
+#include <libmsi-record.h>
+#include <libmsi-summary-info.h>
#endif /* _LIBMSI_H */
diff --git a/libmsi/Makefile.am b/libmsi/Makefile.am
index b336304..c3f285e 100644
--- a/libmsi/Makefile.am
+++ b/libmsi/Makefile.am
@@ -14,10 +14,10 @@ noinst_HEADERS = \
query.h \
unicode.h
-libmsi_la_SOURCES = alter.c create.c database.c delete.c distinct.c \
- drop.c handle.c insert.c msiquery.c record.c select.c storages.c \
- streams.c string.c suminfo.c table.c tokenize.c update.c where.c \
- sql-parser.y \
+libmsi_la_SOURCES = libmsi-database.c libmsi-query.c libmsi-record.c \
+ libmsi-summary-info.c alter.c create.c delete.c distinct.c \
+ drop.c handle.c insert.c select.c storages.c streams.c \
+ string.c table.c tokenize.c update.c where.c sql-parser.y \
utf16/snprintfW.c utf16/sprintfW.c utf16/strtolW.c
libmsi_la_LDFLAGS = -no-undefined -rpath $(libdir) \
diff --git a/libmsi/alter.c b/libmsi/alter.c
index 2c238b8..bd99dc2 100644
--- a/libmsi/alter.c
+++ b/libmsi/alter.c
@@ -32,7 +32,7 @@
#include "query.h"
-typedef struct LibmsiAlterView
+typedef struct _LibmsiAlterView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/create.c b/libmsi/create.c
index 49a021d..52cff0d 100644
--- a/libmsi/create.c
+++ b/libmsi/create.c
@@ -37,7 +37,7 @@
/* below is the query interface to a table */
-typedef struct LibmsiCreateView
+typedef struct _LibmsiCreateView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/delete.c b/libmsi/delete.c
index 3f06018..9a945c4 100644
--- a/libmsi/delete.c
+++ b/libmsi/delete.c
@@ -46,7 +46,7 @@
* that's a bug in the way I'm running the query, or a just a bug.
*/
-typedef struct LibmsiDeleteView
+typedef struct _LibmsiDeleteView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/distinct.c b/libmsi/distinct.c
index 3d2bee6..5a1fdb2 100644
--- a/libmsi/distinct.c
+++ b/libmsi/distinct.c
@@ -33,16 +33,16 @@
#include "query.h"
-typedef struct LibmsiDistinctSet
+typedef struct _LibmsiDistinctSet
{
unsigned val;
unsigned count;
unsigned row;
- struct LibmsiDistinctSet *nextrow;
- struct LibmsiDistinctSet *nextcol;
+ struct _LibmsiDistinctSet *nextrow;
+ struct _LibmsiDistinctSet *nextcol;
} LibmsiDistinctSet;
-typedef struct LibmsiDistinctView
+typedef struct _LibmsiDistinctView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/drop.c b/libmsi/drop.c
index ba59eb4..14078bd 100644
--- a/libmsi/drop.c
+++ b/libmsi/drop.c
@@ -32,7 +32,7 @@
#include "query.h"
-typedef struct LibmsiDropView
+typedef struct _LibmsiDropView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/insert.c b/libmsi/insert.c
index 1ff1293..c18b4db 100644
--- a/libmsi/insert.c
+++ b/libmsi/insert.c
@@ -37,7 +37,7 @@
/* below is the query interface to a table */
-typedef struct LibmsiInsertView
+typedef struct _LibmsiInsertView
{
LibmsiView view;
LibmsiView *table;
diff --git a/libmsi/database.c b/libmsi/libmsi-database.c
index b4132d9..9c8bc3c 100644
--- a/libmsi/database.c
+++ b/libmsi/libmsi-database.c
@@ -55,18 +55,18 @@ const char clsid_msi_patch[16] = { 0x86, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x0
#define IS_INTMSIDBOPEN(x) \
((x) >= LIBMSI_DB_OPEN_READONLY && (x) <= LIBMSI_DB_OPEN_CREATE)
-typedef struct LibmsiTransform {
+typedef struct _LibmsiTransform {
struct list entry;
IStorage *stg;
} LibmsiTransform;
-typedef struct LibmsiStorage {
+typedef struct _LibmsiStorage {
struct list entry;
WCHAR *name;
IStorage *stg;
} LibmsiStorage;
-typedef struct LibmsiStream {
+typedef struct _LibmsiStream {
struct list entry;
WCHAR *name;
IStream *stm;
diff --git a/libmsi/msiquery.c b/libmsi/libmsi-query.c
index d020e16..d020e16 100644
--- a/libmsi/msiquery.c
+++ b/libmsi/libmsi-query.c
diff --git a/libmsi/record.c b/libmsi/libmsi-record.c
index 37039d8..6aefe53 100644
--- a/libmsi/record.c
+++ b/libmsi/libmsi-record.c
@@ -226,7 +226,7 @@ LibmsiResult libmsi_record_set_int( LibmsiRecord *rec, unsigned iField, int iVal
return LIBMSI_RESULT_SUCCESS;
}
-bool libmsi_record_is_null( const LibmsiRecord *rec, unsigned iField )
+gboolean libmsi_record_is_null( const LibmsiRecord *rec, unsigned iField )
{
bool r = true;
diff --git a/libmsi/suminfo.c b/libmsi/libmsi-summary-info.c
index 130cd8e..4c0e77d 100644
--- a/libmsi/suminfo.c
+++ b/libmsi/libmsi-summary-info.c
@@ -115,7 +115,7 @@ static unsigned read_dword( uint8_t *data, unsigned *ofs )
return val;
}
-static void parse_filetime( const WCHAR *str, uint64_t *ft )
+static void parse_filetime( const WCHAR *str, guint64 *ft )
{
struct tm tm;
time_t t;
@@ -219,7 +219,7 @@ static void read_properties_from_data( LibmsiOLEVariant *prop, uint8_t *data, un
break;
}
property->filetime = read_dword(data, &dwOffset);
- property->filetime |= (uint64_t)read_dword(data, &dwOffset) << 32;
+ property->filetime |= (guint64)read_dword(data, &dwOffset) << 32;
break;
case OLEVT_LPSTR:
len = read_dword(data, &dwOffset);
@@ -345,7 +345,7 @@ static unsigned write_dword( uint8_t *data, unsigned ofs, unsigned val )
return 4;
}
-static unsigned write_filetime( uint8_t *data, unsigned ofs, const uint64_t *ft )
+static unsigned write_filetime( uint8_t *data, unsigned ofs, const guint64 *ft )
{
write_dword( data, ofs, (*ft) & 0xFFFFFFFFUL );
write_dword( data, ofs + 4, (*ft) >> 32 );
@@ -522,7 +522,7 @@ LibmsiResult libmsi_summary_info_get_property_count(LibmsiSummaryInfo *si, unsig
LibmsiResult libmsi_summary_info_get_property(
LibmsiSummaryInfo *si, unsigned uiProperty, unsigned *puiDataType, int *pintvalue,
- uint64_t *pftValue, char *szValueBuf, unsigned *pcchValueBuf)
+ guint64 *pftValue, char *szValueBuf, unsigned *pcchValueBuf)
{
LibmsiOLEVariant *prop;
unsigned ret = LIBMSI_RESULT_SUCCESS;
@@ -589,7 +589,7 @@ LibmsiResult libmsi_summary_info_get_property(
}
static LibmsiResult _libmsi_summary_info_set_property( LibmsiSummaryInfo *si, unsigned uiProperty,
- unsigned type, int intvalue, uint64_t* pftValue, const char *szValue )
+ unsigned type, int intvalue, guint64* pftValue, const char *szValue )
{
LibmsiOLEVariant *prop;
unsigned len;
@@ -644,7 +644,7 @@ end:
}
LibmsiResult libmsi_summary_info_set_property( LibmsiSummaryInfo *si, unsigned uiProperty,
- unsigned uiDataType, int intvalue, uint64_t* pftValue, const char *szValue )
+ unsigned uiDataType, int intvalue, guint64* pftValue, const char *szValue )
{
int type;
@@ -680,7 +680,7 @@ LibmsiResult libmsi_summary_info_set_property( LibmsiSummaryInfo *si, unsigned u
}
static unsigned parse_prop( const WCHAR *prop, const WCHAR *value, unsigned *pid, int *int_value,
- uint64_t *ft_value, char **str_value )
+ guint64 *ft_value, char **str_value )
{
*pid = atoiW( prop );
switch (*pid)
@@ -738,7 +738,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records,
{
unsigned pid;
int int_value = 0;
- uint64_t ft_value;
+ guint64 ft_value;
char *str_value = NULL;
r = parse_prop( records[i][j], records[i][j + 1], &pid, &int_value, &ft_value, &str_value );
diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h
index d94ff5e..297f089 100644
--- a/libmsi/msipriv.h
+++ b/libmsi/msipriv.h
@@ -23,6 +23,8 @@
#define __WINE_MSI_PRIVATE__
#include <stdarg.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <glib.h>
#include <gsf/gsf.h>
@@ -51,18 +53,18 @@
#define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
-struct LibmsiTable;
-typedef struct LibmsiTable LibmsiTable;
+struct _LibmsiTable;
+typedef struct _LibmsiTable LibmsiTable;
struct string_table;
typedef struct string_table string_table;
-struct LibmsiObject;
-typedef struct LibmsiObject LibmsiObject;
+struct _LibmsiObject;
+typedef struct _LibmsiObject LibmsiObject;
typedef VOID (*msihandledestructor)( LibmsiObject * );
-struct LibmsiObject
+struct _LibmsiObject
{
unsigned magic;
LONG refcount;
@@ -72,7 +74,7 @@ struct LibmsiObject
#define MSI_INITIAL_MEDIA_TRANSFORM_OFFSET 10000
#define MSI_INITIAL_MEDIA_TRANSFORM_DISKID 30000
-typedef struct LibmsiDatabase
+typedef struct _LibmsiDatabase
{
LibmsiObject hdr;
IStorage *infile;
@@ -92,9 +94,9 @@ typedef struct LibmsiDatabase
struct list storages;
} LibmsiDatabase;
-typedef struct LibmsiView LibmsiView;
+typedef struct _LibmsiView LibmsiView;
-typedef struct LibmsiQuery
+typedef struct _LibmsiQuery
{
LibmsiObject hdr;
LibmsiView *view;
@@ -104,7 +106,7 @@ typedef struct LibmsiQuery
} LibmsiQuery;
/* maybe we can use a Variant instead of doing it ourselves? */
-typedef struct LibmsiField
+typedef struct _LibmsiField
{
unsigned type;
union
@@ -115,7 +117,7 @@ typedef struct LibmsiField
} u;
} LibmsiField;
-typedef struct LibmsiRecord
+typedef struct _LibmsiRecord
{
LibmsiObject hdr;
unsigned count; /* as passed to libmsi_record_create */
@@ -132,9 +134,9 @@ typedef struct _column_info
struct _column_info *next;
} column_info;
-typedef const struct LibmsiColumnHashEntry *MSIITERHANDLE;
+typedef const struct _LibmsiColumnHashEntry *MSIITERHANDLE;
-typedef struct LibmsiViewOps
+typedef struct _LibmsiViewOps
{
/*
* fetch_int - reads one integer from {row,col} in the table
@@ -253,7 +255,7 @@ typedef struct LibmsiViewOps
unsigned (*drop)( LibmsiView *view );
} LibmsiViewOps;
-struct LibmsiView
+struct _LibmsiView
{
const LibmsiViewOps *ops;
LibmsiDBError error;
@@ -272,7 +274,7 @@ enum LibmsiOLEVariantType
OLEVT_FILETIME = 64,
};
-typedef struct LibmsiOLEVariant
+typedef struct _LibmsiOLEVariant
{
enum LibmsiOLEVariantType vt;
union {
@@ -282,7 +284,7 @@ typedef struct LibmsiOLEVariant
};
} LibmsiOLEVariant;
-typedef struct LibmsiSummaryInfo
+typedef struct _LibmsiSummaryInfo
{
LibmsiObject hdr;
LibmsiDatabase *database;
diff --git a/libmsi/select.c b/libmsi/select.c
index b8a649d..3866cae 100644
--- a/libmsi/select.c
+++ b/libmsi/select.c
@@ -36,7 +36,7 @@
/* below is the query interface to a table */
-typedef struct LibmsiSelectView
+typedef struct _LibmsiSelectView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/sql-parser.y b/libmsi/sql-parser.y
index 0c975f6..ddbbf97 100644
--- a/libmsi/sql-parser.y
+++ b/libmsi/sql-parser.y
@@ -40,7 +40,7 @@
static int sql_error(void *info, const char *str);
-typedef struct LibmsiSQLInput
+typedef struct _LibmsiSQLInput
{
LibmsiDatabase *db;
const WCHAR *command;
diff --git a/libmsi/storages.c b/libmsi/storages.c
index c66369b..f154c82 100644
--- a/libmsi/storages.c
+++ b/libmsi/storages.c
@@ -42,7 +42,7 @@ typedef struct tabSTORAGE
unsigned str_index;
} STORAGE;
-typedef struct LibmsiStorageView
+typedef struct _LibmsiStorageView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/streams.c b/libmsi/streams.c
index f443c80..dbd8c17 100644
--- a/libmsi/streams.c
+++ b/libmsi/streams.c
@@ -42,7 +42,7 @@ typedef struct tabSTREAM
IStream *stream;
} STREAM;
-typedef struct LibmsiStreamsView
+typedef struct _LibmsiStreamsView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/table.c b/libmsi/table.c
index c8a284c..4b8cc16 100644
--- a/libmsi/table.c
+++ b/libmsi/table.c
@@ -43,14 +43,14 @@
static const WCHAR szDot[] = {'.',0};
-typedef struct LibmsiColumnHashEntry
+typedef struct _LibmsiColumnHashEntry
{
- struct LibmsiColumnHashEntry *next;
+ struct _LibmsiColumnHashEntry *next;
unsigned value;
unsigned row;
} LibmsiColumnHashEntry;
-typedef struct LibmsiColumnInfo
+typedef struct _LibmsiColumnInfo
{
const WCHAR *tablename;
unsigned number;
@@ -62,7 +62,7 @@ typedef struct LibmsiColumnInfo
LibmsiColumnHashEntry **hash_table;
} LibmsiColumnInfo;
-struct LibmsiTable
+struct _LibmsiTable
{
uint8_t **data;
bool *data_persistent;
@@ -1080,7 +1080,7 @@ bool table_view_exists( LibmsiDatabase *db, const WCHAR *name )
/* below is the query interface to a table */
-typedef struct LibmsiTableView
+typedef struct _LibmsiTableView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/update.c b/libmsi/update.c
index f1f3d8d..a7f54e8 100644
--- a/libmsi/update.c
+++ b/libmsi/update.c
@@ -36,7 +36,7 @@
/* below is the query interface to a table */
-typedef struct LibmsiUpdateView
+typedef struct _LibmsiUpdateView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/libmsi/where.c b/libmsi/where.c
index 010ee19..5491bfa 100644
--- a/libmsi/where.c
+++ b/libmsi/where.c
@@ -37,9 +37,9 @@
/* below is the query interface to a table */
-typedef struct LibmsiRowEntry
+typedef struct _LibmsiRowEntry
{
- struct LibmsiWhereView *wv; /* used during sorting */
+ struct _LibmsiWhereView *wv; /* used during sorting */
unsigned values[1];
} LibmsiRowEntry;
@@ -52,14 +52,14 @@ typedef struct tagJOINTABLE
unsigned table_index;
} JOINTABLE;
-typedef struct LibmsiOrderInfo
+typedef struct _LibmsiOrderInfo
{
unsigned col_count;
unsigned error;
union ext_column columns[1];
} LibmsiOrderInfo;
-typedef struct LibmsiWhereView
+typedef struct _LibmsiWhereView
{
LibmsiView view;
LibmsiDatabase *db;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c0eac24..803f5b3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -I.
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir) -I. $(GLIB_CFLAGS)
noinst_PROGRAMS = testrecord testdatabase
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index 6748faa..d50ab52 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -26,6 +26,8 @@
#include <glib.h>
#include <stdio.h>
#include <assert.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>