From 6b7407cb031cf245a4998d8c79009039ead38fc5 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sun, 9 Dec 2012 23:35:30 +0100 Subject: Split libmsi.h to be more gobject-like --- include/debug.h | 78 +++-------------- include/libmsi-database.h | 36 ++++++++ include/libmsi-query.h | 30 +++++++ include/libmsi-record.h | 37 ++++++++ include/libmsi-summary-info.h | 30 +++++++ include/libmsi-types.h | 153 ++++++++++++++++++++++++++++++++ include/libmsi.h | 198 ++---------------------------------------- 7 files changed, 304 insertions(+), 258 deletions(-) create mode 100644 include/libmsi-database.h create mode 100644 include/libmsi-query.h create mode 100644 include/libmsi-record.h create mode 100644 include/libmsi-summary-info.h create mode 100644 include/libmsi-types.h (limited to 'include') 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 +#include #include #include #include -#include -#include -#include -#ifndef GUID_DEFINED -#include -#endif +#include #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( "", (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 */ #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 + +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 -#include - -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 +#include +#include +#include +#include #endif /* _LIBMSI_H */ -- cgit