diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-10 17:30:32 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-10 17:30:32 +0100 |
| commit | 9a1151d6474ac7daebc263edc2f37caf3b4c9955 (patch) | |
| tree | d11965d58c2eb20c0470fc5f9c25de42ab545375 | |
| parent | 2ea5d49da27c3569251896884786649a72bd6df3 (diff) | |
| parent | 6b7407cb031cf245a4998d8c79009039ead38fc5 (diff) | |
Merge branch 'pre-gsf'
Conflicts:
libmsi/Makefile.am
libmsi/libmsi-summary-info.c
libmsi/msipriv.h
| -rw-r--r-- | include/libmsi-database.h | 36 | ||||
| -rw-r--r-- | include/libmsi-query.h | 30 | ||||
| -rw-r--r-- | include/libmsi-record.h | 37 | ||||
| -rw-r--r-- | include/libmsi-summary-info.h | 30 | ||||
| -rw-r--r-- | include/libmsi-types.h | 153 | ||||
| -rw-r--r-- | include/libmsi.h | 198 | ||||
| -rw-r--r-- | libmsi/Makefile.am | 8 | ||||
| -rw-r--r-- | libmsi/alter.c | 2 | ||||
| -rw-r--r-- | libmsi/create.c | 2 | ||||
| -rw-r--r-- | libmsi/delete.c | 2 | ||||
| -rw-r--r-- | libmsi/distinct.c | 8 | ||||
| -rw-r--r-- | libmsi/drop.c | 2 | ||||
| -rw-r--r-- | libmsi/insert.c | 2 | ||||
| -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.h | 32 | ||||
| -rw-r--r-- | libmsi/select.c | 2 | ||||
| -rw-r--r-- | libmsi/sql-parser.y | 2 | ||||
| -rw-r--r-- | libmsi/storages.c | 2 | ||||
| -rw-r--r-- | libmsi/streams.c | 2 | ||||
| -rw-r--r-- | libmsi/table.c | 10 | ||||
| -rw-r--r-- | libmsi/update.c | 2 | ||||
| -rw-r--r-- | libmsi/where.c | 8 | ||||
| -rw-r--r-- | tests/Makefile.am | 2 | ||||
| -rw-r--r-- | tools/msiinfo.c | 2 |
27 files changed, 350 insertions, 248 deletions
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 6f2aafa..e6f6677 100644 --- a/libmsi/Makefile.am +++ b/libmsi/Makefile.am @@ -12,10 +12,10 @@ noinst_HEADERS = \ msipriv.h \ query.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 libmsi_la_LDFLAGS = -no-undefined -rpath $(libdir) \ -export-symbols-regex='^libmsi_' diff --git a/libmsi/alter.c b/libmsi/alter.c index aba817b..c4ae96b 100644 --- a/libmsi/alter.c +++ b/libmsi/alter.c @@ -27,7 +27,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 0fe92d6..ef1ac6d 100644 --- a/libmsi/create.c +++ b/libmsi/create.c @@ -30,7 +30,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 9972a32..3a3623c 100644 --- a/libmsi/delete.c +++ b/libmsi/delete.c @@ -40,7 +40,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 bdc335f..89614e3 100644 --- a/libmsi/distinct.c +++ b/libmsi/distinct.c @@ -27,16 +27,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 399e431..2fd2501 100644 --- a/libmsi/drop.c +++ b/libmsi/drop.c @@ -27,7 +27,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 97238c7..1bb34c1 100644 --- a/libmsi/insert.c +++ b/libmsi/insert.c @@ -30,7 +30,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 976a51f..e4a99a9 100644 --- a/libmsi/database.c +++ b/libmsi/libmsi-database.c @@ -46,18 +46,18 @@ const uint8_t clsid_msi_patch[16] = { 0x86, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, #define IS_INTMSIDBOPEN(x) \ ((x) >= LIBMSI_DB_OPEN_READONLY && (x) <= LIBMSI_DB_OPEN_CREATE) -typedef struct LibmsiTransform { +typedef struct _LibmsiTransform { struct list entry; GsfInfile *stg; } LibmsiTransform; -typedef struct LibmsiStorage { +typedef struct _LibmsiStorage { struct list entry; char *name; GsfInfile *stg; } LibmsiStorage; -typedef struct LibmsiStream { +typedef struct _LibmsiStream { struct list entry; char *name; GsfInput *stm; diff --git a/libmsi/msiquery.c b/libmsi/libmsi-query.c index 6b9b8a3..6b9b8a3 100644 --- a/libmsi/msiquery.c +++ b/libmsi/libmsi-query.c diff --git a/libmsi/record.c b/libmsi/libmsi-record.c index 56e71db..1f6b344 100644 --- a/libmsi/record.c +++ b/libmsi/libmsi-record.c @@ -215,7 +215,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 8ba346b..6bcee3f 100644 --- a/libmsi/suminfo.c +++ b/libmsi/libmsi-summary-info.c @@ -111,7 +111,7 @@ static unsigned read_dword( const uint8_t *data, unsigned *ofs ) return val; } -static void parse_filetime( const char *str, uint64_t *ft ) +static void parse_filetime( const char *str, guint64 *ft ) { struct tm tm; time_t t; @@ -215,7 +215,7 @@ static void read_properties_from_data( LibmsiOLEVariant *prop, const uint8_t *da 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); @@ -332,7 +332,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 ); @@ -507,7 +507,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; @@ -574,7 +574,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; @@ -629,7 +629,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; @@ -665,7 +665,7 @@ LibmsiResult libmsi_summary_info_set_property( LibmsiSummaryInfo *si, unsigned u } static unsigned parse_prop( const char *prop, const char *value, unsigned *pid, int *int_value, - uint64_t *ft_value, char **str_value ) + guint64 *ft_value, char **str_value ) { *pid = atoi( prop ); switch (*pid) @@ -723,7 +723,7 @@ unsigned msi_add_suminfo( LibmsiDatabase *db, char ***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 89642e6..3264ff8 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -25,6 +25,8 @@ #include <stdarg.h> #include <string.h> #include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> #include <glib.h> #include <gsf/gsf.h> @@ -62,18 +64,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; int refcount; @@ -83,7 +85,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; GsfInfile *infile; @@ -103,9 +105,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; @@ -115,7 +117,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 @@ -126,7 +128,7 @@ typedef struct LibmsiField } u; } LibmsiField; -typedef struct LibmsiRecord +typedef struct _LibmsiRecord { LibmsiObject hdr; unsigned count; /* as passed to libmsi_record_create */ @@ -143,9 +145,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 @@ -264,7 +266,7 @@ typedef struct LibmsiViewOps unsigned (*drop)( LibmsiView *view ); } LibmsiViewOps; -struct LibmsiView +struct _LibmsiView { const LibmsiViewOps *ops; LibmsiDBError error; @@ -283,7 +285,7 @@ enum LibmsiOLEVariantType OLEVT_FILETIME = 64, }; -typedef struct LibmsiOLEVariant +typedef struct _LibmsiOLEVariant { enum LibmsiOLEVariantType vt; union { @@ -293,7 +295,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 b200fe8..ad24053 100644 --- a/libmsi/select.c +++ b/libmsi/select.c @@ -30,7 +30,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 bbea5fd..4725fd8 100644 --- a/libmsi/sql-parser.y +++ b/libmsi/sql-parser.y @@ -37,7 +37,7 @@ static int sql_error(void *info, const char *str); -typedef struct LibmsiSQLInput +typedef struct _LibmsiSQLInput { LibmsiDatabase *db; const char *command; diff --git a/libmsi/storages.c b/libmsi/storages.c index 471091d..6829849 100644 --- a/libmsi/storages.c +++ b/libmsi/storages.c @@ -35,7 +35,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 d5d2aa5..93e05cc 100644 --- a/libmsi/streams.c +++ b/libmsi/streams.c @@ -35,7 +35,7 @@ typedef struct tabSTREAM GsfInput *stream; } STREAM; -typedef struct LibmsiStreamsView +typedef struct _LibmsiStreamsView { LibmsiView view; LibmsiDatabase *db; diff --git a/libmsi/table.c b/libmsi/table.c index f95e813..4b54edf 100644 --- a/libmsi/table.c +++ b/libmsi/table.c @@ -32,14 +32,14 @@ static const char szDot[] = "."; -typedef struct LibmsiColumnHashEntry +typedef struct _LibmsiColumnHashEntry { - struct LibmsiColumnHashEntry *next; + struct _LibmsiColumnHashEntry *next; unsigned value; unsigned row; } LibmsiColumnHashEntry; -typedef struct LibmsiColumnInfo +typedef struct _LibmsiColumnInfo { const char *tablename; unsigned number; @@ -51,7 +51,7 @@ typedef struct LibmsiColumnInfo LibmsiColumnHashEntry **hash_table; } LibmsiColumnInfo; -struct LibmsiTable +struct _LibmsiTable { uint8_t **data; bool *data_persistent; @@ -1009,7 +1009,7 @@ bool table_view_exists( LibmsiDatabase *db, const char *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 a6456ce..c552825 100644 --- a/libmsi/update.c +++ b/libmsi/update.c @@ -30,7 +30,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 c9231ed..003679b 100644 --- a/libmsi/where.c +++ b/libmsi/where.c @@ -30,9 +30,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; @@ -45,14 +45,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 b10049b..1c9af62 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) dist_noinst_HEADERS = test.h noinst_PROGRAMS = testrecord testdatabase diff --git a/tools/msiinfo.c b/tools/msiinfo.c index 62b7f89..d9dfbf5 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> |
