From 9ad11a6d7c458dbcd5784955ff2f8f5a4256a4fc Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 23 Oct 2012 11:42:15 +0200 Subject: ok, things start to be readable fix --- libmsi/alter.c | 70 +++++------ libmsi/create.c | 48 +++---- libmsi/database.c | 230 +++++++++++++++++----------------- libmsi/delete.c | 52 ++++---- libmsi/distinct.c | 72 +++++------ libmsi/drop.c | 34 ++--- libmsi/handle.c | 14 +-- libmsi/insert.c | 76 ++++++------ libmsi/msipriv.h | 238 +++++++++++++++++------------------ libmsi/msiquery.c | 210 +++++++++++++++---------------- libmsi/query.h | 34 ++--- libmsi/record.c | 248 ++++++++++++++++++------------------- libmsi/select.c | 84 ++++++------- libmsi/sql-parser.y | 42 +++---- libmsi/storages.c | 100 +++++++-------- libmsi/streams.c | 100 +++++++-------- libmsi/suminfo.c | 84 ++++++------- libmsi/table.c | 350 ++++++++++++++++++++++++++-------------------------- libmsi/update.c | 66 +++++----- libmsi/where.c | 188 ++++++++++++++-------------- 20 files changed, 1170 insertions(+), 1170 deletions(-) (limited to 'libmsi') diff --git a/libmsi/alter.c b/libmsi/alter.c index 9b12bbc..b96dc61 100644 --- a/libmsi/alter.c +++ b/libmsi/alter.c @@ -32,52 +32,52 @@ #include "query.h" -typedef struct tagMSIALTERVIEW +typedef struct LibmsiAlterView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *table; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *table; column_info *colinfo; int hold; -} MSIALTERVIEW; +} LibmsiAlterView; -static unsigned ALTER_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned ALTER_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %d %d %p\n", av, row, col, val ); return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, IStream **stm) +static unsigned ALTER_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %d %d %p\n", av, row, col, stm ); return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned ALTER_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %d %p\n", av, row, rec ); return av->table->ops->get_row(av->table, row, rec); } -static unsigned ITERATE_columns(MSIRECORD *row, void *param) +static unsigned ITERATE_columns(LibmsiRecord *row, void *param) { (*(unsigned *)param)++; return ERROR_SUCCESS; } -static bool check_column_exists(MSIDATABASE *db, const WCHAR *table, const WCHAR *column) +static bool check_column_exists(LibmsiDatabase *db, const WCHAR *table, const WCHAR *column) { - MSIQUERY *view; - MSIRECORD *rec; + LibmsiQuery *view; + LibmsiRecord *rec; unsigned r; static const WCHAR query[] = { @@ -104,11 +104,11 @@ done: return (r == ERROR_SUCCESS); } -static unsigned alter_add_column(MSIALTERVIEW *av) +static unsigned alter_add_column(LibmsiAlterView *av) { unsigned r, colnum = 1; - MSIQUERY *view; - MSIVIEW *columns; + LibmsiQuery *view; + LibmsiView *columns; static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0}; static const WCHAR query[] = { @@ -147,9 +147,9 @@ static unsigned alter_add_column(MSIALTERVIEW *av) return r; } -static unsigned ALTER_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned ALTER_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; unsigned ref; TRACE("%p %p\n", av, record); @@ -169,47 +169,47 @@ static unsigned ALTER_execute( MSIVIEW *view, MSIRECORD *record ) return ERROR_SUCCESS; } -static unsigned ALTER_close( MSIVIEW *view ) +static unsigned ALTER_close( LibmsiView *view ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p\n", av ); return ERROR_SUCCESS; } -static unsigned ALTER_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned ALTER_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %p %p\n", av, rows, cols ); return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned ALTER_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %d %p %p %p %p\n", av, n, name, type, temporary, table_name ); return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned ALTER_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p %d %p\n", av, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } -static unsigned ALTER_delete( MSIVIEW *view ) +static unsigned ALTER_delete( LibmsiView *view ) { - MSIALTERVIEW *av = (MSIALTERVIEW*)view; + LibmsiAlterView *av = (LibmsiAlterView*)view; TRACE("%p\n", av ); if (av->table) @@ -219,7 +219,7 @@ static unsigned ALTER_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned ALTER_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned ALTER_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -227,7 +227,7 @@ static unsigned ALTER_find_matching_rows( MSIVIEW *view, unsigned col, return ERROR_FUNCTION_FAILED; } -static const MSIVIEWOPS alter_ops = +static const LibmsiViewOPS alter_ops = { ALTER_fetch_int, ALTER_fetch_stream, @@ -250,9 +250,9 @@ static const MSIVIEWOPS alter_ops = NULL, }; -unsigned ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *name, column_info *colinfo, int hold ) +unsigned ALTER_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ) { - MSIALTERVIEW *av; + LibmsiAlterView *av; unsigned r; TRACE("%p %p %s %d\n", view, colinfo, debugstr_w(name), hold ); diff --git a/libmsi/create.c b/libmsi/create.c index 3027348..84e1d80 100644 --- a/libmsi/create.c +++ b/libmsi/create.c @@ -37,29 +37,29 @@ /* below is the query interface to a table */ -typedef struct tagMSICREATEVIEW +typedef struct LibmsiCreateView { - MSIVIEW view; - MSIDATABASE *db; + LibmsiView view; + LibmsiDatabase *db; const WCHAR * name; bool bIsTemp; bool hold; column_info *col_info; -} MSICREATEVIEW; +} LibmsiCreateView; -static unsigned CREATE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned CREATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p %d %d %p\n", cv, row, col, val ); return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned CREATE_execute( LibmsiView *view, LibmsiRecord *record ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; - bool persist = (cv->bIsTemp) ? MSICONDITION_FALSE : MSICONDITION_TRUE; + LibmsiCreateView *cv = (LibmsiCreateView*)view; + bool persist = (cv->bIsTemp) ? LIBMSI_CONDITION_FALSE : LIBMSI_CONDITION_TRUE; TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name), cv->bIsTemp?"temporary":"permanent"); @@ -70,47 +70,47 @@ static unsigned CREATE_execute( MSIVIEW *view, MSIRECORD *record ) return msi_create_table( cv->db, cv->name, cv->col_info, persist ); } -static unsigned CREATE_close( MSIVIEW *view ) +static unsigned CREATE_close( LibmsiView *view ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p\n", cv); return ERROR_SUCCESS; } -static unsigned CREATE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned CREATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p %p %p\n", cv, rows, cols ); return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned CREATE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name ); return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row) +static unsigned CREATE_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p %d %p\n", cv, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } -static unsigned CREATE_delete( MSIVIEW *view ) +static unsigned CREATE_delete( LibmsiView *view ) { - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + LibmsiCreateView *cv = (LibmsiCreateView*)view; TRACE("%p\n", cv ); @@ -120,7 +120,7 @@ static unsigned CREATE_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static const MSIVIEWOPS create_ops = +static const LibmsiViewOPS create_ops = { CREATE_fetch_int, NULL, @@ -156,10 +156,10 @@ static unsigned check_columns( const column_info *col_info ) return ERROR_SUCCESS; } -unsigned CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, +unsigned CREATE_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *col_info, bool hold ) { - MSICREATEVIEW *cv = NULL; + LibmsiCreateView *cv = NULL; unsigned r; column_info *col; bool temp = true; @@ -200,7 +200,7 @@ unsigned CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, cv->col_info = col_info; cv->bIsTemp = temp; cv->hold = hold; - *view = (MSIVIEW*) cv; + *view = (LibmsiView*) cv; return ERROR_SUCCESS; } diff --git a/libmsi/database.c b/libmsi/database.c index 1ad7e8d..84f0663 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -51,22 +51,22 @@ #define IS_INTMSIDBOPEN(x) (((uintptr_t)(x) >> 16) == 0) -typedef struct tagMSITRANSFORM { +typedef struct LibmsiTransform { struct list entry; IStorage *stg; -} MSITRANSFORM; +} LibmsiTransform; -typedef struct tagMSISTREAM { +typedef struct LibmsiStream { struct list entry; IStorage *stg; IStream *stm; -} MSISTREAM; +} LibmsiStream; -static unsigned find_open_stream( MSIDATABASE *db, IStorage *stg, const WCHAR *name, IStream **stm ) +static unsigned find_open_stream( LibmsiDatabase *db, IStorage *stg, const WCHAR *name, IStream **stm ) { - MSISTREAM *stream; + LibmsiStream *stream; - LIST_FOR_EACH_ENTRY( stream, &db->streams, MSISTREAM, entry ) + LIST_FOR_EACH_ENTRY( stream, &db->streams, LibmsiStream, entry ) { HRESULT r; STATSTG stat; @@ -94,7 +94,7 @@ static unsigned find_open_stream( MSIDATABASE *db, IStorage *stg, const WCHAR *n return ERROR_FUNCTION_FAILED; } -unsigned msi_clone_open_stream( MSIDATABASE *db, IStorage *stg, const WCHAR *name, IStream **stm ) +unsigned msi_clone_open_stream( LibmsiDatabase *db, IStorage *stg, const WCHAR *name, IStream **stm ) { IStream *stream; @@ -124,7 +124,7 @@ unsigned msi_clone_open_stream( MSIDATABASE *db, IStorage *stg, const WCHAR *nam return ERROR_FUNCTION_FAILED; } -unsigned msi_get_raw_stream( MSIDATABASE *db, const WCHAR *stname, IStream **stm ) +unsigned msi_get_raw_stream( LibmsiDatabase *db, const WCHAR *stname, IStream **stm ) { HRESULT r; IStorage *stg; @@ -140,9 +140,9 @@ unsigned msi_get_raw_stream( MSIDATABASE *db, const WCHAR *stname, IStream **stm STGM_READ | STGM_SHARE_EXCLUSIVE, 0, stm ); if( FAILED( r ) ) { - MSITRANSFORM *transform; + LibmsiTransform *transform; - LIST_FOR_EACH_ENTRY( transform, &db->transforms, MSITRANSFORM, entry ) + LIST_FOR_EACH_ENTRY( transform, &db->transforms, LibmsiTransform, entry ) { r = IStorage_OpenStream( transform->stg, stname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, stm ); @@ -157,9 +157,9 @@ unsigned msi_get_raw_stream( MSIDATABASE *db, const WCHAR *stname, IStream **stm if( SUCCEEDED(r) ) { - MSISTREAM *stream; + LibmsiStream *stream; - if (!(stream = msi_alloc( sizeof(MSISTREAM) ))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(stream = msi_alloc( sizeof(LibmsiStream) ))) return ERROR_NOT_ENOUGH_MEMORY; stream->stg = stg; IStorage_AddRef( stg ); stream->stm = *stm; @@ -170,23 +170,23 @@ unsigned msi_get_raw_stream( MSIDATABASE *db, const WCHAR *stname, IStream **stm return SUCCEEDED(r) ? ERROR_SUCCESS : ERROR_FUNCTION_FAILED; } -static void free_transforms( MSIDATABASE *db ) +static void free_transforms( LibmsiDatabase *db ) { while( !list_empty( &db->transforms ) ) { - MSITRANSFORM *t = LIST_ENTRY( list_head( &db->transforms ), - MSITRANSFORM, entry ); + LibmsiTransform *t = LIST_ENTRY( list_head( &db->transforms ), + LibmsiTransform, entry ); list_remove( &t->entry ); IStorage_Release( t->stg ); msi_free( t ); } } -void msi_destroy_stream( MSIDATABASE *db, const WCHAR *stname ) +void msi_destroy_stream( LibmsiDatabase *db, const WCHAR *stname ) { - MSISTREAM *stream, *stream2; + LibmsiStream *stream, *stream2; - LIST_FOR_EACH_ENTRY_SAFE( stream, stream2, &db->streams, MSISTREAM, entry ) + LIST_FOR_EACH_ENTRY_SAFE( stream, stream2, &db->streams, LibmsiStream, entry ) { HRESULT r; STATSTG stat; @@ -214,11 +214,11 @@ void msi_destroy_stream( MSIDATABASE *db, const WCHAR *stname ) } } -static void free_streams( MSIDATABASE *db ) +static void free_streams( LibmsiDatabase *db ) { while( !list_empty( &db->streams ) ) { - MSISTREAM *s = LIST_ENTRY(list_head( &db->streams ), MSISTREAM, entry); + LibmsiStream *s = LIST_ENTRY(list_head( &db->streams ), LibmsiStream, entry); list_remove( &s->entry ); IStream_Release( s->stm ); IStorage_Release( s->stg ); @@ -226,9 +226,9 @@ static void free_streams( MSIDATABASE *db ) } } -void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) +void append_storage_to_db( LibmsiDatabase *db, IStorage *stg ) { - MSITRANSFORM *t; + LibmsiTransform *t; t = msi_alloc( sizeof *t ); t->stg = stg; @@ -239,9 +239,9 @@ void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) free_streams( db ); } -static VOID MSI_CloseDatabase( MSIOBJECT *arg ) +static VOID MSI_CloseDatabase( LibmsiObject *arg ) { - MSIDATABASE *db = (MSIDATABASE *) arg; + LibmsiDatabase *db = (LibmsiDatabase *) arg; msi_free(db->path); free_cached_tables( db ); @@ -293,11 +293,11 @@ static HRESULT db_initialize( IStorage *stg, const GUID *clsid ) return S_OK; } -unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDATABASE **pdb) +unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, LibmsiDatabase **pdb) { IStorage *stg = NULL; HRESULT r; - MSIDATABASE *db = NULL; + LibmsiDatabase *db = NULL; unsigned ret = ERROR_FUNCTION_FAILED; const WCHAR *szMode; const WCHAR *save_path; @@ -310,11 +310,11 @@ unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDAT if( !pdb ) return ERROR_INVALID_PARAMETER; - if (szPersist - MSIDBOPEN_PATCHFILE >= MSIDBOPEN_READONLY && - szPersist - MSIDBOPEN_PATCHFILE <= MSIDBOPEN_CREATEDIRECT) + if (szPersist - LIBMSI_DB_OPEN_PATCHFILE >= LIBMSI_DB_OPEN_READONLY && + szPersist - LIBMSI_DB_OPEN_PATCHFILE <= LIBMSI_DB_OPEN_CREATEDIRECT) { TRACE("Database is a patch\n"); - szPersist -= MSIDBOPEN_PATCHFILE; + szPersist -= LIBMSI_DB_OPEN_PATCHFILE; patch = true; } @@ -326,16 +326,16 @@ unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDAT return ERROR_OPEN_FAILED; szDBPath = szPersist; - szPersist = MSIDBOPEN_TRANSACT; + szPersist = LIBMSI_DB_OPEN_TRANSACT; created = true; } - if( szPersist == MSIDBOPEN_READONLY ) + if( szPersist == LIBMSI_DB_OPEN_READONLY ) { r = StgOpenStorage( szDBPath, NULL, STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); } - else if( szPersist == MSIDBOPEN_CREATE ) + else if( szPersist == LIBMSI_DB_OPEN_CREATE ) { r = StgCreateDocfile( szDBPath, STGM_CREATE|STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg ); @@ -344,7 +344,7 @@ unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDAT r = db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase ); created = true; } - else if( szPersist == MSIDBOPEN_CREATEDIRECT ) + else if( szPersist == LIBMSI_DB_OPEN_CREATEDIRECT ) { r = StgCreateDocfile( szDBPath, STGM_CREATE|STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, &stg ); @@ -353,12 +353,12 @@ unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDAT r = db_initialize( stg, patch ? &CLSID_MsiPatch : &CLSID_MsiDatabase ); created = true; } - else if( szPersist == MSIDBOPEN_TRANSACT ) + else if( szPersist == LIBMSI_DB_OPEN_TRANSACT ) { r = StgOpenStorage( szDBPath, NULL, STGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); } - else if( szPersist == MSIDBOPEN_DIRECT ) + else if( szPersist == LIBMSI_DB_OPEN_DIRECT ) { r = StgOpenStorage( szDBPath, NULL, STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg); @@ -399,7 +399,7 @@ unsigned MSI_OpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIDAT goto end; } - db = alloc_msiobject( MSIOBJECTTYPE_DATABASE, sizeof (MSIDATABASE), + db = alloc_msiobject( LIBMSI_OBJECT_TYPE_DATABASE, sizeof (LibmsiDatabase), MSI_CloseDatabase ); if( !db ) { @@ -450,9 +450,9 @@ end: return ret; } -unsigned MsiOpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIOBJECT **phDB) +unsigned MsiOpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, LibmsiObject **phDB) { - MSIDATABASE *db; + LibmsiDatabase *db; unsigned ret; TRACE("%s %s %p\n",debugstr_w(szDBPath),debugstr_w(szPersist), phDB); @@ -466,7 +466,7 @@ unsigned MsiOpenDatabaseW(const WCHAR *szDBPath, const WCHAR *szPersist, MSIOBJE return ret; } -unsigned MsiOpenDatabaseA(const char *szDBPath, const char *szPersist, MSIOBJECT **phDB) +unsigned MsiOpenDatabaseA(const char *szDBPath, const char *szPersist, LibmsiObject **phDB) { HRESULT r = ERROR_FUNCTION_FAILED; WCHAR *szwDBPath = NULL; @@ -752,11 +752,11 @@ done: return postlude; } -static unsigned msi_add_table_to_db(MSIDATABASE *db, WCHAR **columns, WCHAR **types, WCHAR **labels, unsigned num_labels, unsigned num_columns) +static unsigned msi_add_table_to_db(LibmsiDatabase *db, WCHAR **columns, WCHAR **types, WCHAR **labels, unsigned num_labels, unsigned num_columns) { unsigned r = ERROR_OUTOFMEMORY; unsigned size; - MSIQUERY *view; + LibmsiQuery *view; WCHAR *create_sql = NULL; WCHAR *prelude; WCHAR *columns_sql; @@ -820,7 +820,7 @@ static WCHAR *msi_import_stream_filename(const WCHAR *path, const WCHAR *name) } static unsigned construct_record(unsigned num_columns, WCHAR **types, - WCHAR **data, WCHAR *path, MSIRECORD **rec) + WCHAR **data, WCHAR *path, LibmsiRecord **rec) { unsigned i; @@ -863,15 +863,15 @@ static unsigned construct_record(unsigned num_columns, WCHAR **types, return ERROR_SUCCESS; } -static unsigned msi_add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR **types, +static unsigned msi_add_records_to_table(LibmsiDatabase *db, WCHAR **columns, WCHAR **types, WCHAR **labels, WCHAR ***records, int num_columns, int num_records, WCHAR *path) { unsigned r; int i; - MSIQUERY *view; - MSIRECORD *rec; + LibmsiQuery *view; + LibmsiRecord *rec; static const WCHAR select[] = { 'S','E','L','E','C','T',' ','*',' ', @@ -884,7 +884,7 @@ static unsigned msi_add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR while (MSI_ViewFetch(view, &rec) != ERROR_NO_MORE_ITEMS) { - r = MSI_ViewModify(view, MSIMODIFY_DELETE, rec); + r = MSI_ViewModify(view, LIBMSI_MODIFY_DELETE, rec); msiobj_release(&rec->hdr); if (r != ERROR_SUCCESS) goto done; @@ -896,7 +896,7 @@ static unsigned msi_add_records_to_table(MSIDATABASE *db, WCHAR **columns, WCHAR if (r != ERROR_SUCCESS) goto done; - r = MSI_ViewModify(view, MSIMODIFY_INSERT, rec); + r = MSI_ViewModify(view, LIBMSI_MODIFY_INSERT, rec); if (r != ERROR_SUCCESS) { msiobj_release(&rec->hdr); @@ -911,7 +911,7 @@ done: return r; } -static unsigned MSI_DatabaseImport(MSIDATABASE *db, const WCHAR *folder, const WCHAR *file) +static unsigned MSI_DatabaseImport(LibmsiDatabase *db, const WCHAR *folder, const WCHAR *file) { unsigned r; unsigned len, i; @@ -1026,14 +1026,14 @@ done: return r; } -unsigned MsiDatabaseImportW(MSIOBJECT *handle, const WCHAR *szFolder, const WCHAR *szFilename) +unsigned MsiDatabaseImportW(LibmsiObject *handle, const WCHAR *szFolder, const WCHAR *szFilename) { - MSIDATABASE *db; + LibmsiDatabase *db; unsigned r; TRACE("%x %s %s\n",handle,debugstr_w(szFolder), debugstr_w(szFilename)); - db = msihandle2msiinfo( handle, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; r = MSI_DatabaseImport( db, szFolder, szFilename ); @@ -1041,7 +1041,7 @@ unsigned MsiDatabaseImportW(MSIOBJECT *handle, const WCHAR *szFolder, const WCHA return r; } -unsigned MsiDatabaseImportA( MSIOBJECT *handle, +unsigned MsiDatabaseImportA( LibmsiObject *handle, const char *szFolder, const char *szFilename ) { WCHAR *path = NULL; @@ -1073,7 +1073,7 @@ end: return r; } -static unsigned msi_export_record( HANDLE handle, MSIRECORD *row, unsigned start ) +static unsigned msi_export_record( HANDLE handle, LibmsiRecord *row, unsigned start ) { unsigned i, count, len, r = ERROR_SUCCESS; const char *sep; @@ -1120,7 +1120,7 @@ static unsigned msi_export_record( HANDLE handle, MSIRECORD *row, unsigned start return r; } -static unsigned msi_export_row( MSIRECORD *row, void *arg ) +static unsigned msi_export_row( LibmsiRecord *row, void *arg ) { return msi_export_record( arg, row, 1 ); } @@ -1140,15 +1140,15 @@ static unsigned msi_export_forcecodepage( HANDLE handle, unsigned codepage ) return ERROR_SUCCESS; } -static unsigned MSI_DatabaseExport( MSIDATABASE *db, const WCHAR *table, +static unsigned MSI_DatabaseExport( LibmsiDatabase *db, const WCHAR *table, const WCHAR *folder, const WCHAR *file ) { static const WCHAR query[] = { 's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 }; static const WCHAR forcecodepage[] = { '_','F','o','r','c','e','C','o','d','e','p','a','g','e',0 }; - MSIRECORD *rec = NULL; - MSIQUERY *view = NULL; + LibmsiRecord *rec = NULL; + LibmsiQuery *view = NULL; WCHAR *filename; HANDLE handle; unsigned len, r; @@ -1185,7 +1185,7 @@ static unsigned MSI_DatabaseExport( MSIDATABASE *db, const WCHAR *table, if (r == ERROR_SUCCESS) { /* write out row 1, the column names */ - r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); + r = MSI_ViewGetColumnInfo(view, LIBMSI_COL_INFO_NAMES, &rec); if (r == ERROR_SUCCESS) { msi_export_record( handle, rec, 1 ); @@ -1193,7 +1193,7 @@ static unsigned MSI_DatabaseExport( MSIDATABASE *db, const WCHAR *table, } /* write out row 2, the column types */ - r = MSI_ViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); + r = MSI_ViewGetColumnInfo(view, LIBMSI_COL_INFO_TYPES, &rec); if (r == ERROR_SUCCESS) { msi_export_record( handle, rec, 1 ); @@ -1234,16 +1234,16 @@ done: * * row4 : data data data ... data */ -unsigned MsiDatabaseExportW( MSIOBJECT *handle, const WCHAR *szTable, +unsigned MsiDatabaseExportW( LibmsiObject *handle, const WCHAR *szTable, const WCHAR *szFolder, const WCHAR *szFilename ) { - MSIDATABASE *db; + LibmsiDatabase *db; unsigned r; TRACE("%x %s %s %s\n", handle, debugstr_w(szTable), debugstr_w(szFolder), debugstr_w(szFilename)); - db = msihandle2msiinfo( handle, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; r = MSI_DatabaseExport( db, szTable, szFolder, szFilename ); @@ -1251,7 +1251,7 @@ unsigned MsiDatabaseExportW( MSIOBJECT *handle, const WCHAR *szTable, return r; } -unsigned MsiDatabaseExportA( MSIOBJECT *handle, const char *szTable, +unsigned MsiDatabaseExportA( LibmsiObject *handle, const char *szTable, const char *szFolder, const char *szFilename ) { WCHAR *path = NULL; @@ -1293,7 +1293,7 @@ end: return r; } -unsigned MsiDatabaseMergeA(MSIOBJECT *hDatabase, MSIOBJECT *hDatabaseMerge, +unsigned MsiDatabaseMergeA(LibmsiObject *hDatabase, LibmsiObject *hDatabaseMerge, const char *szTableName) { unsigned r; @@ -1326,15 +1326,15 @@ typedef struct _tagMERGETABLE typedef struct _tagMERGEROW { struct list entry; - MSIRECORD *data; + LibmsiRecord *data; } MERGEROW; typedef struct _tagMERGEDATA { - MSIDATABASE *db; - MSIDATABASE *merge; + LibmsiDatabase *db; + LibmsiDatabase *merge; MERGETABLE *curtable; - MSIQUERY *curview; + LibmsiQuery *curview; struct list *tabledata; } MERGEDATA; @@ -1351,16 +1351,16 @@ static bool merge_type_match(const WCHAR *type1, const WCHAR *type2) return !strcmpW( type1, type2 ); } -static unsigned merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview) +static unsigned merge_verify_colnames(LibmsiQuery *dbview, LibmsiQuery *mergeview) { - MSIRECORD *dbrec, *mergerec; + LibmsiRecord *dbrec, *mergerec; unsigned r, i, count; - r = MSI_ViewGetColumnInfo(dbview, MSICOLINFO_NAMES, &dbrec); + r = MSI_ViewGetColumnInfo(dbview, LIBMSI_COL_INFO_NAMES, &dbrec); if (r != ERROR_SUCCESS) return r; - r = MSI_ViewGetColumnInfo(mergeview, MSICOLINFO_NAMES, &mergerec); + r = MSI_ViewGetColumnInfo(mergeview, LIBMSI_COL_INFO_NAMES, &mergerec); if (r != ERROR_SUCCESS) return r; @@ -1381,11 +1381,11 @@ static unsigned merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview) msiobj_release(&mergerec->hdr); dbrec = mergerec = NULL; - r = MSI_ViewGetColumnInfo(dbview, MSICOLINFO_TYPES, &dbrec); + r = MSI_ViewGetColumnInfo(dbview, LIBMSI_COL_INFO_TYPES, &dbrec); if (r != ERROR_SUCCESS) return r; - r = MSI_ViewGetColumnInfo(mergeview, MSICOLINFO_TYPES, &mergerec); + r = MSI_ViewGetColumnInfo(mergeview, LIBMSI_COL_INFO_TYPES, &mergerec); if (r != ERROR_SUCCESS) return r; @@ -1410,10 +1410,10 @@ done: return r; } -static unsigned merge_verify_primary_keys(MSIDATABASE *db, MSIDATABASE *mergedb, +static unsigned merge_verify_primary_keys(LibmsiDatabase *db, LibmsiDatabase *mergedb, const WCHAR *table) { - MSIRECORD *dbrec, *mergerec = NULL; + LibmsiRecord *dbrec, *mergerec = NULL; unsigned r, i, count; r = MSI_DatabaseGetPrimaryKeys(db, table, &dbrec); @@ -1447,15 +1447,15 @@ done: return r; } -static WCHAR *get_key_value(MSIQUERY *view, const WCHAR *key, MSIRECORD *rec) +static WCHAR *get_key_value(LibmsiQuery *view, const WCHAR *key, LibmsiRecord *rec) { - MSIRECORD *colnames; + LibmsiRecord *colnames; WCHAR *str; WCHAR *val; unsigned r, i = 0, sz = 0; int cmp; - r = MSI_ViewGetColumnInfo(view, MSICOLINFO_NAMES, &colnames); + r = MSI_ViewGetColumnInfo(view, LIBMSI_COL_INFO_NAMES, &colnames); if (r != ERROR_SUCCESS) return NULL; @@ -1506,8 +1506,8 @@ static WCHAR *get_key_value(MSIQUERY *view, const WCHAR *key, MSIRECORD *rec) return val; } -static WCHAR *create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, - WCHAR *table, MSIRECORD *rec) +static WCHAR *create_diff_row_query(LibmsiDatabase *merge, LibmsiQuery *view, + WCHAR *table, LibmsiRecord *rec) { WCHAR *query = NULL; WCHAR *clause = NULL; @@ -1515,7 +1515,7 @@ static WCHAR *create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, const WCHAR *setptr; const WCHAR *key; unsigned size, oldsize; - MSIRECORD *keys; + LibmsiRecord *keys; unsigned r, i, count; static const WCHAR keyset[] = { @@ -1572,13 +1572,13 @@ done: return query; } -static unsigned merge_diff_row(MSIRECORD *rec, void *param) +static unsigned merge_diff_row(LibmsiRecord *rec, void *param) { MERGEDATA *data = param; MERGETABLE *table = data->curtable; MERGEROW *mergerow; - MSIQUERY *dbview = NULL; - MSIRECORD *row = NULL; + LibmsiQuery *dbview = NULL; + LibmsiRecord *row = NULL; WCHAR *query = NULL; unsigned r = ERROR_SUCCESS; @@ -1632,10 +1632,10 @@ done: return r; } -static unsigned msi_get_table_labels(MSIDATABASE *db, const WCHAR *table, WCHAR ***labels, unsigned *numlabels) +static unsigned msi_get_table_labels(LibmsiDatabase *db, const WCHAR *table, WCHAR ***labels, unsigned *numlabels) { unsigned r, i, count; - MSIRECORD *prec = NULL; + LibmsiRecord *prec = NULL; r = MSI_DatabaseGetPrimaryKeys(db, table, &prec); if (r != ERROR_SUCCESS) @@ -1661,12 +1661,12 @@ end: return r; } -static unsigned msi_get_query_columns(MSIQUERY *query, WCHAR ***columns, unsigned *numcolumns) +static unsigned msi_get_query_columns(LibmsiQuery *query, WCHAR ***columns, unsigned *numcolumns) { unsigned r, i, count; - MSIRECORD *prec = NULL; + LibmsiRecord *prec = NULL; - r = MSI_ViewGetColumnInfo(query, MSICOLINFO_NAMES, &prec); + r = MSI_ViewGetColumnInfo(query, LIBMSI_COL_INFO_NAMES, &prec); if (r != ERROR_SUCCESS) return r; @@ -1690,12 +1690,12 @@ end: return r; } -static unsigned msi_get_query_types(MSIQUERY *query, WCHAR ***types, unsigned *numtypes) +static unsigned msi_get_query_types(LibmsiQuery *query, WCHAR ***types, unsigned *numtypes) { unsigned r, i, count; - MSIRECORD *prec = NULL; + LibmsiRecord *prec = NULL; - r = MSI_ViewGetColumnInfo(query, MSICOLINFO_TYPES, &prec); + r = MSI_ViewGetColumnInfo(query, LIBMSI_COL_INFO_TYPES, &prec); if (r != ERROR_SUCCESS) return r; @@ -1766,11 +1766,11 @@ static void free_merge_table(MERGETABLE *table) msi_free(table); } -static unsigned msi_get_merge_table (MSIDATABASE *db, const WCHAR *name, MERGETABLE **ptable) +static unsigned msi_get_merge_table (LibmsiDatabase *db, const WCHAR *name, MERGETABLE **ptable) { unsigned r; MERGETABLE *table; - MSIQUERY *mergeview = NULL; + LibmsiQuery *mergeview = NULL; static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','%','s','`',0}; @@ -1814,12 +1814,12 @@ err: return r; } -static unsigned merge_diff_tables(MSIRECORD *rec, void *param) +static unsigned merge_diff_tables(LibmsiRecord *rec, void *param) { MERGEDATA *data = param; MERGETABLE *table; - MSIQUERY *dbview = NULL; - MSIQUERY *mergeview = NULL; + LibmsiQuery *dbview = NULL; + LibmsiQuery *mergeview = NULL; const WCHAR *name; unsigned r; @@ -1868,13 +1868,13 @@ done: return r; } -static unsigned gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, +static unsigned gather_merge_data(LibmsiDatabase *db, LibmsiDatabase *merge, struct list *tabledata) { static const WCHAR query[] = { 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','_','T','a','b','l','e','s','`',0}; - MSIQUERY *view; + LibmsiQuery *view; MERGEDATA data; unsigned r; @@ -1890,11 +1890,11 @@ static unsigned gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, return r; } -static unsigned merge_table(MSIDATABASE *db, MERGETABLE *table) +static unsigned merge_table(LibmsiDatabase *db, MERGETABLE *table) { unsigned r; MERGEROW *row; - MSIVIEW *tv; + LibmsiView *tv; if (!TABLE_Exists(db, table->name)) { @@ -1920,11 +1920,11 @@ static unsigned merge_table(MSIDATABASE *db, MERGETABLE *table) return ERROR_SUCCESS; } -static unsigned update_merge_errors(MSIDATABASE *db, const WCHAR *error, +static unsigned update_merge_errors(LibmsiDatabase *db, const WCHAR *error, WCHAR *table, unsigned numconflicts) { unsigned r; - MSIQUERY *view; + LibmsiQuery *view; static const WCHAR create[] = { 'C','R','E','A','T','E',' ','T','A','B','L','E',' ', @@ -1962,12 +1962,12 @@ static unsigned update_merge_errors(MSIDATABASE *db, const WCHAR *error, return r; } -unsigned MsiDatabaseMergeW(MSIOBJECT *hDatabase, MSIOBJECT *hDatabaseMerge, +unsigned MsiDatabaseMergeW(LibmsiObject *hDatabase, LibmsiObject *hDatabaseMerge, const WCHAR *szTableName) { struct list tabledata = LIST_INIT(tabledata); struct list *item, *cursor; - MSIDATABASE *db, *merge; + LibmsiDatabase *db, *merge; MERGETABLE *table; bool conflicts; unsigned r; @@ -1978,8 +1978,8 @@ unsigned MsiDatabaseMergeW(MSIOBJECT *hDatabase, MSIOBJECT *hDatabaseMerge, if (szTableName && !*szTableName) return ERROR_INVALID_TABLE; - db = msihandle2msiinfo(hDatabase, MSIOBJECTTYPE_DATABASE); - merge = msihandle2msiinfo(hDatabaseMerge, MSIOBJECTTYPE_DATABASE); + db = msihandle2msiinfo(hDatabase, LIBMSI_OBJECT_TYPE_DATABASE); + merge = msihandle2msiinfo(hDatabaseMerge, LIBMSI_OBJECT_TYPE_DATABASE); if (!db || !merge) { r = ERROR_INVALID_HANDLE; @@ -2026,18 +2026,18 @@ done: return r; } -MSIDBSTATE MsiGetDatabaseState( MSIOBJECT *handle ) +LibmsiDBState MsiGetDatabaseState( LibmsiObject *handle ) { - MSIDBSTATE ret = MSIDBSTATE_READ; - MSIDATABASE *db; + LibmsiDBState ret = LIBMSI_DB_STATE_READ; + LibmsiDatabase *db; TRACE("%d\n", handle); - db = msihandle2msiinfo( handle, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; - if (db->mode != MSIDBOPEN_READONLY ) - ret = MSIDBSTATE_WRITE; + if (db->mode != LIBMSI_DB_OPEN_READONLY ) + ret = LIBMSI_DB_STATE_WRITE; msiobj_release( &db->hdr ); return ret; diff --git a/libmsi/delete.c b/libmsi/delete.c index b601bb1..649f1d9 100644 --- a/libmsi/delete.c +++ b/libmsi/delete.c @@ -46,34 +46,34 @@ * that's a bug in the way I'm running the query, or a just a bug. */ -typedef struct tagMSIDELETEVIEW +typedef struct LibmsiDeleteView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *table; -} MSIDELETEVIEW; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *table; +} LibmsiDeleteView; -static unsigned DELETE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned DELETE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p %d %d %p\n", dv, row, col, val ); return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, IStream **stm) +static unsigned DELETE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p %d %d %p\n", dv, row, col, stm ); return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned DELETE_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; unsigned r, i, rows = 0, cols = 0; TRACE("%p %p\n", dv, record); @@ -98,9 +98,9 @@ static unsigned DELETE_execute( MSIVIEW *view, MSIRECORD *record ) return ERROR_SUCCESS; } -static unsigned DELETE_close( MSIVIEW *view ) +static unsigned DELETE_close( LibmsiView *view ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p\n", dv ); @@ -110,9 +110,9 @@ static unsigned DELETE_close( MSIVIEW *view ) return dv->table->ops->close( dv->table ); } -static unsigned DELETE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned DELETE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p %p %p\n", dv, rows, cols ); @@ -124,10 +124,10 @@ static unsigned DELETE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned * return dv->table->ops->get_dimensions( dv->table, NULL, cols ); } -static unsigned DELETE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned DELETE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); @@ -138,19 +138,19 @@ static unsigned DELETE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR * type, temporary, table_name); } -static unsigned DELETE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned DELETE_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p %d %p\n", dv, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } -static unsigned DELETE_delete( MSIVIEW *view ) +static unsigned DELETE_delete( LibmsiView *view ) { - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + LibmsiDeleteView *dv = (LibmsiDeleteView*)view; TRACE("%p\n", dv ); @@ -162,7 +162,7 @@ static unsigned DELETE_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned DELETE_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned DELETE_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -171,7 +171,7 @@ static unsigned DELETE_find_matching_rows( MSIVIEW *view, unsigned col, } -static const MSIVIEWOPS delete_ops = +static const LibmsiViewOPS delete_ops = { DELETE_fetch_int, DELETE_fetch_stream, @@ -194,9 +194,9 @@ static const MSIVIEWOPS delete_ops = NULL, }; -unsigned DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) +unsigned DELETE_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) { - MSIDELETEVIEW *dv = NULL; + LibmsiDeleteView *dv = NULL; TRACE("%p\n", dv ); diff --git a/libmsi/distinct.c b/libmsi/distinct.c index 324b390..db7aca9 100644 --- a/libmsi/distinct.c +++ b/libmsi/distinct.c @@ -33,25 +33,25 @@ #include "query.h" -typedef struct tagDISTINCTSET +typedef struct LibmsiDistinctSet { unsigned val; unsigned count; unsigned row; - struct tagDISTINCTSET *nextrow; - struct tagDISTINCTSET *nextcol; -} DISTINCTSET; + struct LibmsiDistinctSet *nextrow; + struct LibmsiDistinctSet *nextcol; +} LibmsiDistinctSet; -typedef struct tagMSIDISTINCTVIEW +typedef struct LibmsiDistinctView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *table; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *table; unsigned row_count; unsigned *translation; -} MSIDISTINCTVIEW; +} LibmsiDistinctView; -static DISTINCTSET ** distinct_insert( DISTINCTSET **x, unsigned val, unsigned row ) +static LibmsiDistinctSet ** distinct_insert( LibmsiDistinctSet **x, unsigned val, unsigned row ) { /* horrible O(n) find */ while( *x ) @@ -65,7 +65,7 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, unsigned val, unsigned r } /* nothing found, so add one */ - *x = msi_alloc( sizeof (DISTINCTSET) ); + *x = msi_alloc( sizeof (LibmsiDistinctSet) ); if( *x ) { (*x)->val = val; @@ -77,20 +77,20 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, unsigned val, unsigned r return x; } -static void distinct_free( DISTINCTSET *x ) +static void distinct_free( LibmsiDistinctSet *x ) { while( x ) { - DISTINCTSET *next = x->nextrow; + LibmsiDistinctSet *next = x->nextrow; distinct_free( x->nextcol ); msi_free( x ); x = next; } } -static unsigned DISTINCT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned DISTINCT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; TRACE("%p %d %d %p\n", dv, row, col, val ); @@ -105,11 +105,11 @@ static unsigned DISTINCT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, u return dv->table->ops->fetch_int( dv->table, row, col, val ); } -static unsigned DISTINCT_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned DISTINCT_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; unsigned r, i, j, r_count, c_count; - DISTINCTSET *rowset = NULL; + LibmsiDistinctSet *rowset = NULL; TRACE("%p %p\n", dv, record); @@ -131,7 +131,7 @@ static unsigned DISTINCT_execute( MSIVIEW *view, MSIRECORD *record ) /* build it */ for( i=0; itable->ops->close( dv->table ); } -static unsigned DISTINCT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned DISTINCT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; TRACE("%p %p %p\n", dv, rows, cols ); @@ -202,10 +202,10 @@ static unsigned DISTINCT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned return dv->table->ops->get_dimensions( dv->table, NULL, cols ); } -static unsigned DISTINCT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned DISTINCT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); @@ -216,10 +216,10 @@ static unsigned DISTINCT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR type, temporary, table_name ); } -static unsigned DISTINCT_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned DISTINCT_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; TRACE("%p %d %p\n", dv, eModifyMode, rec ); @@ -229,9 +229,9 @@ static unsigned DISTINCT_modify( MSIVIEW *view, MSIMODIFY eModifyMode, return dv->table->ops->modify( dv->table, eModifyMode, rec, row ); } -static unsigned DISTINCT_delete( MSIVIEW *view ) +static unsigned DISTINCT_delete( LibmsiView *view ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; TRACE("%p\n", dv ); @@ -245,10 +245,10 @@ static unsigned DISTINCT_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned DISTINCT_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned DISTINCT_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + LibmsiDistinctView *dv = (LibmsiDistinctView*)view; unsigned r; TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -266,7 +266,7 @@ static unsigned DISTINCT_find_matching_rows( MSIVIEW *view, unsigned col, return r; } -static const MSIVIEWOPS distinct_ops = +static const LibmsiViewOPS distinct_ops = { DISTINCT_fetch_int, NULL, @@ -289,9 +289,9 @@ static const MSIVIEWOPS distinct_ops = NULL, }; -unsigned DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) +unsigned DISTINCT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ) { - MSIDISTINCTVIEW *dv = NULL; + LibmsiDistinctView *dv = NULL; unsigned count = 0, r; TRACE("%p\n", dv ); @@ -314,7 +314,7 @@ unsigned DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) dv->table = table; dv->translation = NULL; dv->row_count = 0; - *view = (MSIVIEW*) dv; + *view = (LibmsiView*) dv; return ERROR_SUCCESS; } diff --git a/libmsi/drop.c b/libmsi/drop.c index 69cc32f..544635c 100644 --- a/libmsi/drop.c +++ b/libmsi/drop.c @@ -32,18 +32,18 @@ #include "query.h" -typedef struct tagMSIDROPVIEW +typedef struct LibmsiDropView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *table; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *table; column_info *colinfo; int hold; -} MSIDROPVIEW; +} LibmsiDropView; -static unsigned DROP_execute(MSIVIEW *view, MSIRECORD *record) +static unsigned DROP_execute(LibmsiView *view, LibmsiRecord *record) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + LibmsiDropView *dv = (LibmsiDropView*)view; unsigned r; TRACE("%p %p\n", dv, record); @@ -58,27 +58,27 @@ static unsigned DROP_execute(MSIVIEW *view, MSIRECORD *record) return dv->table->ops->drop(dv->table); } -static unsigned DROP_close(MSIVIEW *view) +static unsigned DROP_close(LibmsiView *view) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + LibmsiDropView *dv = (LibmsiDropView*)view; TRACE("%p\n", dv); return ERROR_SUCCESS; } -static unsigned DROP_get_dimensions(MSIVIEW *view, unsigned *rows, unsigned *cols) +static unsigned DROP_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + LibmsiDropView *dv = (LibmsiDropView*)view; TRACE("%p %p %p\n", dv, rows, cols); return ERROR_FUNCTION_FAILED; } -static unsigned DROP_delete( MSIVIEW *view ) +static unsigned DROP_delete( LibmsiView *view ) { - MSIDROPVIEW *dv = (MSIDROPVIEW*)view; + LibmsiDropView *dv = (LibmsiDropView*)view; TRACE("%p\n", dv ); @@ -90,7 +90,7 @@ static unsigned DROP_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static const MSIVIEWOPS drop_ops = +static const LibmsiViewOPS drop_ops = { NULL, NULL, @@ -113,9 +113,9 @@ static const MSIVIEWOPS drop_ops = NULL, }; -unsigned DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, const WCHAR *name) +unsigned DROP_CreateView(LibmsiDatabase *db, LibmsiView **view, const WCHAR *name) { - MSIDROPVIEW *dv; + LibmsiDropView *dv; unsigned r; TRACE("%p %s\n", view, debugstr_w(name)); @@ -134,7 +134,7 @@ unsigned DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, const WCHAR *name) dv->view.ops = &drop_ops; dv->db = db; - *view = (MSIVIEW *)dv; + *view = (LibmsiView *)dv; return ERROR_SUCCESS; } diff --git a/libmsi/handle.c b/libmsi/handle.c index 3ff52d4..30182ec 100644 --- a/libmsi/handle.c +++ b/libmsi/handle.c @@ -41,7 +41,7 @@ static CRITICAL_SECTION_DEBUG MSI_object_cs_debug = }; static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 }; -void *msihandle2msiinfo(MSIOBJECT *obj, unsigned type) +void *msihandle2msiinfo(LibmsiObject *obj, unsigned type) { if( !obj ) return NULL; @@ -54,7 +54,7 @@ void *msihandle2msiinfo(MSIOBJECT *obj, unsigned type) void *alloc_msiobject(unsigned type, unsigned size, msihandledestructor destroy ) { - MSIOBJECT *info; + LibmsiObject *info; info = msi_alloc_zero( size ); if( info ) @@ -67,7 +67,7 @@ void *alloc_msiobject(unsigned type, unsigned size, msihandledestructor destroy return info; } -void msiobj_addref( MSIOBJECT *info ) +void msiobj_addref( LibmsiObject *info ) { if( !info ) return; @@ -75,17 +75,17 @@ void msiobj_addref( MSIOBJECT *info ) InterlockedIncrement(&info->refcount); } -void msiobj_lock( MSIOBJECT *obj ) +void msiobj_lock( LibmsiObject *obj ) { EnterCriticalSection( &MSI_object_cs ); } -void msiobj_unlock( MSIOBJECT *obj ) +void msiobj_unlock( LibmsiObject *obj ) { LeaveCriticalSection( &MSI_object_cs ); } -int msiobj_release( MSIOBJECT *obj ) +int msiobj_release( LibmsiObject *obj ) { int ret; @@ -107,7 +107,7 @@ int msiobj_release( MSIOBJECT *obj ) /*********************************************************** * MsiCloseHandle [MSI.@] */ -unsigned MsiCloseHandle(MSIOBJECT *obj) +unsigned MsiCloseHandle(LibmsiObject *obj) { TRACE("%x\n",obj); diff --git a/libmsi/insert.c b/libmsi/insert.c index 9725d04..67c4b16 100644 --- a/libmsi/insert.c +++ b/libmsi/insert.c @@ -37,19 +37,19 @@ /* below is the query interface to a table */ -typedef struct tagMSIINSERTVIEW +typedef struct LibmsiInsertView { - MSIVIEW view; - MSIVIEW *table; - MSIDATABASE *db; + LibmsiView view; + LibmsiView *table; + LibmsiDatabase *db; bool bIsTemp; - MSIVIEW *sv; + LibmsiView *sv; column_info *vals; -} MSIINSERTVIEW; +} LibmsiInsertView; -static unsigned INSERT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned INSERT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; + LibmsiInsertView *iv = (LibmsiInsertView*)view; TRACE("%p %d %d %p\n", iv, row, col, val ); @@ -62,9 +62,9 @@ static unsigned INSERT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, uns * Merge a value_list and a record to create a second record. * Replace wildcard entries in the valuelist with values from the record */ -MSIRECORD *msi_query_merge_record( unsigned fields, const column_info *vl, MSIRECORD *rec ) +LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, LibmsiRecord *rec ) { - MSIRECORD *merged; + LibmsiRecord *merged; unsigned wildcard_count = 1, i; merged = MSI_CreateRecord( fields ); @@ -105,7 +105,7 @@ err: /* checks to see if the column order specified in the INSERT query * matches the column order of the table */ -static bool msi_columns_in_order(MSIINSERTVIEW *iv, unsigned col_count) +static bool msi_columns_in_order(LibmsiInsertView *iv, unsigned col_count) { const WCHAR *a; const WCHAR *b; @@ -124,9 +124,9 @@ static bool msi_columns_in_order(MSIINSERTVIEW *iv, unsigned col_count) /* rearranges the data in the record to be inserted based on column order, * and pads the record for any missing columns in the INSERT query */ -static unsigned msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values) +static unsigned msi_arrange_record(LibmsiInsertView *iv, LibmsiRecord **values) { - MSIRECORD *padded; + LibmsiRecord *padded; unsigned col_count, val_count; unsigned r, i, colidx; const WCHAR *a; @@ -177,7 +177,7 @@ err: return r; } -static bool row_has_null_primary_keys(MSIINSERTVIEW *iv, MSIRECORD *row) +static bool row_has_null_primary_keys(LibmsiInsertView *iv, LibmsiRecord *row) { unsigned r, i, col_count, type; @@ -202,12 +202,12 @@ static bool row_has_null_primary_keys(MSIINSERTVIEW *iv, MSIRECORD *row) return false; } -static unsigned INSERT_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned INSERT_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; + LibmsiInsertView *iv = (LibmsiInsertView*)view; unsigned r, row = -1, col_count = 0; - MSIVIEW *sv; - MSIRECORD *values = NULL; + LibmsiView *sv; + LibmsiRecord *values = NULL; TRACE("%p %p\n", iv, record ); @@ -250,10 +250,10 @@ err: } -static unsigned INSERT_close( MSIVIEW *view ) +static unsigned INSERT_close( LibmsiView *view ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; - MSIVIEW *sv; + LibmsiInsertView *iv = (LibmsiInsertView*)view; + LibmsiView *sv; TRACE("%p\n", iv); @@ -264,10 +264,10 @@ static unsigned INSERT_close( MSIVIEW *view ) return sv->ops->close( sv ); } -static unsigned INSERT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned INSERT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; - MSIVIEW *sv; + LibmsiInsertView *iv = (LibmsiInsertView*)view; + LibmsiView *sv; TRACE("%p %p %p\n", iv, rows, cols ); @@ -278,11 +278,11 @@ static unsigned INSERT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned * return sv->ops->get_dimensions( sv, rows, cols ); } -static unsigned INSERT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned INSERT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; - MSIVIEW *sv; + LibmsiInsertView *iv = (LibmsiInsertView*)view; + LibmsiView *sv; TRACE("%p %d %p %p %p %p\n", iv, n, name, type, temporary, table_name ); @@ -293,19 +293,19 @@ static unsigned INSERT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR * return sv->ops->get_column_info( sv, n, name, type, temporary, table_name ); } -static unsigned INSERT_modify( MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, unsigned row) +static unsigned INSERT_modify( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; + LibmsiInsertView *iv = (LibmsiInsertView*)view; TRACE("%p %d %p\n", iv, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } -static unsigned INSERT_delete( MSIVIEW *view ) +static unsigned INSERT_delete( LibmsiView *view ) { - MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; - MSIVIEW *sv; + LibmsiInsertView *iv = (LibmsiInsertView*)view; + LibmsiView *sv; TRACE("%p\n", iv ); @@ -318,7 +318,7 @@ static unsigned INSERT_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned INSERT_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned INSERT_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -327,7 +327,7 @@ static unsigned INSERT_find_matching_rows( MSIVIEW *view, unsigned col, } -static const MSIVIEWOPS insert_ops = +static const LibmsiViewOPS insert_ops = { INSERT_fetch_int, NULL, @@ -358,12 +358,12 @@ static unsigned count_column_info( const column_info *ci ) return n; } -unsigned INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, +unsigned INSERT_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *columns, column_info *values, bool temp ) { - MSIINSERTVIEW *iv = NULL; + LibmsiInsertView *iv = NULL; unsigned r; - MSIVIEW *tv = NULL, *sv = NULL; + LibmsiView *tv = NULL, *sv = NULL; TRACE("%p\n", iv ); @@ -395,7 +395,7 @@ unsigned INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, iv->vals = values; iv->bIsTemp = temp; iv->sv = sv; - *view = (MSIVIEW*) iv; + *view = (LibmsiView*) iv; return ERROR_SUCCESS; } diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h index 3260419..8f98cdb 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -49,18 +49,18 @@ #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID)) -struct tagMSITABLE; -typedef struct tagMSITABLE MSITABLE; +struct LibmsiTable; +typedef struct LibmsiTable LibmsiTable; struct string_table; typedef struct string_table string_table; -struct tagMSIOBJECT; -typedef struct tagMSIOBJECT MSIOBJECT; +struct LibmsiObject; +typedef struct LibmsiObject LibmsiObject; -typedef VOID (*msihandledestructor)( MSIOBJECT * ); +typedef VOID (*msihandledestructor)( LibmsiObject * ); -struct tagMSIOBJECT +struct LibmsiObject { unsigned magic; unsigned type; @@ -71,9 +71,9 @@ struct tagMSIOBJECT #define MSI_INITIAL_MEDIA_TRANSFORM_OFFSET 10000 #define MSI_INITIAL_MEDIA_TRANSFORM_DISKID 30000 -typedef struct tagMSIDATABASE +typedef struct LibmsiDatabase { - MSIOBJECT hdr; + LibmsiObject hdr; IStorage *storage; string_table *strings; unsigned bytes_per_strref; @@ -85,21 +85,21 @@ typedef struct tagMSIDATABASE struct list tables; struct list transforms; struct list streams; -} MSIDATABASE; +} LibmsiDatabase; -typedef struct tagMSIVIEW MSIVIEW; +typedef struct LibmsiView LibmsiView; -typedef struct tagMSIQUERY +typedef struct LibmsiQuery { - MSIOBJECT hdr; - MSIVIEW *view; + LibmsiObject hdr; + LibmsiView *view; unsigned row; - MSIDATABASE *db; + LibmsiDatabase *db; struct list mem; -} MSIQUERY; +} LibmsiQuery; /* maybe we can use a Variant instead of doing it ourselves? */ -typedef struct tagMSIFIELD +typedef struct LibmsiField { unsigned type; union @@ -109,14 +109,14 @@ typedef struct tagMSIFIELD WCHAR *szwVal; IStream *stream; } u; -} MSIFIELD; +} LibmsiField; -typedef struct tagMSIRECORD +typedef struct LibmsiRecord { - MSIOBJECT hdr; + LibmsiObject hdr; unsigned count; /* as passed to MsiCreateRecord */ - MSIFIELD fields[1]; /* nb. array size is count+1 */ -} MSIRECORD; + LibmsiField fields[1]; /* nb. array size is count+1 */ +} LibmsiRecord; typedef struct _column_info { @@ -128,9 +128,9 @@ typedef struct _column_info struct _column_info *next; } column_info; -typedef const struct tagMSICOLUMNHASHENTRY *MSIITERHANDLE; +typedef const struct LibmsiColumnHashEntry *MSIITERHANDLE; -typedef struct tagMSIVIEWOPS +typedef struct LibmsiViewOPS { /* * fetch_int - reads one integer from {row,col} in the table @@ -141,7 +141,7 @@ typedef struct tagMSIVIEWOPS * To get a string value, query the database's string table with * the integer value returned from this function. */ - unsigned (*fetch_int)( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ); + unsigned (*fetch_int)( LibmsiView *view, unsigned row, unsigned col, unsigned *val ); /* * fetch_stream - gets a stream from {row,col} in the table @@ -149,40 +149,40 @@ typedef struct tagMSIVIEWOPS * This function is similar to fetch_int, except fetches a * stream instead of an integer. */ - unsigned (*fetch_stream)( MSIVIEW *view, unsigned row, unsigned col, IStream **stm ); + unsigned (*fetch_stream)( LibmsiView *view, unsigned row, unsigned col, IStream **stm ); /* * get_row - gets values from a row * */ - unsigned (*get_row)( MSIVIEW *view, unsigned row, MSIRECORD **rec ); + unsigned (*get_row)( LibmsiView *view, unsigned row, LibmsiRecord **rec ); /* * set_row - sets values in a row as specified by mask * * Similar semantics to fetch_int */ - unsigned (*set_row)( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask ); + unsigned (*set_row)( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ); /* * Inserts a new row into the database from the records contents */ - unsigned (*insert_row)( MSIVIEW *view, MSIRECORD *record, unsigned row, bool temporary ); + unsigned (*insert_row)( LibmsiView *view, LibmsiRecord *record, unsigned row, bool temporary ); /* * Deletes a row from the database */ - unsigned (*delete_row)( MSIVIEW *view, unsigned row ); + unsigned (*delete_row)( LibmsiView *view, unsigned row ); /* * execute - loads the underlying data into memory so it can be read */ - unsigned (*execute)( MSIVIEW *view, MSIRECORD *record ); + unsigned (*execute)( LibmsiView *view, LibmsiRecord *record ); /* * close - clears the data read by execute from memory */ - unsigned (*close)( MSIVIEW *view ); + unsigned (*close)( LibmsiView *view ); /* * get_dimensions - returns the number of rows or columns in a table. @@ -190,25 +190,25 @@ typedef struct tagMSIVIEWOPS * The number of rows can only be queried after the execute method * is called. The number of columns can be queried at any time. */ - unsigned (*get_dimensions)( MSIVIEW *view, unsigned *rows, unsigned *cols ); + unsigned (*get_dimensions)( LibmsiView *view, unsigned *rows, unsigned *cols ); /* * get_column_info - returns the name and type of a specific column * * The column information can be queried at any time. */ - unsigned (*get_column_info)( MSIVIEW *view, unsigned n, const WCHAR **name, unsigned *type, + unsigned (*get_column_info)( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ); /* * modify - not yet implemented properly */ - unsigned (*modify)( MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *record, unsigned row ); + unsigned (*modify)( LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *record, unsigned row ); /* * delete - destroys the structure completely */ - unsigned (*delete)( MSIVIEW * ); + unsigned (*delete)( LibmsiView * ); /* * find_matching_rows - iterates through rows that match a value @@ -221,64 +221,64 @@ typedef struct tagMSIVIEWOPS * position in the iteration. It must be initialised to zero before the * first call and continued to be passed in to subsequent calls. */ - unsigned (*find_matching_rows)( MSIVIEW *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ); + unsigned (*find_matching_rows)( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ); /* * add_ref - increases the reference count of the table */ - unsigned (*add_ref)( MSIVIEW *view ); + unsigned (*add_ref)( LibmsiView *view ); /* * release - decreases the reference count of the table */ - unsigned (*release)( MSIVIEW *view ); + unsigned (*release)( LibmsiView *view ); /* * add_column - adds a column to the table */ - unsigned (*add_column)( MSIVIEW *view, const WCHAR *table, unsigned number, const WCHAR *column, unsigned type, bool hold ); + unsigned (*add_column)( LibmsiView *view, const WCHAR *table, unsigned number, const WCHAR *column, unsigned type, bool hold ); /* * remove_column - removes the column represented by table name and column number from the table */ - unsigned (*remove_column)( MSIVIEW *view, const WCHAR *table, unsigned number ); + unsigned (*remove_column)( LibmsiView *view, const WCHAR *table, unsigned number ); /* * sort - orders the table by columns */ - unsigned (*sort)( MSIVIEW *view, column_info *columns ); + unsigned (*sort)( LibmsiView *view, column_info *columns ); /* * drop - drops the table from the database */ - unsigned (*drop)( MSIVIEW *view ); -} MSIVIEWOPS; + unsigned (*drop)( LibmsiView *view ); +} LibmsiViewOPS; -struct tagMSIVIEW +struct LibmsiView { - MSIOBJECT hdr; - const MSIVIEWOPS *ops; - MSIDBERROR error; + LibmsiObject hdr; + const LibmsiViewOPS *ops; + LibmsiDBError error; const WCHAR *error_column; }; #define MSI_MAX_PROPS 20 -typedef struct tagMSISUMMARYINFO +typedef struct LibmsiSummaryInfo { - MSIOBJECT hdr; + LibmsiObject hdr; IStorage *storage; unsigned update_count; PROPVARIANT property[MSI_MAX_PROPS]; -} MSISUMMARYINFO; +} LibmsiSummaryInfo; -#define MSIOBJECTTYPE_ANY 0 -#define MSIOBJECTTYPE_DATABASE 1 -#define MSIOBJECTTYPE_SUMMARYINFO 2 -#define MSIOBJECTTYPE_VIEW 3 -#define MSIOBJECTTYPE_RECORD 4 -#define MSIOBJECTTYPE_PACKAGE 5 -#define MSIOBJECTTYPE_PREVIEW 6 +#define LIBMSI_OBJECT_TYPE_ANY 0 +#define LIBMSI_OBJECT_TYPE_DATABASE 1 +#define LIBMSI_OBJECT_TYPE_SUMMARYINFO 2 +#define LIBMSI_OBJECT_TYPE_VIEW 3 +#define LIBMSI_OBJECT_TYPE_RECORD 4 +#define LIBMSI_OBJECT_TYPE_PACKAGE 5 +#define LIBMSI_OBJECT_TYPE_PREVIEW 6 /* handle unicode/ascii output in the Msi* API functions */ typedef struct { @@ -300,18 +300,18 @@ typedef struct { unsigned msi_strcpy_to_awstring( const WCHAR *str, awstring *awbuf, unsigned *sz ); /* handle functions */ -extern void *msihandle2msiinfo(MSIOBJECT *handle, unsigned type); -extern MSIOBJECT *alloc_msihandle( MSIOBJECT * ); -extern MSIOBJECT *alloc_msi_remote_handle( IUnknown *unk ); +extern void *msihandle2msiinfo(LibmsiObject *handle, unsigned type); +extern LibmsiObject *alloc_msihandle( LibmsiObject * ); +extern LibmsiObject *alloc_msi_remote_handle( IUnknown *unk ); extern void *alloc_msiobject(unsigned type, unsigned size, msihandledestructor destroy ); -extern void msiobj_addref(MSIOBJECT *); -extern int msiobj_release(MSIOBJECT *); -extern void msiobj_lock(MSIOBJECT *); -extern void msiobj_unlock(MSIOBJECT *); +extern void msiobj_addref(LibmsiObject *); +extern int msiobj_release(LibmsiObject *); +extern void msiobj_lock(LibmsiObject *); +extern void msiobj_unlock(LibmsiObject *); extern void msi_free_handle_table(void); -extern void free_cached_tables( MSIDATABASE *db ); -extern unsigned MSI_CommitTables( MSIDATABASE *db ); +extern void free_cached_tables( LibmsiDatabase *db ); +extern unsigned MSI_CommitTables( LibmsiDatabase *db ); /* string table functions */ @@ -331,8 +331,8 @@ extern unsigned msi_save_string_table( const string_table *st, IStorage *storage extern unsigned msi_get_string_table_codepage( const string_table *st ); extern unsigned msi_set_string_table_codepage( string_table *st, unsigned codepage ); -extern bool TABLE_Exists( MSIDATABASE *db, const WCHAR *name ); -extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, const WCHAR *table ); +extern bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ); +extern LibmsiCondition MSI_DatabaseIsTablePersistent( LibmsiDatabase *db, const WCHAR *table ); extern unsigned read_stream_data( IStorage *stg, const WCHAR *stname, bool table, uint8_t **pdata, unsigned *psz ); @@ -340,34 +340,34 @@ extern unsigned write_stream_data( IStorage *stg, const WCHAR *stname, const void *data, unsigned sz, bool bTable ); /* transform functions */ -extern unsigned msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ); -extern unsigned MSI_DatabaseApplyTransformW( MSIDATABASE *db, +extern unsigned msi_table_apply_transform( LibmsiDatabase *db, IStorage *stg ); +extern unsigned MSI_DatabaseApplyTransformW( LibmsiDatabase *db, const WCHAR *szTransformFile, int iErrorCond ); -extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg ); +extern void append_storage_to_db( LibmsiDatabase *db, IStorage *stg ); /* record internals */ -extern void MSI_CloseRecord( MSIOBJECT * ); -extern unsigned MSI_RecordSetIStream( MSIRECORD *, unsigned, IStream *); -extern unsigned MSI_RecordGetIStream( MSIRECORD *, unsigned, IStream **); -extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, unsigned ); -extern MSIRECORD *MSI_CreateRecord( unsigned ); -extern unsigned MSI_RecordSetInteger( MSIRECORD *, unsigned, int ); -extern unsigned MSI_RecordSetIntPtr( MSIRECORD *, unsigned, intptr_t ); -extern unsigned MSI_RecordSetStringW( MSIRECORD *, unsigned, const WCHAR *); -extern bool MSI_RecordIsNull( MSIRECORD *, unsigned ); -extern unsigned MSI_RecordGetStringW( MSIRECORD *, unsigned, WCHAR *, unsigned *); -extern unsigned MSI_RecordGetStringA( MSIRECORD *, unsigned, char *, unsigned *); -extern int MSI_RecordGetInteger( MSIRECORD *, unsigned ); -extern intptr_t MSI_RecordGetIntPtr( MSIRECORD *, unsigned ); -extern unsigned MSI_RecordReadStream( MSIRECORD *, unsigned, char *, unsigned *); -extern unsigned MSI_RecordSetStream(MSIRECORD *, unsigned, IStream *); -extern unsigned MSI_RecordGetFieldCount( const MSIRECORD *rec ); -extern unsigned MSI_RecordStreamToFile( MSIRECORD *, unsigned, const WCHAR *); -extern unsigned MSI_RecordSetStreamFromFileW( MSIRECORD *, unsigned, const WCHAR *); -extern unsigned MSI_RecordCopyField( MSIRECORD *, unsigned, MSIRECORD *, unsigned ); -extern MSIRECORD *MSI_CloneRecord( MSIRECORD * ); -extern bool MSI_RecordsAreEqual( MSIRECORD *, MSIRECORD * ); -extern bool MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, unsigned field); +extern void MSI_CloseRecord( LibmsiObject * ); +extern unsigned MSI_RecordSetIStream( LibmsiRecord *, unsigned, IStream *); +extern unsigned MSI_RecordGetIStream( LibmsiRecord *, unsigned, IStream **); +extern const WCHAR *MSI_RecordGetString( const LibmsiRecord *, unsigned ); +extern LibmsiRecord *MSI_CreateRecord( unsigned ); +extern unsigned MSI_RecordSetInteger( LibmsiRecord *, unsigned, int ); +extern unsigned MSI_RecordSetIntPtr( LibmsiRecord *, unsigned, intptr_t ); +extern unsigned MSI_RecordSetStringW( LibmsiRecord *, unsigned, const WCHAR *); +extern bool MSI_RecordIsNull( LibmsiRecord *, unsigned ); +extern unsigned MSI_RecordGetStringW( LibmsiRecord *, unsigned, WCHAR *, unsigned *); +extern unsigned MSI_RecordGetStringA( LibmsiRecord *, unsigned, char *, unsigned *); +extern int MSI_RecordGetInteger( LibmsiRecord *, unsigned ); +extern intptr_t MSI_RecordGetIntPtr( LibmsiRecord *, unsigned ); +extern unsigned MSI_RecordReadStream( LibmsiRecord *, unsigned, char *, unsigned *); +extern unsigned MSI_RecordSetStream(LibmsiRecord *, unsigned, IStream *); +extern unsigned MSI_RecordGetFieldCount( const LibmsiRecord *rec ); +extern unsigned MSI_RecordStreamToFile( LibmsiRecord *, unsigned, const WCHAR *); +extern unsigned MSI_RecordSetStreamFromFileW( LibmsiRecord *, unsigned, const WCHAR *); +extern unsigned MSI_RecordCopyField( LibmsiRecord *, unsigned, LibmsiRecord *, unsigned ); +extern LibmsiRecord *MSI_CloneRecord( LibmsiRecord * ); +extern bool MSI_RecordsAreEqual( LibmsiRecord *, LibmsiRecord * ); +extern bool MSI_RecordsAreFieldsEqual(LibmsiRecord *a, LibmsiRecord *b, unsigned field); /* stream internals */ extern void enum_stream_names( IStorage *stg ); @@ -375,39 +375,39 @@ extern WCHAR *encode_streamname(bool bTable, const WCHAR *in); extern bool decode_streamname(const WCHAR *in, WCHAR *out); /* database internals */ -extern unsigned msi_get_raw_stream( MSIDATABASE *, const WCHAR *, IStream **); -extern unsigned msi_clone_open_stream( MSIDATABASE *, IStorage *, const WCHAR *, IStream ** ); -void msi_destroy_stream( MSIDATABASE *, const WCHAR * ); -extern unsigned MSI_OpenDatabaseW( const WCHAR *, const WCHAR *, MSIDATABASE **); -extern unsigned MSI_DatabaseOpenViewW(MSIDATABASE *, const WCHAR *, MSIQUERY **); -extern unsigned MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, const WCHAR *, ... ); -typedef unsigned (*record_func)( MSIRECORD *, void *); -extern unsigned MSI_IterateRecords( MSIQUERY *, unsigned *, record_func, void *); -extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, const WCHAR *query, ... ); -extern unsigned MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, const WCHAR *, MSIRECORD **); +extern unsigned msi_get_raw_stream( LibmsiDatabase *, const WCHAR *, IStream **); +extern unsigned msi_clone_open_stream( LibmsiDatabase *, IStorage *, const WCHAR *, IStream ** ); +void msi_destroy_stream( LibmsiDatabase *, const WCHAR * ); +extern unsigned MSI_OpenDatabaseW( const WCHAR *, const WCHAR *, LibmsiDatabase **); +extern unsigned MSI_DatabaseOpenViewW(LibmsiDatabase *, const WCHAR *, LibmsiQuery **); +extern unsigned MSI_OpenQuery( LibmsiDatabase *, LibmsiQuery **, const WCHAR *, ... ); +typedef unsigned (*record_func)( LibmsiRecord *, void *); +extern unsigned MSI_IterateRecords( LibmsiQuery *, unsigned *, record_func, void *); +extern LibmsiRecord *MSI_QueryGetRecord( LibmsiDatabase *db, const WCHAR *query, ... ); +extern unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *, const WCHAR *, LibmsiRecord **); /* view internals */ -extern unsigned MSI_ViewExecute( MSIQUERY*, MSIRECORD * ); -extern unsigned MSI_ViewFetch( MSIQUERY*, MSIRECORD ** ); -extern unsigned MSI_ViewClose( MSIQUERY* ); -extern unsigned MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **); -extern unsigned MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * ); -extern unsigned VIEW_find_column( MSIVIEW *, const WCHAR *, const WCHAR *, unsigned *); -extern unsigned msi_view_get_row(MSIDATABASE *, MSIVIEW *, unsigned, MSIRECORD **); +extern unsigned MSI_ViewExecute( LibmsiQuery*, LibmsiRecord * ); +extern unsigned MSI_ViewFetch( LibmsiQuery*, LibmsiRecord ** ); +extern unsigned MSI_ViewClose( LibmsiQuery* ); +extern unsigned MSI_ViewGetColumnInfo(LibmsiQuery *, LibmsiColInfo, LibmsiRecord **); +extern unsigned MSI_ViewModify( LibmsiQuery *, LibmsiModify, LibmsiRecord * ); +extern unsigned VIEW_find_column( LibmsiView *, const WCHAR *, const WCHAR *, unsigned *); +extern unsigned msi_view_get_row(LibmsiDatabase *, LibmsiView *, unsigned, LibmsiRecord **); /* summary information */ -extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCount ); -extern WCHAR *msi_suminfo_dup_string( MSISUMMARYINFO *si, unsigned uiProperty ); -extern int msi_suminfo_get_int32( MSISUMMARYINFO *si, unsigned uiProperty ); +extern LibmsiSummaryInfo *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCount ); +extern WCHAR *msi_suminfo_dup_string( LibmsiSummaryInfo *si, unsigned uiProperty ); +extern int msi_suminfo_get_int32( LibmsiSummaryInfo *si, unsigned uiProperty ); extern WCHAR *msi_get_suminfo_product( IStorage *stg ); -extern unsigned msi_add_suminfo( MSIDATABASE *db, WCHAR ***records, int num_records, int num_columns ); +extern unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records, int num_columns ); /* Helpers */ -extern WCHAR *msi_dup_record_field(MSIRECORD *row, int index); -extern WCHAR *msi_dup_property( MSIDATABASE *db, const WCHAR *prop ); -extern unsigned msi_set_property( MSIDATABASE *, const WCHAR *, const WCHAR *); -extern unsigned msi_get_property( MSIDATABASE *, const WCHAR *, WCHAR *, unsigned *); -extern int msi_get_property_int( MSIDATABASE *package, const WCHAR *prop, int def ); +extern WCHAR *msi_dup_record_field(LibmsiRecord *row, int index); +extern WCHAR *msi_dup_property( LibmsiDatabase *db, const WCHAR *prop ); +extern unsigned msi_set_property( LibmsiDatabase *, const WCHAR *, const WCHAR *); +extern unsigned msi_get_property( LibmsiDatabase *, const WCHAR *, WCHAR *, unsigned *); +extern int msi_get_property_int( LibmsiDatabase *package, const WCHAR *prop, int def ); /* common strings */ static const WCHAR szSourceDir[] = {'S','o','u','r','c','e','D','i','r',0}; diff --git a/libmsi/msiquery.c b/libmsi/msiquery.c index 8d6ebd2..63d4194 100644 --- a/libmsi/msiquery.c +++ b/libmsi/msiquery.c @@ -39,9 +39,9 @@ #include "initguid.h" -static void MSI_CloseView( MSIOBJECT *arg ) +static void MSI_CloseView( LibmsiObject *arg ) { - MSIQUERY *query = (MSIQUERY*) arg; + LibmsiQuery *query = (LibmsiQuery*) arg; struct list *ptr, *t; if( query->view && query->view->ops->delete ) @@ -54,7 +54,7 @@ static void MSI_CloseView( MSIOBJECT *arg ) } } -unsigned VIEW_find_column( MSIVIEW *table, const WCHAR *name, const WCHAR *table_name, unsigned *n ) +unsigned VIEW_find_column( LibmsiView *table, const WCHAR *name, const WCHAR *table_name, unsigned *n ) { const WCHAR *col_name; const WCHAR *haystack_table_name; @@ -84,8 +84,8 @@ unsigned VIEW_find_column( MSIVIEW *table, const WCHAR *name, const WCHAR *table return ERROR_INVALID_PARAMETER; } -unsigned MsiDatabaseOpenViewA(MSIOBJECT *hdb, - const char *szQuery, MSIOBJECT **phView) +unsigned MsiDatabaseOpenViewA(LibmsiObject *hdb, + const char *szQuery, LibmsiObject **phView) { unsigned r; WCHAR *szwQuery; @@ -107,10 +107,10 @@ unsigned MsiDatabaseOpenViewA(MSIOBJECT *hdb, return r; } -unsigned MSI_DatabaseOpenViewW(MSIDATABASE *db, - const WCHAR *szQuery, MSIQUERY **pView) +unsigned MSI_DatabaseOpenViewW(LibmsiDatabase *db, + const WCHAR *szQuery, LibmsiQuery **pView) { - MSIQUERY *query; + LibmsiQuery *query; unsigned r; TRACE("%s %p\n", debugstr_w(szQuery), pView); @@ -119,7 +119,7 @@ unsigned MSI_DatabaseOpenViewW(MSIDATABASE *db, return ERROR_INVALID_PARAMETER; /* pre allocate a handle to hold a pointer to the view */ - query = alloc_msiobject( MSIOBJECTTYPE_VIEW, sizeof (MSIQUERY), + query = alloc_msiobject( LIBMSI_OBJECT_TYPE_VIEW, sizeof (LibmsiQuery), MSI_CloseView ); if( !query ) return ERROR_FUNCTION_FAILED; @@ -139,7 +139,7 @@ unsigned MSI_DatabaseOpenViewW(MSIDATABASE *db, return r; } -unsigned MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, const WCHAR *fmt, ... ) +unsigned MSI_OpenQuery( LibmsiDatabase *db, LibmsiQuery **view, const WCHAR *fmt, ... ) { unsigned r; int size = 100, res; @@ -164,10 +164,10 @@ unsigned MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, const WCHAR *fmt, ... return r; } -unsigned MSI_IterateRecords( MSIQUERY *view, unsigned *count, +unsigned MSI_IterateRecords( LibmsiQuery *view, unsigned *count, record_func func, void *param ) { - MSIRECORD *rec = NULL; + LibmsiRecord *rec = NULL; unsigned r, n = 0, max = 0; r = MSI_ViewExecute( view, NULL ); @@ -202,10 +202,10 @@ unsigned MSI_IterateRecords( MSIQUERY *view, unsigned *count, } /* return a single record from a query */ -MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, const WCHAR *fmt, ... ) +LibmsiRecord *MSI_QueryGetRecord( LibmsiDatabase *db, const WCHAR *fmt, ... ) { - MSIRECORD *rec = NULL; - MSIQUERY *view = NULL; + LibmsiRecord *rec = NULL; + LibmsiQuery *view = NULL; unsigned r; int size = 100, res; WCHAR *query; @@ -237,16 +237,16 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, const WCHAR *fmt, ... ) return rec; } -unsigned MsiDatabaseOpenViewW(MSIOBJECT *hdb, - const WCHAR *szQuery, MSIOBJECT **phView) +unsigned MsiDatabaseOpenViewW(LibmsiObject *hdb, + const WCHAR *szQuery, LibmsiObject **phView) { - MSIDATABASE *db; - MSIQUERY *query = NULL; + LibmsiDatabase *db; + LibmsiQuery *query = NULL; unsigned ret; TRACE("%s %p\n", debugstr_w(szQuery), phView); - db = msihandle2msiinfo( hdb, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hdb, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; @@ -258,7 +258,7 @@ unsigned MsiDatabaseOpenViewW(MSIOBJECT *hdb, return ret; } -unsigned msi_view_get_row(MSIDATABASE *db, MSIVIEW *view, unsigned row, MSIRECORD **rec) +unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, LibmsiRecord **rec) { unsigned row_count = 0, col_count = 0, i, ival, ret, type; @@ -336,9 +336,9 @@ unsigned msi_view_get_row(MSIDATABASE *db, MSIVIEW *view, unsigned row, MSIRECOR return ERROR_SUCCESS; } -unsigned MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) +unsigned MSI_ViewFetch(LibmsiQuery *query, LibmsiRecord **prec) { - MSIVIEW *view; + LibmsiView *view; unsigned r; TRACE("%p %p\n", query, prec ); @@ -357,10 +357,10 @@ unsigned MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) return r; } -unsigned MsiViewFetch(MSIOBJECT *hView, MSIOBJECT **record) +unsigned MsiViewFetch(LibmsiObject *hView, LibmsiObject **record) { - MSIQUERY *query; - MSIRECORD *rec = NULL; + LibmsiQuery *query; + LibmsiRecord *rec = NULL; unsigned ret; TRACE("%d %p\n", hView, record); @@ -369,7 +369,7 @@ unsigned MsiViewFetch(MSIOBJECT *hView, MSIOBJECT **record) return ERROR_INVALID_PARAMETER; *record = 0; - query = msihandle2msiinfo( hView, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( hView, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) return ERROR_INVALID_HANDLE; ret = MSI_ViewFetch( query, &rec ); @@ -379,9 +379,9 @@ unsigned MsiViewFetch(MSIOBJECT *hView, MSIOBJECT **record) return ret; } -unsigned MSI_ViewClose(MSIQUERY *query) +unsigned MSI_ViewClose(LibmsiQuery *query) { - MSIVIEW *view; + LibmsiView *view; TRACE("%p\n", query ); @@ -394,14 +394,14 @@ unsigned MSI_ViewClose(MSIQUERY *query) return view->ops->close( view ); } -unsigned MsiViewClose(MSIOBJECT *hView) +unsigned MsiViewClose(LibmsiObject *hView) { - MSIQUERY *query; + LibmsiQuery *query; unsigned ret; TRACE("%d\n", hView ); - query = msihandle2msiinfo( hView, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( hView, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) return ERROR_INVALID_HANDLE; @@ -410,9 +410,9 @@ unsigned MsiViewClose(MSIOBJECT *hView) return ret; } -unsigned MSI_ViewExecute(MSIQUERY *query, MSIRECORD *rec ) +unsigned MSI_ViewExecute(LibmsiQuery *query, LibmsiRecord *rec ) { - MSIVIEW *view; + LibmsiView *view; TRACE("%p %p\n", query, rec); @@ -426,21 +426,21 @@ unsigned MSI_ViewExecute(MSIQUERY *query, MSIRECORD *rec ) return view->ops->execute( view, rec ); } -unsigned MsiViewExecute(MSIOBJECT *hView, MSIOBJECT *hRec) +unsigned MsiViewExecute(LibmsiObject *hView, LibmsiObject *hRec) { - MSIQUERY *query; - MSIRECORD *rec = NULL; + LibmsiQuery *query; + LibmsiRecord *rec = NULL; unsigned ret; TRACE("%d %d\n", hView, hRec); - query = msihandle2msiinfo( hView, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( hView, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) return ERROR_INVALID_HANDLE; if( hRec ) { - rec = msihandle2msiinfo( hRec, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( hRec, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) { ret = ERROR_INVALID_HANDLE; @@ -460,7 +460,7 @@ out: return ret; } -static unsigned msi_set_record_type_string( MSIRECORD *rec, unsigned field, +static unsigned msi_set_record_type_string( LibmsiRecord *rec, unsigned field, unsigned type, bool temporary ) { static const WCHAR fmt[] = { '%','d',0 }; @@ -497,11 +497,11 @@ static unsigned msi_set_record_type_string( MSIRECORD *rec, unsigned field, return MSI_RecordSetStringW( rec, field, szType ); } -unsigned MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec ) +unsigned MSI_ViewGetColumnInfo( LibmsiQuery *query, LibmsiColInfo info, LibmsiRecord **prec ) { unsigned r = ERROR_FUNCTION_FAILED, i, count = 0, type; - MSIRECORD *rec; - MSIVIEW *view = query->view; + LibmsiRecord *rec; + LibmsiView *view = query->view; const WCHAR *name; bool temporary; @@ -527,7 +527,7 @@ unsigned MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **pr r = view->ops->get_column_info( view, i+1, &name, &type, &temporary, NULL ); if( r != ERROR_SUCCESS ) continue; - if (info == MSICOLINFO_NAMES) + if (info == LIBMSI_COL_INFO_NAMES) MSI_RecordSetStringW( rec, i+1, name ); else msi_set_record_type_string( rec, i+1, type, temporary ); @@ -536,10 +536,10 @@ unsigned MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **pr return ERROR_SUCCESS; } -unsigned MsiViewGetColumnInfo(MSIOBJECT *hView, MSICOLINFO info, MSIOBJECT **hRec) +unsigned MsiViewGetColumnInfo(LibmsiObject *hView, LibmsiColInfo info, LibmsiObject **hRec) { - MSIQUERY *query = NULL; - MSIRECORD *rec = NULL; + LibmsiQuery *query = NULL; + LibmsiRecord *rec = NULL; unsigned r; TRACE("%d %d %p\n", hView, info, hRec); @@ -547,10 +547,10 @@ unsigned MsiViewGetColumnInfo(MSIOBJECT *hView, MSICOLINFO info, MSIOBJECT **hRe if( !hRec ) return ERROR_INVALID_PARAMETER; - if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES ) + if( info != LIBMSI_COL_INFO_NAMES && info != LIBMSI_COL_INFO_TYPES ) return ERROR_INVALID_PARAMETER; - query = msihandle2msiinfo( hView, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( hView, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) return ERROR_INVALID_HANDLE; @@ -563,9 +563,9 @@ unsigned MsiViewGetColumnInfo(MSIOBJECT *hView, MSICOLINFO info, MSIOBJECT **hRe return r; } -unsigned MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) +unsigned MSI_ViewModify( LibmsiQuery *query, LibmsiModify mode, LibmsiRecord *rec ) { - MSIVIEW *view = NULL; + LibmsiView *view = NULL; unsigned r; if ( !query || !rec ) @@ -575,30 +575,30 @@ unsigned MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) if ( !view || !view->ops->modify) return ERROR_FUNCTION_FAILED; - if ( mode == MSIMODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (intptr_t)query ) + if ( mode == LIBMSI_MODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (intptr_t)query ) return ERROR_FUNCTION_FAILED; r = view->ops->modify( view, mode, rec, query->row ); - if (mode == MSIMODIFY_DELETE && r == ERROR_SUCCESS) + if (mode == LIBMSI_MODIFY_DELETE && r == ERROR_SUCCESS) query->row--; return r; } -unsigned MsiViewModify( MSIOBJECT *hView, MSIMODIFY eModifyMode, - MSIOBJECT *hRecord) +unsigned MsiViewModify( LibmsiObject *hView, LibmsiModify eModifyMode, + LibmsiObject *hRecord) { - MSIQUERY *query = NULL; - MSIRECORD *rec = NULL; + LibmsiQuery *query = NULL; + LibmsiRecord *rec = NULL; unsigned r = ERROR_FUNCTION_FAILED; TRACE("%d %x %d\n", hView, eModifyMode, hRecord); - query = msihandle2msiinfo( hView, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( hView, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) return ERROR_INVALID_HANDLE; - rec = msihandle2msiinfo( hRecord, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( hRecord, LIBMSI_OBJECT_TYPE_RECORD ); r = MSI_ViewModify( query, eModifyMode, rec ); msiobj_release( &query->hdr ); @@ -608,21 +608,21 @@ unsigned MsiViewModify( MSIOBJECT *hView, MSIMODIFY eModifyMode, return r; } -MSIDBERROR MsiViewGetErrorW( MSIOBJECT *handle, WCHAR *buffer, unsigned *buflen ) +LibmsiDBError MsiViewGetErrorW( LibmsiObject *handle, WCHAR *buffer, unsigned *buflen ) { - MSIQUERY *query; + LibmsiQuery *query; const WCHAR *column; - MSIDBERROR r; + LibmsiDBError r; unsigned len; TRACE("%u %p %p\n", handle, buffer, buflen); if (!buflen) - return MSIDBERROR_INVALIDARG; + return LIBMSI_DB_ERROR_INVALIDARG; - query = msihandle2msiinfo( handle, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_VIEW ); if( !query ) - return MSIDBERROR_INVALIDARG; + return LIBMSI_DB_ERROR_INVALIDARG; if ((r = query->view->error)) column = query->view->error_column; else column = szEmpty; @@ -633,28 +633,28 @@ MSIDBERROR MsiViewGetErrorW( MSIOBJECT *handle, WCHAR *buffer, unsigned *buflen if (*buflen > len) strcpyW( buffer, column ); else - r = MSIDBERROR_MOREDATA; + r = LIBMSI_DB_ERROR_MOREDATA; } *buflen = len; msiobj_release( &query->hdr ); return r; } -MSIDBERROR MsiViewGetErrorA( MSIOBJECT *handle, char *buffer, unsigned *buflen ) +LibmsiDBError MsiViewGetErrorA( LibmsiObject *handle, char *buffer, unsigned *buflen ) { - MSIQUERY *query; + LibmsiQuery *query; const WCHAR *column; - MSIDBERROR r; + LibmsiDBError r; unsigned len; TRACE("%u %p %p\n", handle, buffer, buflen); if (!buflen) - return MSIDBERROR_INVALIDARG; + return LIBMSI_DB_ERROR_INVALIDARG; - query = msihandle2msiinfo( handle, MSIOBJECTTYPE_VIEW ); + query = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_VIEW ); if (!query) - return MSIDBERROR_INVALIDARG; + return LIBMSI_DB_ERROR_INVALIDARG; if ((r = query->view->error)) column = query->view->error_column; else column = szEmpty; @@ -665,20 +665,20 @@ MSIDBERROR MsiViewGetErrorA( MSIOBJECT *handle, char *buffer, unsigned *buflen ) if (*buflen >= len) WideCharToMultiByte( CP_ACP, 0, column, -1, buffer, *buflen, NULL, NULL ); else - r = MSIDBERROR_MOREDATA; + r = LIBMSI_DB_ERROR_MOREDATA; } *buflen = len - 1; msiobj_release( &query->hdr ); return r; } -MSIOBJECT * MsiGetLastErrorRecord( void ) +LibmsiObject * MsiGetLastErrorRecord( void ) { FIXME("\n"); return 0; } -unsigned MSI_DatabaseApplyTransformW( MSIDATABASE *db, +unsigned MSI_DatabaseApplyTransformW( LibmsiDatabase *db, const WCHAR *szTransformFile, int iErrorCond ) { HRESULT r; @@ -714,13 +714,13 @@ end: return ret; } -unsigned MsiDatabaseApplyTransformW( MSIOBJECT *hdb, +unsigned MsiDatabaseApplyTransformW( LibmsiObject *hdb, const WCHAR *szTransformFile, int iErrorCond) { - MSIDATABASE *db; + LibmsiDatabase *db; unsigned r; - db = msihandle2msiinfo( hdb, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hdb, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; r = MSI_DatabaseApplyTransformW( db, szTransformFile, iErrorCond ); @@ -728,7 +728,7 @@ unsigned MsiDatabaseApplyTransformW( MSIOBJECT *hdb, return r; } -unsigned MsiDatabaseApplyTransformA( MSIOBJECT *hdb, +unsigned MsiDatabaseApplyTransformA( LibmsiObject *hdb, const char *szTransformFile, int iErrorCond) { WCHAR *wstr; @@ -747,18 +747,18 @@ unsigned MsiDatabaseApplyTransformA( MSIOBJECT *hdb, return ret; } -unsigned MsiDatabaseCommit( MSIOBJECT *hdb ) +unsigned MsiDatabaseCommit( LibmsiObject *hdb ) { - MSIDATABASE *db; + LibmsiDatabase *db; unsigned r; TRACE("%d\n", hdb); - db = msihandle2msiinfo( hdb, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hdb, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; - if (db->mode == MSIDBOPEN_READONLY) + if (db->mode == LIBMSI_DB_OPEN_READONLY) { msiobj_release( &db->hdr ); return ERROR_SUCCESS; @@ -785,10 +785,10 @@ unsigned MsiDatabaseCommit( MSIOBJECT *hdb ) struct msi_primary_key_record_info { unsigned n; - MSIRECORD *rec; + LibmsiRecord *rec; }; -static unsigned msi_primary_key_iterator( MSIRECORD *rec, void *param ) +static unsigned msi_primary_key_iterator( LibmsiRecord *rec, void *param ) { struct msi_primary_key_record_info *info = param; const WCHAR *name; @@ -815,8 +815,8 @@ static unsigned msi_primary_key_iterator( MSIRECORD *rec, void *param ) return ERROR_SUCCESS; } -unsigned MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, - const WCHAR *table, MSIRECORD **prec ) +unsigned MSI_DatabaseGetPrimaryKeys( LibmsiDatabase *db, + const WCHAR *table, LibmsiRecord **prec ) { static const WCHAR sql[] = { 's','e','l','e','c','t',' ','*',' ', @@ -824,7 +824,7 @@ unsigned MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, 'w','h','e','r','e',' ', '`','T','a','b','l','e','`',' ','=',' ','\'','%','s','\'',0 }; struct msi_primary_key_record_info info; - MSIQUERY *query = NULL; + LibmsiQuery *query = NULL; unsigned r; if (!TABLE_Exists( db, table )) @@ -856,16 +856,16 @@ unsigned MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, return r; } -unsigned MsiDatabaseGetPrimaryKeysW( MSIOBJECT *hdb, - const WCHAR *table, MSIOBJECT **phRec ) +unsigned MsiDatabaseGetPrimaryKeysW( LibmsiObject *hdb, + const WCHAR *table, LibmsiObject **phRec ) { - MSIRECORD *rec = NULL; - MSIDATABASE *db; + LibmsiRecord *rec = NULL; + LibmsiDatabase *db; unsigned r; TRACE("%d %s %p\n", hdb, debugstr_w(table), phRec); - db = msihandle2msiinfo( hdb, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hdb, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; @@ -877,8 +877,8 @@ unsigned MsiDatabaseGetPrimaryKeysW( MSIOBJECT *hdb, return r; } -unsigned MsiDatabaseGetPrimaryKeysA(MSIOBJECT *hdb, - const char *table, MSIOBJECT **phRec) +unsigned MsiDatabaseGetPrimaryKeysA(LibmsiObject *hdb, + const char *table, LibmsiObject **phRec) { WCHAR *szwTable = NULL; unsigned r; @@ -897,11 +897,11 @@ unsigned MsiDatabaseGetPrimaryKeysA(MSIOBJECT *hdb, return r; } -MSICONDITION MsiDatabaseIsTablePersistentA( - MSIOBJECT *hDatabase, const char *szTableName) +LibmsiCondition MsiDatabaseIsTablePersistentA( + LibmsiObject *hDatabase, const char *szTableName) { WCHAR *szwTableName = NULL; - MSICONDITION r; + LibmsiCondition r; TRACE("%x %s\n", hDatabase, debugstr_a(szTableName)); @@ -909,7 +909,7 @@ MSICONDITION MsiDatabaseIsTablePersistentA( { szwTableName = strdupAtoW( szTableName ); if( !szwTableName ) - return MSICONDITION_ERROR; + return LIBMSI_CONDITION_ERROR; } r = MsiDatabaseIsTablePersistentW( hDatabase, szwTableName ); msi_free( szwTableName ); @@ -917,17 +917,17 @@ MSICONDITION MsiDatabaseIsTablePersistentA( return r; } -MSICONDITION MsiDatabaseIsTablePersistentW( - MSIOBJECT *hDatabase, const WCHAR *szTableName) +LibmsiCondition MsiDatabaseIsTablePersistentW( + LibmsiObject *hDatabase, const WCHAR *szTableName) { - MSIDATABASE *db; - MSICONDITION r; + LibmsiDatabase *db; + LibmsiCondition r; TRACE("%x %s\n", hDatabase, debugstr_w(szTableName)); - db = msihandle2msiinfo( hDatabase, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hDatabase, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) - return MSICONDITION_ERROR; + return LIBMSI_CONDITION_ERROR; r = MSI_DatabaseIsTablePersistent( db, szTableName ); diff --git a/libmsi/query.h b/libmsi/query.h index 8a58a8a..18a53f0 100644 --- a/libmsi/query.h +++ b/libmsi/query.h @@ -97,47 +97,47 @@ struct expr } u; }; -unsigned MSI_ParseSQL( MSIDATABASE *db, const WCHAR *command, MSIVIEW **phview, +unsigned MSI_ParseSQL( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, struct list *mem ); -unsigned TABLE_CreateView( MSIDATABASE *db, const WCHAR *name, MSIVIEW **view ); +unsigned TABLE_CreateView( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ); -unsigned SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, +unsigned SELECT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, const column_info *columns ); -unsigned DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ); +unsigned DISTINCT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); -unsigned ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, +unsigned ORDER_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, column_info *columns ); -unsigned WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *tables, +unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, struct expr *cond ); -unsigned CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, +unsigned CREATE_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *col_info, bool hold ); -unsigned INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *table, +unsigned INSERT_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *table, column_info *columns, column_info *values, bool temp ); -unsigned UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *table, +unsigned UPDATE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, column_info *list, struct expr *expr ); -unsigned DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ); +unsigned DELETE_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table ); -unsigned ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *name, column_info *colinfo, int hold ); +unsigned ALTER_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name, column_info *colinfo, int hold ); -unsigned STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ); +unsigned STREAMS_CreateView( LibmsiDatabase *db, LibmsiView **view ); -unsigned STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view ); +unsigned STORAGES_CreateView( LibmsiDatabase *db, LibmsiView **view ); -unsigned DROP_CreateView( MSIDATABASE *db, MSIVIEW **view, const WCHAR *name ); +unsigned DROP_CreateView( LibmsiDatabase *db, LibmsiView **view, const WCHAR *name ); int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip); -MSIRECORD *msi_query_merge_record( unsigned fields, const column_info *vl, MSIRECORD *rec ); +LibmsiRecord *msi_query_merge_record( unsigned fields, const column_info *vl, LibmsiRecord *rec ); -unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_info, - MSICONDITION persistent ); +unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *col_info, + LibmsiCondition persistent ); #pragma GCC visibility pop diff --git a/libmsi/record.c b/libmsi/record.c index 79bf373..4f6ba9b 100644 --- a/libmsi/record.c +++ b/libmsi/record.c @@ -38,24 +38,24 @@ #include "query.h" -#define MSIFIELD_NULL 0 -#define MSIFIELD_INT 1 -#define MSIFIELD_WSTR 3 -#define MSIFIELD_STREAM 4 -#define MSIFIELD_INTPTR 5 +#define LIBMSI_FIELD_TYPE_NULL 0 +#define LIBMSI_FIELD_TYPE_INT 1 +#define LIBMSI_FIELD_TYPE_WSTR 3 +#define LIBMSI_FIELD_TYPE_STREAM 4 +#define LIBMSI_FIELD_TYPE_INTPTR 5 -static void MSI_FreeField( MSIFIELD *field ) +static void MSI_FreeField( LibmsiField *field ) { switch( field->type ) { - case MSIFIELD_NULL: - case MSIFIELD_INT: - case MSIFIELD_INTPTR: + case LIBMSI_FIELD_TYPE_NULL: + case LIBMSI_FIELD_TYPE_INT: + case LIBMSI_FIELD_TYPE_INTPTR: break; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: msi_free( field->u.szwVal); break; - case MSIFIELD_STREAM: + case LIBMSI_FIELD_TYPE_STREAM: IStream_Release( field->u.stream ); break; default: @@ -63,18 +63,18 @@ static void MSI_FreeField( MSIFIELD *field ) } } -void MSI_CloseRecord( MSIOBJECT *arg ) +void MSI_CloseRecord( LibmsiObject *arg ) { - MSIRECORD *rec = (MSIRECORD *) arg; + LibmsiRecord *rec = (LibmsiRecord *) arg; unsigned i; for( i=0; i<=rec->count; i++ ) MSI_FreeField( &rec->fields[i] ); } -MSIRECORD *MSI_CreateRecord( unsigned cParams ) +LibmsiRecord *MSI_CreateRecord( unsigned cParams ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned len; TRACE("%d\n", cParams); @@ -82,16 +82,16 @@ MSIRECORD *MSI_CreateRecord( unsigned cParams ) if( cParams>65535 ) return NULL; - len = sizeof (MSIRECORD) + sizeof (MSIFIELD)*cParams; - rec = alloc_msiobject( MSIOBJECTTYPE_RECORD, len, MSI_CloseRecord ); + len = sizeof (LibmsiRecord) + sizeof (LibmsiField)*cParams; + rec = alloc_msiobject( LIBMSI_OBJECT_TYPE_RECORD, len, MSI_CloseRecord ); if( rec ) rec->count = cParams; return rec; } -MSIOBJECT * MsiCreateRecord( unsigned cParams ) +LibmsiObject * MsiCreateRecord( unsigned cParams ) { - MSIRECORD *rec; + LibmsiRecord *rec; TRACE("%d\n", cParams); @@ -99,19 +99,19 @@ MSIOBJECT * MsiCreateRecord( unsigned cParams ) return &rec->hdr; } -unsigned MSI_RecordGetFieldCount( const MSIRECORD *rec ) +unsigned MSI_RecordGetFieldCount( const LibmsiRecord *rec ) { return rec->count; } -unsigned MsiRecordGetFieldCount( MSIOBJECT *handle ) +unsigned MsiRecordGetFieldCount( LibmsiObject *handle ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d\n", handle ); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return -1; @@ -146,8 +146,8 @@ static bool string2intW( const WCHAR *str, int *out ) return true; } -unsigned MSI_RecordCopyField( MSIRECORD *in_rec, unsigned in_n, - MSIRECORD *out_rec, unsigned out_n ) +unsigned MSI_RecordCopyField( LibmsiRecord *in_rec, unsigned in_n, + LibmsiRecord *out_rec, unsigned out_n ) { unsigned r = ERROR_SUCCESS; @@ -158,29 +158,29 @@ unsigned MSI_RecordCopyField( MSIRECORD *in_rec, unsigned in_n, else if ( in_rec != out_rec || in_n != out_n ) { WCHAR *str; - MSIFIELD *in, *out; + LibmsiField *in, *out; in = &in_rec->fields[in_n]; out = &out_rec->fields[out_n]; switch ( in->type ) { - case MSIFIELD_NULL: + case LIBMSI_FIELD_TYPE_NULL: break; - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: out->u.iVal = in->u.iVal; break; - case MSIFIELD_INTPTR: + case LIBMSI_FIELD_TYPE_INTPTR: out->u.pVal = in->u.pVal; break; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: str = strdupW( in->u.szwVal ); if ( !str ) r = ERROR_OUTOFMEMORY; else out->u.szwVal = str; break; - case MSIFIELD_STREAM: + case LIBMSI_FIELD_TYPE_STREAM: IStream_AddRef( in->u.stream ); out->u.stream = in->u.stream; break; @@ -196,7 +196,7 @@ unsigned MSI_RecordCopyField( MSIRECORD *in_rec, unsigned in_n, return r; } -intptr_t MSI_RecordGetIntPtr( MSIRECORD *rec, unsigned iField ) +intptr_t MSI_RecordGetIntPtr( LibmsiRecord *rec, unsigned iField ) { int ret; @@ -207,11 +207,11 @@ intptr_t MSI_RecordGetIntPtr( MSIRECORD *rec, unsigned iField ) switch( rec->fields[iField].type ) { - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: + case LIBMSI_FIELD_TYPE_INTPTR: return rec->fields[iField].u.pVal; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) return ret; return INTPTR_MIN; @@ -222,7 +222,7 @@ intptr_t MSI_RecordGetIntPtr( MSIRECORD *rec, unsigned iField ) return INTPTR_MIN; } -int MSI_RecordGetInteger( MSIRECORD *rec, unsigned iField) +int MSI_RecordGetInteger( LibmsiRecord *rec, unsigned iField) { int ret = 0; @@ -233,11 +233,11 @@ int MSI_RecordGetInteger( MSIRECORD *rec, unsigned iField) switch( rec->fields[iField].type ) { - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: + case LIBMSI_FIELD_TYPE_INTPTR: return rec->fields[iField].u.pVal; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) return ret; return MSI_NULL_INTEGER; @@ -248,14 +248,14 @@ int MSI_RecordGetInteger( MSIRECORD *rec, unsigned iField) return MSI_NULL_INTEGER; } -int MsiRecordGetInteger( MSIOBJECT *handle, unsigned iField) +int MsiRecordGetInteger( LibmsiObject *handle, unsigned iField) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d\n", handle, iField ); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return MSI_NULL_INTEGER; @@ -267,14 +267,14 @@ int MsiRecordGetInteger( MSIOBJECT *handle, unsigned iField) return ret; } -unsigned MsiRecordClearData( MSIOBJECT *handle ) +unsigned MsiRecordClearData( LibmsiObject *handle ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned i; TRACE("%d\n", handle ); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; @@ -282,7 +282,7 @@ unsigned MsiRecordClearData( MSIOBJECT *handle ) for( i=0; i<=rec->count; i++) { MSI_FreeField( &rec->fields[i] ); - rec->fields[i].type = MSIFIELD_NULL; + rec->fields[i].type = LIBMSI_FIELD_TYPE_NULL; rec->fields[i].u.iVal = 0; } msiobj_unlock( &rec->hdr ); @@ -291,7 +291,7 @@ unsigned MsiRecordClearData( MSIOBJECT *handle ) return ERROR_SUCCESS; } -unsigned MSI_RecordSetIntPtr( MSIRECORD *rec, unsigned iField, intptr_t pVal ) +unsigned MSI_RecordSetIntPtr( LibmsiRecord *rec, unsigned iField, intptr_t pVal ) { TRACE("%p %u %ld\n", rec, iField, pVal); @@ -299,13 +299,13 @@ unsigned MSI_RecordSetIntPtr( MSIRECORD *rec, unsigned iField, intptr_t pVal ) return ERROR_INVALID_PARAMETER; MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_INTPTR; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_INTPTR; rec->fields[iField].u.pVal = pVal; return ERROR_SUCCESS; } -unsigned MSI_RecordSetInteger( MSIRECORD *rec, unsigned iField, int iVal ) +unsigned MSI_RecordSetInteger( LibmsiRecord *rec, unsigned iField, int iVal ) { TRACE("%p %u %d\n", rec, iField, iVal); @@ -313,20 +313,20 @@ unsigned MSI_RecordSetInteger( MSIRECORD *rec, unsigned iField, int iVal ) return ERROR_INVALID_PARAMETER; MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_INT; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_INT; rec->fields[iField].u.iVal = iVal; return ERROR_SUCCESS; } -unsigned MsiRecordSetInteger( MSIOBJECT *handle, unsigned iField, int iVal ) +unsigned MsiRecordSetInteger( LibmsiObject *handle, unsigned iField, int iVal ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %u %d\n", handle, iField, iVal); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; @@ -337,26 +337,26 @@ unsigned MsiRecordSetInteger( MSIOBJECT *handle, unsigned iField, int iVal ) return ret; } -bool MSI_RecordIsNull( MSIRECORD *rec, unsigned iField ) +bool MSI_RecordIsNull( LibmsiRecord *rec, unsigned iField ) { bool r = true; TRACE("%p %d\n", rec, iField ); r = ( iField > rec->count ) || - ( rec->fields[iField].type == MSIFIELD_NULL ); + ( rec->fields[iField].type == LIBMSI_FIELD_TYPE_NULL ); return r; } -bool MsiRecordIsNull( MSIOBJECT *handle, unsigned iField ) +bool MsiRecordIsNull( LibmsiObject *handle, unsigned iField ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d\n", handle, iField ); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return 0; msiobj_lock( &rec->hdr ); @@ -367,7 +367,7 @@ bool MsiRecordIsNull( MSIOBJECT *handle, unsigned iField ) } -unsigned MSI_RecordGetStringA(MSIRECORD *rec, unsigned iField, +unsigned MSI_RecordGetStringA(LibmsiRecord *rec, unsigned iField, char *szValue, unsigned *pcchValue) { unsigned len=0, ret; @@ -387,13 +387,13 @@ unsigned MSI_RecordGetStringA(MSIRECORD *rec, unsigned iField, ret = ERROR_SUCCESS; switch( rec->fields[iField].type ) { - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: wsprintfA(buffer, "%d", rec->fields[iField].u.iVal); len = lstrlenA( buffer ); if (szValue) lstrcpynA(szValue, buffer, *pcchValue); break; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: len = WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1, NULL, 0 , NULL, NULL); if (szValue) @@ -404,7 +404,7 @@ unsigned MSI_RecordGetStringA(MSIRECORD *rec, unsigned iField, if( len ) len--; break; - case MSIFIELD_NULL: + case LIBMSI_FIELD_TYPE_NULL: if( szValue && *pcchValue > 0 ) szValue[0] = 0; break; @@ -420,15 +420,15 @@ unsigned MSI_RecordGetStringA(MSIRECORD *rec, unsigned iField, return ret; } -unsigned MsiRecordGetStringA(MSIOBJECT *handle, unsigned iField, +unsigned MsiRecordGetStringA(LibmsiObject *handle, unsigned iField, char *szValue, unsigned *pcchValue) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %p %p\n", handle, iField, szValue, pcchValue); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; msiobj_lock( &rec->hdr ); @@ -438,18 +438,18 @@ unsigned MsiRecordGetStringA(MSIOBJECT *handle, unsigned iField, return ret; } -const WCHAR *MSI_RecordGetString( const MSIRECORD *rec, unsigned iField ) +const WCHAR *MSI_RecordGetString( const LibmsiRecord *rec, unsigned iField ) { if( iField > rec->count ) return NULL; - if( rec->fields[iField].type != MSIFIELD_WSTR ) + if( rec->fields[iField].type != LIBMSI_FIELD_TYPE_WSTR ) return NULL; return rec->fields[iField].u.szwVal; } -unsigned MSI_RecordGetStringW(MSIRECORD *rec, unsigned iField, +unsigned MSI_RecordGetStringW(LibmsiRecord *rec, unsigned iField, WCHAR *szValue, unsigned *pcchValue) { unsigned len=0, ret; @@ -470,18 +470,18 @@ unsigned MSI_RecordGetStringW(MSIRECORD *rec, unsigned iField, ret = ERROR_SUCCESS; switch( rec->fields[iField].type ) { - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: wsprintfW(buffer, szFormat, rec->fields[iField].u.iVal); len = lstrlenW( buffer ); if (szValue) lstrcpynW(szValue, buffer, *pcchValue); break; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: len = lstrlenW( rec->fields[iField].u.szwVal ); if (szValue) lstrcpynW(szValue, rec->fields[iField].u.szwVal, *pcchValue); break; - case MSIFIELD_NULL: + case LIBMSI_FIELD_TYPE_NULL: if( szValue && *pcchValue > 0 ) szValue[0] = 0; break; @@ -496,15 +496,15 @@ unsigned MSI_RecordGetStringW(MSIRECORD *rec, unsigned iField, return ret; } -unsigned MsiRecordGetStringW(MSIOBJECT *handle, unsigned iField, +unsigned MsiRecordGetStringW(LibmsiObject *handle, unsigned iField, WCHAR *szValue, unsigned *pcchValue) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %p %p\n", handle, iField, szValue, pcchValue); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; @@ -526,7 +526,7 @@ static unsigned msi_get_stream_size( IStream *stm ) return stat.cbSize.QuadPart; } -static unsigned MSI_RecordDataSize(MSIRECORD *rec, unsigned iField) +static unsigned MSI_RecordDataSize(LibmsiRecord *rec, unsigned iField) { TRACE("%p %d\n", rec, iField); @@ -535,26 +535,26 @@ static unsigned MSI_RecordDataSize(MSIRECORD *rec, unsigned iField) switch( rec->fields[iField].type ) { - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: return sizeof (int); - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: return lstrlenW( rec->fields[iField].u.szwVal ); - case MSIFIELD_NULL: + case LIBMSI_FIELD_TYPE_NULL: break; - case MSIFIELD_STREAM: + case LIBMSI_FIELD_TYPE_STREAM: return msi_get_stream_size( rec->fields[iField].u.stream ); } return 0; } -unsigned MsiRecordDataSize(MSIOBJECT *handle, unsigned iField) +unsigned MsiRecordDataSize(LibmsiObject *handle, unsigned iField) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d\n", handle, iField); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return 0; msiobj_lock( &rec->hdr ); @@ -564,7 +564,7 @@ unsigned MsiRecordDataSize(MSIOBJECT *handle, unsigned iField) return ret; } -static unsigned MSI_RecordSetStringA( MSIRECORD *rec, unsigned iField, const char *szValue ) +static unsigned MSI_RecordSetStringA( LibmsiRecord *rec, unsigned iField, const char *szValue ) { WCHAR *str; @@ -577,26 +577,26 @@ static unsigned MSI_RecordSetStringA( MSIRECORD *rec, unsigned iField, const cha if( szValue && szValue[0] ) { str = strdupAtoW( szValue ); - rec->fields[iField].type = MSIFIELD_WSTR; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_WSTR; rec->fields[iField].u.szwVal = str; } else { - rec->fields[iField].type = MSIFIELD_NULL; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_NULL; rec->fields[iField].u.szwVal = NULL; } return 0; } -unsigned MsiRecordSetStringA( MSIOBJECT *handle, unsigned iField, const char *szValue ) +unsigned MsiRecordSetStringA( LibmsiObject *handle, unsigned iField, const char *szValue ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %s\n", handle, iField, debugstr_a(szValue)); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; msiobj_lock( &rec->hdr ); @@ -606,7 +606,7 @@ unsigned MsiRecordSetStringA( MSIOBJECT *handle, unsigned iField, const char *sz return ret; } -unsigned MSI_RecordSetStringW( MSIRECORD *rec, unsigned iField, const WCHAR *szValue ) +unsigned MSI_RecordSetStringW( LibmsiRecord *rec, unsigned iField, const WCHAR *szValue ) { WCHAR *str; @@ -620,26 +620,26 @@ unsigned MSI_RecordSetStringW( MSIRECORD *rec, unsigned iField, const WCHAR *szV if( szValue && szValue[0] ) { str = strdupW( szValue ); - rec->fields[iField].type = MSIFIELD_WSTR; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_WSTR; rec->fields[iField].u.szwVal = str; } else { - rec->fields[iField].type = MSIFIELD_NULL; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_NULL; rec->fields[iField].u.szwVal = NULL; } return 0; } -unsigned MsiRecordSetStringW( MSIOBJECT *handle, unsigned iField, const WCHAR *szValue ) +unsigned MsiRecordSetStringW( LibmsiObject *handle, unsigned iField, const WCHAR *szValue ) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %s\n", handle, iField, debugstr_w(szValue)); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; @@ -700,19 +700,19 @@ static unsigned RECORD_StreamFromFile(const WCHAR *szFile, IStream **pstm) return ERROR_SUCCESS; } -unsigned MSI_RecordSetStream(MSIRECORD *rec, unsigned iField, IStream *stream) +unsigned MSI_RecordSetStream(LibmsiRecord *rec, unsigned iField, IStream *stream) { if ( (iField == 0) || (iField > rec->count) ) return ERROR_INVALID_PARAMETER; MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_STREAM; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_STREAM; rec->fields[iField].u.stream = stream; return ERROR_SUCCESS; } -unsigned MSI_RecordSetStreamFromFileW(MSIRECORD *rec, unsigned iField, const WCHAR *szFilename) +unsigned MSI_RecordSetStreamFromFileW(LibmsiRecord *rec, unsigned iField, const WCHAR *szFilename) { IStream *stm = NULL; HRESULT r; @@ -726,7 +726,7 @@ unsigned MSI_RecordSetStreamFromFileW(MSIRECORD *rec, unsigned iField, const WCH LARGE_INTEGER ofs; ULARGE_INTEGER cur; - if( rec->fields[iField].type != MSIFIELD_STREAM ) + if( rec->fields[iField].type != LIBMSI_FIELD_TYPE_STREAM ) return ERROR_INVALID_FIELD; stm = rec->fields[iField].u.stream; @@ -752,7 +752,7 @@ unsigned MSI_RecordSetStreamFromFileW(MSIRECORD *rec, unsigned iField, const WCH return ERROR_SUCCESS; } -unsigned MsiRecordSetStreamA(MSIOBJECT *hRecord, unsigned iField, const char *szFilename) +unsigned MsiRecordSetStreamA(LibmsiObject *hRecord, unsigned iField, const char *szFilename) { WCHAR *wstr = NULL; unsigned ret; @@ -771,14 +771,14 @@ unsigned MsiRecordSetStreamA(MSIOBJECT *hRecord, unsigned iField, const char *sz return ret; } -unsigned MsiRecordSetStreamW(MSIOBJECT *handle, unsigned iField, const WCHAR *szFilename) +unsigned MsiRecordSetStreamW(LibmsiObject *handle, unsigned iField, const WCHAR *szFilename) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %s\n", handle, iField, debugstr_w(szFilename)); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; @@ -789,7 +789,7 @@ unsigned MsiRecordSetStreamW(MSIOBJECT *handle, unsigned iField, const WCHAR *sz return ret; } -unsigned MSI_RecordReadStream(MSIRECORD *rec, unsigned iField, char *buf, unsigned *sz) +unsigned MSI_RecordReadStream(LibmsiRecord *rec, unsigned iField, char *buf, unsigned *sz) { unsigned count; HRESULT r; @@ -803,13 +803,13 @@ unsigned MSI_RecordReadStream(MSIRECORD *rec, unsigned iField, char *buf, unsign if( iField > rec->count) return ERROR_INVALID_PARAMETER; - if ( rec->fields[iField].type == MSIFIELD_NULL ) + if ( rec->fields[iField].type == LIBMSI_FIELD_TYPE_NULL ) { *sz = 0; return ERROR_INVALID_DATA; } - if( rec->fields[iField].type != MSIFIELD_STREAM ) + if( rec->fields[iField].type != LIBMSI_FIELD_TYPE_STREAM ) return ERROR_INVALID_DATATYPE; stm = rec->fields[iField].u.stream; @@ -847,14 +847,14 @@ unsigned MSI_RecordReadStream(MSIRECORD *rec, unsigned iField, char *buf, unsign return ERROR_SUCCESS; } -unsigned MsiRecordReadStream(MSIOBJECT *handle, unsigned iField, char *buf, unsigned *sz) +unsigned MsiRecordReadStream(LibmsiObject *handle, unsigned iField, char *buf, unsigned *sz) { - MSIRECORD *rec; + LibmsiRecord *rec; unsigned ret; TRACE("%d %d %p %p\n", handle, iField, buf, sz); - rec = msihandle2msiinfo( handle, MSIOBJECTTYPE_RECORD ); + rec = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; msiobj_lock( &rec->hdr ); @@ -864,7 +864,7 @@ unsigned MsiRecordReadStream(MSIOBJECT *handle, unsigned iField, char *buf, unsi return ret; } -unsigned MSI_RecordSetIStream( MSIRECORD *rec, unsigned iField, IStream *stm ) +unsigned MSI_RecordSetIStream( LibmsiRecord *rec, unsigned iField, IStream *stm ) { TRACE("%p %d %p\n", rec, iField, stm); @@ -873,21 +873,21 @@ unsigned MSI_RecordSetIStream( MSIRECORD *rec, unsigned iField, IStream *stm ) MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_STREAM; + rec->fields[iField].type = LIBMSI_FIELD_TYPE_STREAM; rec->fields[iField].u.stream = stm; IStream_AddRef( stm ); return ERROR_SUCCESS; } -unsigned MSI_RecordGetIStream( MSIRECORD *rec, unsigned iField, IStream **pstm) +unsigned MSI_RecordGetIStream( LibmsiRecord *rec, unsigned iField, IStream **pstm) { TRACE("%p %d %p\n", rec, iField, pstm); if( iField > rec->count ) return ERROR_INVALID_FIELD; - if( rec->fields[iField].type != MSIFIELD_STREAM ) + if( rec->fields[iField].type != LIBMSI_FIELD_TYPE_STREAM ) return ERROR_INVALID_FIELD; *pstm = rec->fields[iField].u.stream; @@ -928,7 +928,7 @@ end: return ERROR_SUCCESS; } -unsigned MSI_RecordStreamToFile( MSIRECORD *rec, unsigned iField, const WCHAR *name ) +unsigned MSI_RecordStreamToFile( LibmsiRecord *rec, unsigned iField, const WCHAR *name ) { IStream *stm = NULL; unsigned r; @@ -949,9 +949,9 @@ unsigned MSI_RecordStreamToFile( MSIRECORD *rec, unsigned iField, const WCHAR *n return r; } -MSIRECORD *MSI_CloneRecord(MSIRECORD *rec) +LibmsiRecord *MSI_CloneRecord(LibmsiRecord *rec) { - MSIRECORD *clone; + LibmsiRecord *clone; unsigned r, i, count; count = MSI_RecordGetFieldCount(rec); @@ -961,7 +961,7 @@ MSIRECORD *MSI_CloneRecord(MSIRECORD *rec) for (i = 0; i <= count; i++) { - if (rec->fields[i].type == MSIFIELD_STREAM) + if (rec->fields[i].type == LIBMSI_FIELD_TYPE_STREAM) { if (FAILED(IStream_Clone(rec->fields[i].u.stream, &clone->fields[i].u.stream))) @@ -969,7 +969,7 @@ MSIRECORD *MSI_CloneRecord(MSIRECORD *rec) msiobj_release(&clone->hdr); return NULL; } - clone->fields[i].type = MSIFIELD_STREAM; + clone->fields[i].type = LIBMSI_FIELD_TYPE_STREAM; } else { @@ -985,27 +985,27 @@ MSIRECORD *MSI_CloneRecord(MSIRECORD *rec) return clone; } -bool MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, unsigned field) +bool MSI_RecordsAreFieldsEqual(LibmsiRecord *a, LibmsiRecord *b, unsigned field) { if (a->fields[field].type != b->fields[field].type) return false; switch (a->fields[field].type) { - case MSIFIELD_NULL: + case LIBMSI_FIELD_TYPE_NULL: break; - case MSIFIELD_INT: + case LIBMSI_FIELD_TYPE_INT: if (a->fields[field].u.iVal != b->fields[field].u.iVal) return false; break; - case MSIFIELD_WSTR: + case LIBMSI_FIELD_TYPE_WSTR: if (strcmpW(a->fields[field].u.szwVal, b->fields[field].u.szwVal)) return false; break; - case MSIFIELD_STREAM: + case LIBMSI_FIELD_TYPE_STREAM: default: return false; } @@ -1013,7 +1013,7 @@ bool MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, unsigned field) } -bool MSI_RecordsAreEqual(MSIRECORD *a, MSIRECORD *b) +bool MSI_RecordsAreEqual(LibmsiRecord *a, LibmsiRecord *b) { unsigned i; @@ -1029,7 +1029,7 @@ bool MSI_RecordsAreEqual(MSIRECORD *a, MSIRECORD *b) return true; } -WCHAR *msi_dup_record_field( MSIRECORD *rec, int field ) +WCHAR *msi_dup_record_field( LibmsiRecord *rec, int field ) { unsigned sz = 0; WCHAR *str; diff --git a/libmsi/select.c b/libmsi/select.c index 9d48172..c23f239 100644 --- a/libmsi/select.c +++ b/libmsi/select.c @@ -36,19 +36,19 @@ /* below is the query interface to a table */ -typedef struct tagMSISELECTVIEW +typedef struct LibmsiSelectView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *table; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *table; unsigned num_cols; unsigned max_cols; unsigned cols[1]; -} MSISELECTVIEW; +} LibmsiSelectView; -static unsigned SELECT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned SELECT_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %d %d %p\n", sv, row, col, val ); @@ -67,9 +67,9 @@ static unsigned SELECT_fetch_int( MSIVIEW *view, unsigned row, unsigned col, uns return sv->table->ops->fetch_int( sv->table, row, col, val ); } -static unsigned SELECT_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, IStream **stm) +static unsigned SELECT_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %d %d %p\n", sv, row, col, stm ); @@ -88,9 +88,9 @@ static unsigned SELECT_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, return sv->table->ops->fetch_stream( sv->table, row, col, stm ); } -static unsigned SELECT_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned SELECT_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSISELECTVIEW *sv = (MSISELECTVIEW *)view; + LibmsiSelectView *sv = (LibmsiSelectView *)view; TRACE("%p %d %p\n", sv, row, rec ); @@ -100,11 +100,11 @@ static unsigned SELECT_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) return msi_view_get_row(sv->db, view, row, rec); } -static unsigned SELECT_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask ) +static unsigned SELECT_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; unsigned i, expanded_mask = 0, r = ERROR_SUCCESS, col_count = 0; - MSIRECORD *expanded; + LibmsiRecord *expanded; TRACE("%p %d %p %08x\n", sv, row, rec, mask ); @@ -142,11 +142,11 @@ static unsigned SELECT_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, uns return r; } -static unsigned SELECT_insert_row( MSIVIEW *view, MSIRECORD *record, unsigned row, bool temporary ) +static unsigned SELECT_insert_row( LibmsiView *view, LibmsiRecord *record, unsigned row, bool temporary ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; unsigned i, table_cols, r; - MSIRECORD *outrec; + LibmsiRecord *outrec; TRACE("%p %p\n", sv, record ); @@ -175,9 +175,9 @@ fail: return r; } -static unsigned SELECT_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned SELECT_execute( LibmsiView *view, LibmsiRecord *record ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %p\n", sv, record); @@ -187,9 +187,9 @@ static unsigned SELECT_execute( MSIVIEW *view, MSIRECORD *record ) return sv->table->ops->execute( sv->table, record ); } -static unsigned SELECT_close( MSIVIEW *view ) +static unsigned SELECT_close( LibmsiView *view ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p\n", sv ); @@ -199,9 +199,9 @@ static unsigned SELECT_close( MSIVIEW *view ) return sv->table->ops->close( sv->table ); } -static unsigned SELECT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned SELECT_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %p %p\n", sv, rows, cols ); @@ -214,10 +214,10 @@ static unsigned SELECT_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned * return sv->table->ops->get_dimensions( sv->table, rows, NULL ); } -static unsigned SELECT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned SELECT_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %d %p %p %p %p\n", sv, n, name, type, temporary, table_name ); @@ -240,12 +240,12 @@ static unsigned SELECT_get_column_info( MSIVIEW *view, unsigned n, const WCHAR * type, temporary, table_name ); } -static unsigned msi_select_update(MSIVIEW *view, MSIRECORD *rec, unsigned row) +static unsigned msi_select_update(LibmsiView *view, LibmsiRecord *rec, unsigned row) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; unsigned r, i, num_columns, col, type, val; const WCHAR *str; - MSIRECORD *mod; + LibmsiRecord *mod; r = SELECT_get_dimensions(view, NULL, &num_columns); if (r != ERROR_SUCCESS) @@ -290,32 +290,32 @@ static unsigned msi_select_update(MSIVIEW *view, MSIRECORD *rec, unsigned row) } } - r = sv->table->ops->modify(sv->table, MSIMODIFY_UPDATE, mod, row); + r = sv->table->ops->modify(sv->table, LIBMSI_MODIFY_UPDATE, mod, row); done: msiobj_release(&mod->hdr); return r; } -static unsigned SELECT_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned SELECT_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p %d %p %d\n", sv, eModifyMode, rec, row ); if( !sv->table ) return ERROR_FUNCTION_FAILED; - if (eModifyMode == MSIMODIFY_UPDATE) + if (eModifyMode == LIBMSI_MODIFY_UPDATE) return msi_select_update(view, rec, row); return sv->table->ops->modify( sv->table, eModifyMode, rec, row ); } -static unsigned SELECT_delete( MSIVIEW *view ) +static unsigned SELECT_delete( LibmsiView *view ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p\n", sv ); @@ -328,10 +328,10 @@ static unsigned SELECT_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned SELECT_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned SELECT_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + LibmsiSelectView *sv = (LibmsiSelectView*)view; TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -347,7 +347,7 @@ static unsigned SELECT_find_matching_rows( MSIVIEW *view, unsigned col, } -static const MSIVIEWOPS select_ops = +static const LibmsiViewOPS select_ops = { SELECT_fetch_int, SELECT_fetch_stream, @@ -370,11 +370,11 @@ static const MSIVIEWOPS select_ops = NULL, }; -static unsigned SELECT_AddColumn( MSISELECTVIEW *sv, const WCHAR *name, +static unsigned SELECT_AddColumn( LibmsiSelectView *sv, const WCHAR *name, const WCHAR *table_name ) { unsigned r, n; - MSIVIEW *table; + LibmsiView *table; TRACE("%p adding %s.%s\n", sv, debugstr_w( table_name ), debugstr_w( name )); @@ -418,10 +418,10 @@ static int select_count_columns( const column_info *col ) return n; } -unsigned SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, +unsigned SELECT_CreateView( LibmsiDatabase *db, LibmsiView **view, LibmsiView *table, const column_info *columns ) { - MSISELECTVIEW *sv = NULL; + LibmsiSelectView *sv = NULL; unsigned count = 0, r = ERROR_SUCCESS; TRACE("%p\n", sv ); diff --git a/libmsi/sql-parser.y b/libmsi/sql-parser.y index b94f122..531caf9 100644 --- a/libmsi/sql-parser.y +++ b/libmsi/sql-parser.y @@ -40,13 +40,13 @@ static int sql_error(const char *str); -typedef struct tag_SQL_input +typedef struct LibmsiSQLInput { - MSIDATABASE *db; + LibmsiDatabase *db; const WCHAR *command; unsigned n, len; unsigned r; - MSIVIEW **view; /* View structure for the resulting query. This value + LibmsiView **view; /* View structure for the resulting query. This value * tracks the view currently being created so we can free * this view on syntax error. */ @@ -84,7 +84,7 @@ static struct expr * EXPR_wildcard( void *info ); struct sql_str str; WCHAR *string; column_info *column_list; - MSIVIEW *query; + LibmsiView *query; struct expr *expr; uint16_t column_type; int integer; @@ -150,7 +150,7 @@ oneinsert: TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP { SQL_input *sql = (SQL_input*) info; - MSIVIEW *insert = NULL; + LibmsiView *insert = NULL; INSERT_CreateView( sql->db, &insert, $3, $5, $9, false ); if( !insert ) @@ -161,7 +161,7 @@ oneinsert: | TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP TK_TEMPORARY { SQL_input *sql = (SQL_input*) info; - MSIVIEW *insert = NULL; + LibmsiView *insert = NULL; INSERT_CreateView( sql->db, &insert, $3, $5, $9, true ); if( !insert ) @@ -175,7 +175,7 @@ onecreate: TK_CREATE TK_TABLE table TK_LP table_def TK_RP { SQL_input* sql = (SQL_input*) info; - MSIVIEW *create = NULL; + LibmsiView *create = NULL; unsigned r; if( !$5 ) @@ -192,7 +192,7 @@ onecreate: | TK_CREATE TK_TABLE table TK_LP table_def TK_RP TK_HOLD { SQL_input* sql = (SQL_input*) info; - MSIVIEW *create = NULL; + LibmsiView *create = NULL; if( !$5 ) YYABORT; @@ -208,7 +208,7 @@ oneupdate: TK_UPDATE table TK_SET update_assign_list TK_WHERE expr { SQL_input* sql = (SQL_input*) info; - MSIVIEW *update = NULL; + LibmsiView *update = NULL; UPDATE_CreateView( sql->db, &update, $2, $4, $6 ); if( !update ) @@ -219,7 +219,7 @@ oneupdate: | TK_UPDATE table TK_SET update_assign_list { SQL_input* sql = (SQL_input*) info; - MSIVIEW *update = NULL; + LibmsiView *update = NULL; UPDATE_CreateView( sql->db, &update, $2, $4, NULL ); if( !update ) @@ -233,7 +233,7 @@ onedelete: TK_DELETE from { SQL_input* sql = (SQL_input*) info; - MSIVIEW *delete = NULL; + LibmsiView *delete = NULL; DELETE_CreateView( sql->db, &delete, $2 ); if( !delete ) @@ -247,7 +247,7 @@ onealter: TK_ALTER TK_TABLE table alterop { SQL_input* sql = (SQL_input*) info; - MSIVIEW *alter = NULL; + LibmsiView *alter = NULL; ALTER_CreateView( sql->db, &alter, $3, NULL, $4 ); if( !alter ) @@ -258,7 +258,7 @@ onealter: | TK_ALTER TK_TABLE table TK_ADD column_and_type { SQL_input *sql = (SQL_input *)info; - MSIVIEW *alter = NULL; + LibmsiView *alter = NULL; ALTER_CreateView( sql->db, &alter, $3, $5, 0 ); if (!alter) @@ -269,7 +269,7 @@ onealter: | TK_ALTER TK_TABLE table TK_ADD column_and_type TK_HOLD { SQL_input *sql = (SQL_input *)info; - MSIVIEW *alter = NULL; + LibmsiView *alter = NULL; ALTER_CreateView( sql->db, &alter, $3, $5, 1 ); if (!alter) @@ -294,7 +294,7 @@ onedrop: TK_DROP TK_TABLE table { SQL_input* sql = (SQL_input*) info; - MSIVIEW* drop = NULL; + LibmsiView* drop = NULL; unsigned r; r = DROP_CreateView( sql->db, &drop, $3 ); @@ -415,7 +415,7 @@ oneselect: | TK_SELECT TK_DISTINCT selectfrom { SQL_input* sql = (SQL_input*) info; - MSIVIEW* distinct = NULL; + LibmsiView* distinct = NULL; unsigned r; r = DISTINCT_CreateView( sql->db, &distinct, $3 ); @@ -430,7 +430,7 @@ selectfrom: selcollist from { SQL_input* sql = (SQL_input*) info; - MSIVIEW* select = NULL; + LibmsiView* select = NULL; unsigned r; if( $1 ) @@ -474,7 +474,7 @@ from: TK_FROM table { SQL_input* sql = (SQL_input*) info; - MSIVIEW* table = NULL; + LibmsiView* table = NULL; unsigned r; r = TABLE_CreateView( sql->db, $2, &table ); @@ -503,7 +503,7 @@ unorderdfrom: TK_FROM tablelist { SQL_input* sql = (SQL_input*) info; - MSIVIEW* where = NULL; + LibmsiView* where = NULL; unsigned r; r = WHERE_CreateView( sql->db, &where, $2, NULL ); @@ -515,7 +515,7 @@ unorderdfrom: | TK_FROM tablelist TK_WHERE expr { SQL_input* sql = (SQL_input*) info; - MSIVIEW* where = NULL; + LibmsiView* where = NULL; unsigned r; r = WHERE_CreateView( sql->db, &where, $2, $4 ); @@ -998,7 +998,7 @@ static bool SQL_MarkPrimaryKeys( column_info **cols, return found; } -unsigned MSI_ParseSQL( MSIDATABASE *db, const WCHAR *command, MSIVIEW **phview, +unsigned MSI_ParseSQL( LibmsiDatabase *db, const WCHAR *command, LibmsiView **phview, struct list *mem ) { SQL_input sql; diff --git a/libmsi/storages.c b/libmsi/storages.c index 4529a8d..5a875a0 100644 --- a/libmsi/storages.c +++ b/libmsi/storages.c @@ -43,17 +43,17 @@ typedef struct tabSTORAGE IStorage *storage; } STORAGE; -typedef struct tagMSISTORAGESVIEW +typedef struct LibmsiStorageView { - MSIVIEW view; - MSIDATABASE *db; + LibmsiView view; + LibmsiDatabase *db; STORAGE **storages; unsigned max_storages; unsigned num_rows; unsigned row_size; -} MSISTORAGESVIEW; +} LibmsiStorageView; -static bool storages_set_table_size(MSISTORAGESVIEW *sv, unsigned size) +static bool storages_set_table_size(LibmsiStorageView *sv, unsigned size) { if (size >= sv->max_storages) { @@ -66,7 +66,7 @@ static bool storages_set_table_size(MSISTORAGESVIEW *sv, unsigned size) return true; } -static STORAGE *create_storage(MSISTORAGESVIEW *sv, const WCHAR *name, IStorage *stg) +static STORAGE *create_storage(LibmsiStorageView *sv, const WCHAR *name, IStorage *stg) { STORAGE *storage; @@ -83,9 +83,9 @@ static STORAGE *create_storage(MSISTORAGESVIEW *sv, const WCHAR *name, IStorage return storage; } -static unsigned STORAGES_fetch_int(MSIVIEW *view, unsigned row, unsigned col, unsigned *val) +static unsigned STORAGES_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, val); @@ -100,9 +100,9 @@ static unsigned STORAGES_fetch_int(MSIVIEW *view, unsigned row, unsigned col, un return ERROR_SUCCESS; } -static unsigned STORAGES_fetch_stream(MSIVIEW *view, unsigned row, unsigned col, IStream **stm) +static unsigned STORAGES_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, stm); @@ -112,9 +112,9 @@ static unsigned STORAGES_fetch_stream(MSIVIEW *view, unsigned row, unsigned col, return ERROR_INVALID_DATA; } -static unsigned STORAGES_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned STORAGES_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; FIXME("%p %d %p\n", sv, row, rec); @@ -170,9 +170,9 @@ done: return hr; } -static unsigned STORAGES_set_row(MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask) +static unsigned STORAGES_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; IStorage *stg, *substg = NULL; IStream *stm; WCHAR *name = NULL; @@ -232,9 +232,9 @@ done: return r; } -static unsigned STORAGES_insert_row(MSIVIEW *view, MSIRECORD *rec, unsigned row, bool temporary) +static unsigned STORAGES_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; if (!storages_set_table_size(sv, ++sv->num_rows)) return ERROR_FUNCTION_FAILED; @@ -247,27 +247,27 @@ static unsigned STORAGES_insert_row(MSIVIEW *view, MSIRECORD *rec, unsigned row, return STORAGES_set_row(view, row, rec, 0); } -static unsigned STORAGES_delete_row(MSIVIEW *view, unsigned row) +static unsigned STORAGES_delete_row(LibmsiView *view, unsigned row) { FIXME("(%p %d): stub!\n", view, row); return ERROR_SUCCESS; } -static unsigned STORAGES_execute(MSIVIEW *view, MSIRECORD *record) +static unsigned STORAGES_execute(LibmsiView *view, LibmsiRecord *record) { TRACE("(%p, %p)\n", view, record); return ERROR_SUCCESS; } -static unsigned STORAGES_close(MSIVIEW *view) +static unsigned STORAGES_close(LibmsiView *view) { TRACE("(%p)\n", view); return ERROR_SUCCESS; } -static unsigned STORAGES_get_dimensions(MSIVIEW *view, unsigned *rows, unsigned *cols) +static unsigned STORAGES_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; TRACE("(%p, %p, %p)\n", view, rows, cols); @@ -277,7 +277,7 @@ static unsigned STORAGES_get_dimensions(MSIVIEW *view, unsigned *rows, unsigned return ERROR_SUCCESS; } -static unsigned STORAGES_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned STORAGES_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, @@ -303,7 +303,7 @@ static unsigned STORAGES_get_column_info( MSIVIEW *view, unsigned n, const WCHAR return ERROR_SUCCESS; } -static unsigned storages_find_row(MSISTORAGESVIEW *sv, MSIRECORD *rec, unsigned *row) +static unsigned storages_find_row(LibmsiStorageView *sv, LibmsiRecord *rec, unsigned *row) { const WCHAR *str; unsigned r, i, id, data; @@ -327,9 +327,9 @@ static unsigned storages_find_row(MSISTORAGESVIEW *sv, MSIRECORD *rec, unsigned return ERROR_FUNCTION_FAILED; } -static unsigned storages_modify_update(MSIVIEW *view, MSIRECORD *rec) +static unsigned storages_modify_update(LibmsiView *view, LibmsiRecord *rec) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; unsigned r, row; r = storages_find_row(sv, rec, &row); @@ -339,9 +339,9 @@ static unsigned storages_modify_update(MSIVIEW *view, MSIRECORD *rec) return STORAGES_set_row(view, row, rec, 0); } -static unsigned storages_modify_assign(MSIVIEW *view, MSIRECORD *rec) +static unsigned storages_modify_assign(LibmsiView *view, LibmsiRecord *rec) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; unsigned r, row; r = storages_find_row(sv, rec, &row); @@ -351,7 +351,7 @@ static unsigned storages_modify_assign(MSIVIEW *view, MSIRECORD *rec) return STORAGES_insert_row(view, rec, -1, false); } -static unsigned STORAGES_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, unsigned row) +static unsigned STORAGES_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { unsigned r; @@ -359,27 +359,27 @@ static unsigned STORAGES_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD switch (eModifyMode) { - case MSIMODIFY_ASSIGN: + case LIBMSI_MODIFY_ASSIGN: r = storages_modify_assign(view, rec); break; - case MSIMODIFY_INSERT: + case LIBMSI_MODIFY_INSERT: r = STORAGES_insert_row(view, rec, -1, false); break; - case MSIMODIFY_UPDATE: + case LIBMSI_MODIFY_UPDATE: r = storages_modify_update(view, rec); break; - case MSIMODIFY_VALIDATE_NEW: - case MSIMODIFY_INSERT_TEMPORARY: - case MSIMODIFY_REFRESH: - case MSIMODIFY_REPLACE: - case MSIMODIFY_MERGE: - case MSIMODIFY_DELETE: - case MSIMODIFY_VALIDATE: - case MSIMODIFY_VALIDATE_FIELD: - case MSIMODIFY_VALIDATE_DELETE: + case LIBMSI_MODIFY_VALIDATE_NEW: + case LIBMSI_MODIFY_INSERT_TEMPORARY: + case LIBMSI_MODIFY_REFRESH: + case LIBMSI_MODIFY_REPLACE: + case LIBMSI_MODIFY_MERGE: + case LIBMSI_MODIFY_DELETE: + case LIBMSI_MODIFY_VALIDATE: + case LIBMSI_MODIFY_VALIDATE_FIELD: + case LIBMSI_MODIFY_VALIDATE_DELETE: FIXME("%p %d %p - mode not implemented\n", view, eModifyMode, rec ); r = ERROR_CALL_NOT_IMPLEMENTED; break; @@ -391,9 +391,9 @@ static unsigned STORAGES_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD return r; } -static unsigned STORAGES_delete(MSIVIEW *view) +static unsigned STORAGES_delete(LibmsiView *view) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; unsigned i; TRACE("(%p)\n", view); @@ -412,10 +412,10 @@ static unsigned STORAGES_delete(MSIVIEW *view) return ERROR_SUCCESS; } -static unsigned STORAGES_find_matching_rows(MSIVIEW *view, unsigned col, +static unsigned STORAGES_find_matching_rows(LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle) { - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; + LibmsiStorageView *sv = (LibmsiStorageView *)view; unsigned index = PtrToUlong(*handle); TRACE("(%d, %d): %d\n", *row, col, val); @@ -441,7 +441,7 @@ static unsigned STORAGES_find_matching_rows(MSIVIEW *view, unsigned col, return ERROR_SUCCESS; } -static const MSIVIEWOPS storages_ops = +static const LibmsiViewOPS storages_ops = { STORAGES_fetch_int, STORAGES_fetch_stream, @@ -464,7 +464,7 @@ static const MSIVIEWOPS storages_ops = NULL, }; -static int add_storages_to_table(MSISTORAGESVIEW *sv) +static int add_storages_to_table(LibmsiStorageView *sv) { STORAGE *storage = NULL; IEnumSTATSTG *stgenum = NULL; @@ -522,14 +522,14 @@ static int add_storages_to_table(MSISTORAGESVIEW *sv) return count; } -unsigned STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) +unsigned STORAGES_CreateView(LibmsiDatabase *db, LibmsiView **view) { - MSISTORAGESVIEW *sv; + LibmsiStorageView *sv; int rows; TRACE("(%p, %p)\n", db, view); - sv = msi_alloc_zero( sizeof(MSISTORAGESVIEW) ); + sv = msi_alloc_zero( sizeof(LibmsiStorageView) ); if (!sv) return ERROR_FUNCTION_FAILED; @@ -544,7 +544,7 @@ unsigned STORAGES_CreateView(MSIDATABASE *db, MSIVIEW **view) } sv->num_rows = rows; - *view = (MSIVIEW *)sv; + *view = (LibmsiView *)sv; return ERROR_SUCCESS; } diff --git a/libmsi/streams.c b/libmsi/streams.c index 74e86f9..dabfef5 100644 --- a/libmsi/streams.c +++ b/libmsi/streams.c @@ -42,17 +42,17 @@ typedef struct tabSTREAM IStream *stream; } STREAM; -typedef struct tagMSISTREAMSVIEW +typedef struct LibmsiStreamSVIEW { - MSIVIEW view; - MSIDATABASE *db; + LibmsiView view; + LibmsiDatabase *db; STREAM **streams; unsigned max_streams; unsigned num_rows; unsigned row_size; -} MSISTREAMSVIEW; +} LibmsiStreamSVIEW; -static bool streams_set_table_size(MSISTREAMSVIEW *sv, unsigned size) +static bool streams_set_table_size(LibmsiStreamSVIEW *sv, unsigned size) { if (size >= sv->max_streams) { @@ -65,7 +65,7 @@ static bool streams_set_table_size(MSISTREAMSVIEW *sv, unsigned size) return true; } -static STREAM *create_stream(MSISTREAMSVIEW *sv, const WCHAR *name, bool encoded, IStream *stm) +static STREAM *create_stream(LibmsiStreamSVIEW *sv, const WCHAR *name, bool encoded, IStream *stm) { STREAM *stream; WCHAR decoded[MAX_STREAM_NAME_LEN]; @@ -86,9 +86,9 @@ static STREAM *create_stream(MSISTREAMSVIEW *sv, const WCHAR *name, bool encoded return stream; } -static unsigned STREAMS_fetch_int(MSIVIEW *view, unsigned row, unsigned col, unsigned *val) +static unsigned STREAMS_fetch_int(LibmsiView *view, unsigned row, unsigned col, unsigned *val) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, val); @@ -103,9 +103,9 @@ static unsigned STREAMS_fetch_int(MSIVIEW *view, unsigned row, unsigned col, uns return ERROR_SUCCESS; } -static unsigned STREAMS_fetch_stream(MSIVIEW *view, unsigned row, unsigned col, IStream **stm) +static unsigned STREAMS_fetch_stream(LibmsiView *view, unsigned row, unsigned col, IStream **stm) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; TRACE("(%p, %d, %d, %p)\n", view, row, col, stm); @@ -118,18 +118,18 @@ static unsigned STREAMS_fetch_stream(MSIVIEW *view, unsigned row, unsigned col, return ERROR_SUCCESS; } -static unsigned STREAMS_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned STREAMS_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; TRACE("%p %d %p\n", sv, row, rec); return msi_view_get_row( sv->db, view, row, rec ); } -static unsigned STREAMS_set_row(MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask) +static unsigned STREAMS_set_row(LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; STREAM *stream; IStream *stm; STATSTG stat; @@ -214,9 +214,9 @@ done: return r; } -static unsigned STREAMS_insert_row(MSIVIEW *view, MSIRECORD *rec, unsigned row, bool temporary) +static unsigned STREAMS_insert_row(LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; unsigned i; TRACE("(%p, %p, %d, %d)\n", view, rec, row, temporary); @@ -236,27 +236,27 @@ static unsigned STREAMS_insert_row(MSIVIEW *view, MSIRECORD *rec, unsigned row, return STREAMS_set_row(view, row, rec, 0); } -static unsigned STREAMS_delete_row(MSIVIEW *view, unsigned row) +static unsigned STREAMS_delete_row(LibmsiView *view, unsigned row) { FIXME("(%p %d): stub!\n", view, row); return ERROR_SUCCESS; } -static unsigned STREAMS_execute(MSIVIEW *view, MSIRECORD *record) +static unsigned STREAMS_execute(LibmsiView *view, LibmsiRecord *record) { TRACE("(%p, %p)\n", view, record); return ERROR_SUCCESS; } -static unsigned STREAMS_close(MSIVIEW *view) +static unsigned STREAMS_close(LibmsiView *view) { TRACE("(%p)\n", view); return ERROR_SUCCESS; } -static unsigned STREAMS_get_dimensions(MSIVIEW *view, unsigned *rows, unsigned *cols) +static unsigned STREAMS_get_dimensions(LibmsiView *view, unsigned *rows, unsigned *cols) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; TRACE("(%p, %p, %p)\n", view, rows, cols); @@ -266,7 +266,7 @@ static unsigned STREAMS_get_dimensions(MSIVIEW *view, unsigned *rows, unsigned * return ERROR_SUCCESS; } -static unsigned STREAMS_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned STREAMS_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, @@ -292,7 +292,7 @@ static unsigned STREAMS_get_column_info( MSIVIEW *view, unsigned n, const WCHAR return ERROR_SUCCESS; } -static unsigned streams_find_row(MSISTREAMSVIEW *sv, MSIRECORD *rec, unsigned *row) +static unsigned streams_find_row(LibmsiStreamSVIEW *sv, LibmsiRecord *rec, unsigned *row) { const WCHAR *str; unsigned r, i, id, data; @@ -316,9 +316,9 @@ static unsigned streams_find_row(MSISTREAMSVIEW *sv, MSIRECORD *rec, unsigned *r return ERROR_FUNCTION_FAILED; } -static unsigned streams_modify_update(MSIVIEW *view, MSIRECORD *rec) +static unsigned streams_modify_update(LibmsiView *view, LibmsiRecord *rec) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; unsigned r, row; r = streams_find_row(sv, rec, &row); @@ -328,9 +328,9 @@ static unsigned streams_modify_update(MSIVIEW *view, MSIRECORD *rec) return STREAMS_set_row(view, row, rec, 0); } -static unsigned streams_modify_assign(MSIVIEW *view, MSIRECORD *rec) +static unsigned streams_modify_assign(LibmsiView *view, LibmsiRecord *rec) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; unsigned r, row; r = streams_find_row(sv, rec, &row); @@ -340,7 +340,7 @@ static unsigned streams_modify_assign(MSIVIEW *view, MSIRECORD *rec) return STREAMS_insert_row(view, rec, -1, false); } -static unsigned STREAMS_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, unsigned row) +static unsigned STREAMS_modify(LibmsiView *view, LibmsiModify eModifyMode, LibmsiRecord *rec, unsigned row) { unsigned r; @@ -348,27 +348,27 @@ static unsigned STREAMS_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD * switch (eModifyMode) { - case MSIMODIFY_ASSIGN: + case LIBMSI_MODIFY_ASSIGN: r = streams_modify_assign(view, rec); break; - case MSIMODIFY_INSERT: + case LIBMSI_MODIFY_INSERT: r = STREAMS_insert_row(view, rec, -1, false); break; - case MSIMODIFY_UPDATE: + case LIBMSI_MODIFY_UPDATE: r = streams_modify_update(view, rec); break; - case MSIMODIFY_VALIDATE_NEW: - case MSIMODIFY_INSERT_TEMPORARY: - case MSIMODIFY_REFRESH: - case MSIMODIFY_REPLACE: - case MSIMODIFY_MERGE: - case MSIMODIFY_DELETE: - case MSIMODIFY_VALIDATE: - case MSIMODIFY_VALIDATE_FIELD: - case MSIMODIFY_VALIDATE_DELETE: + case LIBMSI_MODIFY_VALIDATE_NEW: + case LIBMSI_MODIFY_INSERT_TEMPORARY: + case LIBMSI_MODIFY_REFRESH: + case LIBMSI_MODIFY_REPLACE: + case LIBMSI_MODIFY_MERGE: + case LIBMSI_MODIFY_DELETE: + case LIBMSI_MODIFY_VALIDATE: + case LIBMSI_MODIFY_VALIDATE_FIELD: + case LIBMSI_MODIFY_VALIDATE_DELETE: FIXME("%p %d %p - mode not implemented\n", view, eModifyMode, rec ); r = ERROR_CALL_NOT_IMPLEMENTED; break; @@ -380,9 +380,9 @@ static unsigned STREAMS_modify(MSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD * return r; } -static unsigned STREAMS_delete(MSIVIEW *view) +static unsigned STREAMS_delete(LibmsiView *view) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; unsigned i; TRACE("(%p)\n", view); @@ -403,10 +403,10 @@ static unsigned STREAMS_delete(MSIVIEW *view) return ERROR_SUCCESS; } -static unsigned STREAMS_find_matching_rows(MSIVIEW *view, unsigned col, +static unsigned STREAMS_find_matching_rows(LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle) { - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; + LibmsiStreamSVIEW *sv = (LibmsiStreamSVIEW *)view; unsigned index = PtrToUlong(*handle); TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle); @@ -433,7 +433,7 @@ static unsigned STREAMS_find_matching_rows(MSIVIEW *view, unsigned col, return ERROR_SUCCESS; } -static const MSIVIEWOPS streams_ops = +static const LibmsiViewOPS streams_ops = { STREAMS_fetch_int, STREAMS_fetch_stream, @@ -456,7 +456,7 @@ static const MSIVIEWOPS streams_ops = NULL, }; -static int add_streams_to_table(MSISTREAMSVIEW *sv) +static int add_streams_to_table(LibmsiStreamSVIEW *sv) { IEnumSTATSTG *stgenum = NULL; STATSTG stat; @@ -535,14 +535,14 @@ static int add_streams_to_table(MSISTREAMSVIEW *sv) return count; } -unsigned STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) +unsigned STREAMS_CreateView(LibmsiDatabase *db, LibmsiView **view) { - MSISTREAMSVIEW *sv; + LibmsiStreamSVIEW *sv; int rows; TRACE("(%p, %p)\n", db, view); - sv = msi_alloc_zero( sizeof(MSISTREAMSVIEW) ); + sv = msi_alloc_zero( sizeof(LibmsiStreamSVIEW) ); if (!sv) return ERROR_FUNCTION_FAILED; @@ -556,7 +556,7 @@ unsigned STREAMS_CreateView(MSIDATABASE *db, MSIVIEW **view) } sv->num_rows = rows; - *view = (MSIVIEW *)sv; + *view = (LibmsiView *)sv; return ERROR_SUCCESS; } diff --git a/libmsi/suminfo.c b/libmsi/suminfo.c index de28865..84347aa 100644 --- a/libmsi/suminfo.c +++ b/libmsi/suminfo.c @@ -92,9 +92,9 @@ static void free_prop( PROPVARIANT *prop ) prop->vt = VT_EMPTY; } -static void MSI_CloseSummaryInfo( MSIOBJECT *arg ) +static void MSI_CloseSummaryInfo( LibmsiObject *arg ) { - MSISUMMARYINFO *si = (MSISUMMARYINFO *) arg; + LibmsiSummaryInfo *si = (LibmsiSummaryInfo *) arg; unsigned i; for( i = 0; i < MSI_MAX_PROPS; i++ ) @@ -233,7 +233,7 @@ static void read_properties_from_data( PROPVARIANT *prop, uint8_t *data, unsigne } } -static unsigned load_summary_info( MSISUMMARYINFO *si, IStream *stm ) +static unsigned load_summary_info( LibmsiSummaryInfo *si, IStream *stm ) { unsigned ret = ERROR_FUNCTION_FAILED; PROPERTYSETHEADER set_hdr; @@ -358,7 +358,7 @@ static unsigned write_property_to_data( const PROPVARIANT *prop, uint8_t *data ) return sz; } -static unsigned save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) +static unsigned save_summary_info( const LibmsiSummaryInfo * si, IStream *stm ) { unsigned ret = ERROR_FUNCTION_FAILED; PROPERTYSETHEADER set_hdr; @@ -426,17 +426,17 @@ static unsigned save_summary_info( const MSISUMMARYINFO * si, IStream *stm ) return ERROR_SUCCESS; } -MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCount ) +LibmsiSummaryInfo *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCount ) { IStream *stm = NULL; - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; unsigned grfMode; HRESULT r; TRACE("%p %d\n", stg, uiUpdateCount ); - si = alloc_msiobject( MSIOBJECTTYPE_SUMMARYINFO, - sizeof (MSISUMMARYINFO), MSI_CloseSummaryInfo ); + si = alloc_msiobject( LIBMSI_OBJECT_TYPE_SUMMARYINFO, + sizeof (LibmsiSummaryInfo), MSI_CloseSummaryInfo ); if( !si ) return si; @@ -456,11 +456,11 @@ MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, unsigned uiUpdateCoun return si; } -unsigned MsiGetSummaryInformationW( MSIOBJECT *hDatabase, - const WCHAR *szDatabase, unsigned uiUpdateCount, MSIOBJECT **pHandle ) +unsigned MsiGetSummaryInformationW( LibmsiObject *hDatabase, + const WCHAR *szDatabase, unsigned uiUpdateCount, LibmsiObject **pHandle ) { - MSISUMMARYINFO *si; - MSIDATABASE *db; + LibmsiSummaryInfo *si; + LibmsiDatabase *db; unsigned ret = ERROR_FUNCTION_FAILED; TRACE("%d %s %d %p\n", hDatabase, debugstr_w(szDatabase), @@ -471,7 +471,7 @@ unsigned MsiGetSummaryInformationW( MSIOBJECT *hDatabase, if( szDatabase && szDatabase[0] ) { - const WCHAR *persist = uiUpdateCount ? MSIDBOPEN_TRANSACT : MSIDBOPEN_READONLY; + const WCHAR *persist = uiUpdateCount ? LIBMSI_DB_OPEN_TRANSACT : LIBMSI_DB_OPEN_READONLY; ret = MSI_OpenDatabaseW( szDatabase, persist, &db ); if( ret != ERROR_SUCCESS ) @@ -479,7 +479,7 @@ unsigned MsiGetSummaryInformationW( MSIOBJECT *hDatabase, } else { - db = msihandle2msiinfo( hDatabase, MSIOBJECTTYPE_DATABASE ); + db = msihandle2msiinfo( hDatabase, LIBMSI_OBJECT_TYPE_DATABASE ); if( !db ) return ERROR_INVALID_HANDLE; } @@ -495,8 +495,8 @@ unsigned MsiGetSummaryInformationW( MSIOBJECT *hDatabase, return ret; } -unsigned MsiGetSummaryInformationA(MSIOBJECT *hDatabase, - const char *szDatabase, unsigned uiUpdateCount, MSIOBJECT **pHandle) +unsigned MsiGetSummaryInformationA(LibmsiObject *hDatabase, + const char *szDatabase, unsigned uiUpdateCount, LibmsiObject **pHandle) { WCHAR *szwDatabase = NULL; unsigned ret; @@ -518,13 +518,13 @@ unsigned MsiGetSummaryInformationA(MSIOBJECT *hDatabase, return ret; } -unsigned MsiSummaryInfoGetPropertyCount(MSIOBJECT *hSummaryInfo, unsigned *pCount) +unsigned MsiSummaryInfoGetPropertyCount(LibmsiObject *hSummaryInfo, unsigned *pCount) { - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; TRACE("%d %p\n", hSummaryInfo, pCount); - si = msihandle2msiinfo( hSummaryInfo, MSIOBJECTTYPE_SUMMARYINFO ); + si = msihandle2msiinfo( hSummaryInfo, LIBMSI_OBJECT_TYPE_SUMMARYINFO ); if( !si ) return ERROR_INVALID_HANDLE; @@ -535,10 +535,10 @@ unsigned MsiSummaryInfoGetPropertyCount(MSIOBJECT *hSummaryInfo, unsigned *pCoun return ERROR_SUCCESS; } -static unsigned get_prop( MSIOBJECT *handle, unsigned uiProperty, unsigned *puiDataType, +static unsigned get_prop( LibmsiObject *handle, unsigned uiProperty, unsigned *puiDataType, int *piValue, FILETIME *pftValue, awstring *str, unsigned *pcchValueBuf) { - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; PROPVARIANT *prop; unsigned ret = ERROR_SUCCESS; @@ -551,7 +551,7 @@ static unsigned get_prop( MSIOBJECT *handle, unsigned uiProperty, unsigned *puiD return ERROR_UNKNOWN_PROPERTY; } - si = msihandle2msiinfo( handle, MSIOBJECTTYPE_SUMMARYINFO ); + si = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_SUMMARYINFO ); if( !si ) return ERROR_INVALID_HANDLE; @@ -605,7 +605,7 @@ static unsigned get_prop( MSIOBJECT *handle, unsigned uiProperty, unsigned *puiD return ret; } -WCHAR *msi_suminfo_dup_string( MSISUMMARYINFO *si, unsigned uiProperty ) +WCHAR *msi_suminfo_dup_string( LibmsiSummaryInfo *si, unsigned uiProperty ) { PROPVARIANT *prop; @@ -617,7 +617,7 @@ WCHAR *msi_suminfo_dup_string( MSISUMMARYINFO *si, unsigned uiProperty ) return strdupAtoW( prop->pszVal ); } -int msi_suminfo_get_int32( MSISUMMARYINFO *si, unsigned uiProperty ) +int msi_suminfo_get_int32( LibmsiSummaryInfo *si, unsigned uiProperty ) { PROPVARIANT *prop; @@ -631,7 +631,7 @@ int msi_suminfo_get_int32( MSISUMMARYINFO *si, unsigned uiProperty ) WCHAR *msi_get_suminfo_product( IStorage *stg ) { - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; WCHAR *prod; si = MSI_GetSummaryInformationW( stg, 0 ); @@ -646,7 +646,7 @@ WCHAR *msi_get_suminfo_product( IStorage *stg ) } unsigned MsiSummaryInfoGetPropertyA( - MSIOBJECT *handle, unsigned uiProperty, unsigned *puiDataType, int *piValue, + LibmsiObject *handle, unsigned uiProperty, unsigned *puiDataType, int *piValue, FILETIME *pftValue, char *szValueBuf, unsigned *pcchValueBuf) { awstring str; @@ -662,7 +662,7 @@ unsigned MsiSummaryInfoGetPropertyA( } unsigned MsiSummaryInfoGetPropertyW( - MSIOBJECT *handle, unsigned uiProperty, unsigned *puiDataType, int *piValue, + LibmsiObject *handle, unsigned uiProperty, unsigned *puiDataType, int *piValue, FILETIME *pftValue, WCHAR *szValueBuf, unsigned *pcchValueBuf) { awstring str; @@ -677,7 +677,7 @@ unsigned MsiSummaryInfoGetPropertyW( pftValue, &str, pcchValueBuf ); } -static unsigned set_prop( MSISUMMARYINFO *si, unsigned uiProperty, unsigned type, +static unsigned set_prop( LibmsiSummaryInfo *si, unsigned uiProperty, unsigned type, int iValue, FILETIME* pftValue, awcstring *str ) { PROPVARIANT *prop; @@ -732,11 +732,11 @@ static unsigned set_prop( MSISUMMARYINFO *si, unsigned uiProperty, unsigned type return ERROR_SUCCESS; } -unsigned MsiSummaryInfoSetPropertyW( MSIOBJECT *handle, unsigned uiProperty, +unsigned MsiSummaryInfoSetPropertyW( LibmsiObject *handle, unsigned uiProperty, unsigned uiDataType, int iValue, FILETIME* pftValue, const WCHAR *szValue ) { awcstring str; - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; unsigned type, ret; TRACE("%d %u %u %i %p %s\n", handle, uiProperty, uiDataType, @@ -752,7 +752,7 @@ unsigned MsiSummaryInfoSetPropertyW( MSIOBJECT *handle, unsigned uiProperty, if( uiDataType == VT_FILETIME && !pftValue ) return ERROR_INVALID_PARAMETER; - si = msihandle2msiinfo( handle, MSIOBJECTTYPE_SUMMARYINFO ); + si = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_SUMMARYINFO ); if( !si ) return ERROR_INVALID_HANDLE; @@ -764,11 +764,11 @@ unsigned MsiSummaryInfoSetPropertyW( MSIOBJECT *handle, unsigned uiProperty, return ret; } -unsigned MsiSummaryInfoSetPropertyA( MSIOBJECT *handle, unsigned uiProperty, +unsigned MsiSummaryInfoSetPropertyA( LibmsiObject *handle, unsigned uiProperty, unsigned uiDataType, int iValue, FILETIME* pftValue, const char *szValue ) { awcstring str; - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; unsigned type, ret; TRACE("%d %u %u %i %p %s\n", handle, uiProperty, uiDataType, @@ -784,7 +784,7 @@ unsigned MsiSummaryInfoSetPropertyA( MSIOBJECT *handle, unsigned uiProperty, if( uiDataType == VT_FILETIME && !pftValue ) return ERROR_INVALID_PARAMETER; - si = msihandle2msiinfo( handle, MSIOBJECTTYPE_SUMMARYINFO ); + si = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_SUMMARYINFO ); if( !si ) return ERROR_INVALID_HANDLE; @@ -796,7 +796,7 @@ unsigned MsiSummaryInfoSetPropertyA( MSIOBJECT *handle, unsigned uiProperty, return ret; } -static unsigned suminfo_persist( MSISUMMARYINFO *si ) +static unsigned suminfo_persist( LibmsiSummaryInfo *si ) { unsigned ret = ERROR_FUNCTION_FAILED; IStream *stm = NULL; @@ -894,11 +894,11 @@ static unsigned parse_prop( const WCHAR *prop, const WCHAR *value, unsigned *pid return ERROR_SUCCESS; } -unsigned msi_add_suminfo( MSIDATABASE *db, WCHAR ***records, int num_records, int num_columns ) +unsigned msi_add_suminfo( LibmsiDatabase *db, WCHAR ***records, int num_records, int num_columns ) { unsigned r = ERROR_FUNCTION_FAILED; unsigned i, j; - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; si = MSI_GetSummaryInformationW( db->storage, num_records * (num_columns / 2) ); if (!si) @@ -934,14 +934,14 @@ end: return r; } -unsigned MsiSummaryInfoPersist( MSIOBJECT *handle ) +unsigned MsiSummaryInfoPersist( LibmsiObject *handle ) { - MSISUMMARYINFO *si; + LibmsiSummaryInfo *si; unsigned ret; TRACE("%d\n", handle ); - si = msihandle2msiinfo( handle, MSIOBJECTTYPE_SUMMARYINFO ); + si = msihandle2msiinfo( handle, LIBMSI_OBJECT_TYPE_SUMMARYINFO ); if( !si ) return ERROR_INVALID_HANDLE; @@ -951,7 +951,7 @@ unsigned MsiSummaryInfoPersist( MSIOBJECT *handle ) return ret; } -unsigned MsiCreateTransformSummaryInfoA( MSIOBJECT *db, MSIOBJECT *db_ref, const char *transform, int error, int validation ) +unsigned MsiCreateTransformSummaryInfoA( LibmsiObject *db, LibmsiObject *db_ref, const char *transform, int error, int validation ) { unsigned r; WCHAR *transformW = NULL; @@ -966,7 +966,7 @@ unsigned MsiCreateTransformSummaryInfoA( MSIOBJECT *db, MSIOBJECT *db_ref, const return r; } -unsigned MsiCreateTransformSummaryInfoW( MSIOBJECT *db, MSIOBJECT *db_ref, const WCHAR *transform, int error, int validation ) +unsigned MsiCreateTransformSummaryInfoW( LibmsiObject *db, LibmsiObject *db_ref, const WCHAR *transform, int error, int validation ) { FIXME("%u, %u, %s, %d, %d\n", db, db_ref, debugstr_w(transform), error, validation); return ERROR_FUNCTION_FAILED; diff --git a/libmsi/table.c b/libmsi/table.c index c12d969..4a9f37b 100644 --- a/libmsi/table.c +++ b/libmsi/table.c @@ -39,16 +39,16 @@ #include "unicode.h" -#define MSITABLE_HASH_TABLE_SIZE 37 +#define LibmsiTable_HASH_TABLE_SIZE 37 -typedef struct tagMSICOLUMNHASHENTRY +typedef struct LibmsiColumnHashEntry { - struct tagMSICOLUMNHASHENTRY *next; + struct LibmsiColumnHashEntry *next; unsigned value; unsigned row; -} MSICOLUMNHASHENTRY; +} LibmsiColumnHashEntry; -typedef struct tagMSICOLUMNINFO +typedef struct LibmsiColumnInfo { const WCHAR *tablename; unsigned number; @@ -57,18 +57,18 @@ typedef struct tagMSICOLUMNINFO unsigned offset; int ref_count; bool temporary; - MSICOLUMNHASHENTRY **hash_table; -} MSICOLUMNINFO; + LibmsiColumnHashEntry **hash_table; +} LibmsiColumnInfo; -struct tagMSITABLE +struct LibmsiTable { uint8_t **data; bool *data_persistent; unsigned row_count; struct list entry; - MSICOLUMNINFO *colinfo; + LibmsiColumnInfo *colinfo; unsigned col_count; - MSICONDITION persistent; + LibmsiCondition persistent; int ref_count; WCHAR name[1]; }; @@ -80,20 +80,20 @@ static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0}; static const WCHAR szNumber[] = {'N','u','m','b','e','r',0}; static const WCHAR szType[] = {'T','y','p','e',0}; -static const MSICOLUMNINFO _Columns_cols[4] = { +static const LibmsiColumnInfo _Columns_cols[4] = { { szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL }, { szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, 0, 0, NULL }, { szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, 0, 0, NULL }, { szColumns, 4, szType, MSITYPE_VALID | 2, 6, 0, 0, NULL }, }; -static const MSICOLUMNINFO _Tables_cols[1] = { +static const LibmsiColumnInfo _Tables_cols[1] = { { szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL }, }; #define MAX_STREAM_NAME 0x1f -static inline unsigned bytes_per_column( MSIDATABASE *db, const MSICOLUMNINFO *col, unsigned bytes_per_strref ) +static inline unsigned bytes_per_column( LibmsiDatabase *db, const LibmsiColumnInfo *col, unsigned bytes_per_strref ) { if( MSITYPE_IS_BINARY(col->type) ) return 2; @@ -364,13 +364,13 @@ end: return ret; } -static void msi_free_colinfo( MSICOLUMNINFO *colinfo, unsigned count ) +static void msi_free_colinfo( LibmsiColumnInfo *colinfo, unsigned count ) { unsigned i; for (i = 0; i < count; i++) msi_free( colinfo[i].hash_table ); } -static void free_table( MSITABLE *table ) +static void free_table( LibmsiTable *table ) { unsigned i; for( i=0; irow_count; i++ ) @@ -382,9 +382,9 @@ static void free_table( MSITABLE *table ) msi_free( table ); } -static unsigned msi_table_get_row_size( MSIDATABASE *db, const MSICOLUMNINFO *cols, unsigned count, unsigned bytes_per_strref ) +static unsigned msi_table_get_row_size( LibmsiDatabase *db, const LibmsiColumnInfo *cols, unsigned count, unsigned bytes_per_strref ) { - const MSICOLUMNINFO *last_col; + const LibmsiColumnInfo *last_col; if (!count) return 0; @@ -400,7 +400,7 @@ static unsigned msi_table_get_row_size( MSIDATABASE *db, const MSICOLUMNINFO *co } /* add this table to the list of cached tables in the database */ -static unsigned read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg ) +static unsigned read_table_from_storage( LibmsiDatabase *db, LibmsiTable *t, IStorage *stg ) { uint8_t *rawdata = NULL; unsigned rawsize = 0, i, j, row_size, row_size_mem; @@ -480,29 +480,29 @@ err: return ERROR_FUNCTION_FAILED; } -void free_cached_tables( MSIDATABASE *db ) +void free_cached_tables( LibmsiDatabase *db ) { while( !list_empty( &db->tables ) ) { - MSITABLE *t = LIST_ENTRY( list_head( &db->tables ), MSITABLE, entry ); + LibmsiTable *t = LIST_ENTRY( list_head( &db->tables ), LibmsiTable, entry ); list_remove( &t->entry ); free_table( t ); } } -static MSITABLE *find_cached_table( MSIDATABASE *db, const WCHAR *name ) +static LibmsiTable *find_cached_table( LibmsiDatabase *db, const WCHAR *name ) { - MSITABLE *t; + LibmsiTable *t; - LIST_FOR_EACH_ENTRY( t, &db->tables, MSITABLE, entry ) + LIST_FOR_EACH_ENTRY( t, &db->tables, LibmsiTable, entry ) if( !strcmpW( name, t->name ) ) return t; return NULL; } -static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo, unsigned count ) +static void table_calc_column_offsets( LibmsiDatabase *db, LibmsiColumnInfo *colinfo, unsigned count ) { unsigned i; @@ -519,9 +519,9 @@ static void table_calc_column_offsets( MSIDATABASE *db, MSICOLUMNINFO *colinfo, } } -static unsigned get_defaulttablecolumns( MSIDATABASE *db, const WCHAR *name, MSICOLUMNINFO *colinfo, unsigned *sz ) +static unsigned get_defaulttablecolumns( LibmsiDatabase *db, const WCHAR *name, LibmsiColumnInfo *colinfo, unsigned *sz ) { - const MSICOLUMNINFO *p; + const LibmsiColumnInfo *p; unsigned i, n; TRACE("%s\n", debugstr_w(name)); @@ -548,12 +548,12 @@ static unsigned get_defaulttablecolumns( MSIDATABASE *db, const WCHAR *name, MSI return ERROR_SUCCESS; } -static unsigned get_tablecolumns( MSIDATABASE *db, const WCHAR *szTableName, MSICOLUMNINFO *colinfo, unsigned *sz ); +static unsigned get_tablecolumns( LibmsiDatabase *db, const WCHAR *szTableName, LibmsiColumnInfo *colinfo, unsigned *sz ); -static unsigned table_get_column_info( MSIDATABASE *db, const WCHAR *name, MSICOLUMNINFO **pcols, unsigned *pcount ) +static unsigned table_get_column_info( LibmsiDatabase *db, const WCHAR *name, LibmsiColumnInfo **pcols, unsigned *pcount ) { unsigned r, column_count = 0; - MSICOLUMNINFO *columns; + LibmsiColumnInfo *columns; /* get the number of columns in this table */ column_count = 0; @@ -569,7 +569,7 @@ static unsigned table_get_column_info( MSIDATABASE *db, const WCHAR *name, MSICO TRACE("table %s found\n", debugstr_w(name)); - columns = msi_alloc( column_count * sizeof(MSICOLUMNINFO) ); + columns = msi_alloc( column_count * sizeof(LibmsiColumnInfo) ); if (!columns) return ERROR_FUNCTION_FAILED; @@ -583,9 +583,9 @@ static unsigned table_get_column_info( MSIDATABASE *db, const WCHAR *name, MSICO return r; } -static unsigned get_table( MSIDATABASE *db, const WCHAR *name, MSITABLE **table_ret ) +static unsigned get_table( LibmsiDatabase *db, const WCHAR *name, LibmsiTable **table_ret ) { - MSITABLE *table; + LibmsiTable *table; unsigned r; /* first, see if the table is cached */ @@ -597,7 +597,7 @@ static unsigned get_table( MSIDATABASE *db, const WCHAR *name, MSITABLE **table_ } /* nonexistent tables should be interpreted as empty tables */ - table = msi_alloc( sizeof(MSITABLE) + lstrlenW( name ) * sizeof(WCHAR) ); + table = msi_alloc( sizeof(LibmsiTable) + lstrlenW( name ) * sizeof(WCHAR) ); if (!table) return ERROR_FUNCTION_FAILED; @@ -606,11 +606,11 @@ static unsigned get_table( MSIDATABASE *db, const WCHAR *name, MSITABLE **table_ table->data_persistent = NULL; table->colinfo = NULL; table->col_count = 0; - table->persistent = MSICONDITION_TRUE; + table->persistent = LIBMSI_CONDITION_TRUE; lstrcpyW( table->name, name ); if (!strcmpW( name, szTables ) || !strcmpW( name, szColumns )) - table->persistent = MSICONDITION_NONE; + table->persistent = LIBMSI_CONDITION_NONE; r = table_get_column_info( db, name, &table->colinfo, &table->col_count ); if (r != ERROR_SUCCESS) @@ -639,10 +639,10 @@ static unsigned read_table_int( uint8_t *const *data, unsigned row, unsigned col return ret; } -static unsigned get_tablecolumns( MSIDATABASE *db, const WCHAR *szTableName, MSICOLUMNINFO *colinfo, unsigned *sz ) +static unsigned get_tablecolumns( LibmsiDatabase *db, const WCHAR *szTableName, LibmsiColumnInfo *colinfo, unsigned *sz ) { unsigned r, i, n = 0, table_id, count, maxcount = *sz; - MSITABLE *table = NULL; + LibmsiTable *table = NULL; TRACE("%s\n", debugstr_w(szTableName)); @@ -716,15 +716,15 @@ static unsigned get_tablecolumns( MSIDATABASE *db, const WCHAR *szTableName, MSI return ERROR_SUCCESS; } -unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_info, - MSICONDITION persistent ) +unsigned msi_create_table( LibmsiDatabase *db, const WCHAR *name, column_info *col_info, + LibmsiCondition persistent ) { enum StringPersistence string_persistence = (persistent) ? StringPersistent : StringNonPersistent; unsigned r, nField; - MSIVIEW *tv = NULL; - MSIRECORD *rec = NULL; + LibmsiView *tv = NULL; + LibmsiRecord *rec = NULL; column_info *col; - MSITABLE *table; + LibmsiTable *table; unsigned i; /* only add tables that don't exist already */ @@ -734,7 +734,7 @@ unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_ return ERROR_BAD_QUERY_SYNTAX; } - table = msi_alloc( sizeof (MSITABLE) + lstrlenW(name)*sizeof (WCHAR) ); + table = msi_alloc( sizeof (LibmsiTable) + lstrlenW(name)*sizeof (WCHAR) ); if( !table ) return ERROR_FUNCTION_FAILED; @@ -750,7 +750,7 @@ unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_ for( col = col_info; col; col = col->next ) table->col_count++; - table->colinfo = msi_alloc( table->col_count * sizeof(MSICOLUMNINFO) ); + table->colinfo = msi_alloc( table->col_count * sizeof(LibmsiColumnInfo) ); if (!table->colinfo) { free_table( table ); @@ -794,7 +794,7 @@ unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_ if( r ) goto err; - r = tv->ops->insert_row( tv, rec, -1, persistent == MSICONDITION_FALSE ); + r = tv->ops->insert_row( tv, rec, -1, persistent == LIBMSI_CONDITION_FALSE ); TRACE("insert_row returned %x\n", r); if( r ) goto err; @@ -805,7 +805,7 @@ unsigned msi_create_table( MSIDATABASE *db, const WCHAR *name, column_info *col_ msiobj_release( &rec->hdr ); rec = NULL; - if( persistent != MSICONDITION_FALSE ) + if( persistent != LIBMSI_CONDITION_FALSE ) { /* add each column to the _Columns table */ r = TABLE_CreateView( db, szColumns, &tv ); @@ -869,14 +869,14 @@ err: return r; } -static unsigned save_table( MSIDATABASE *db, const MSITABLE *t, unsigned bytes_per_strref ) +static unsigned save_table( LibmsiDatabase *db, const LibmsiTable *t, unsigned bytes_per_strref ) { uint8_t *rawdata = NULL; unsigned rawsize, i, j, row_size, row_count; unsigned r = ERROR_FUNCTION_FAILED; /* Nothing to do for non-persistent tables */ - if( t->persistent == MSICONDITION_FALSE ) + if( t->persistent == LIBMSI_CONDITION_FALSE ) return ERROR_SUCCESS; TRACE("Saving %s\n", debugstr_w( t->name ) ); @@ -944,9 +944,9 @@ err: return r; } -static void msi_update_table_columns( MSIDATABASE *db, const WCHAR *name ) +static void msi_update_table_columns( LibmsiDatabase *db, const WCHAR *name ) { - MSITABLE *table; + LibmsiTable *table; unsigned size, offset, old_count; unsigned n; @@ -971,10 +971,10 @@ static void msi_update_table_columns( MSIDATABASE *db, const WCHAR *name ) } /* try to find the table name in the _Tables table */ -bool TABLE_Exists( MSIDATABASE *db, const WCHAR *name ) +bool TABLE_Exists( LibmsiDatabase *db, const WCHAR *name ) { unsigned r, table_id, i; - MSITABLE *table; + LibmsiTable *table; if( !strcmpW( name, szTables ) || !strcmpW( name, szColumns ) || !strcmpW( name, szStreams ) || !strcmpW( name, szStorages ) ) @@ -1005,20 +1005,20 @@ bool TABLE_Exists( MSIDATABASE *db, const WCHAR *name ) /* below is the query interface to a table */ -typedef struct tagMSITABLEVIEW +typedef struct LibmsiTableVIEW { - MSIVIEW view; - MSIDATABASE *db; - MSITABLE *table; - MSICOLUMNINFO *columns; + LibmsiView view; + LibmsiDatabase *db; + LibmsiTable *table; + LibmsiColumnInfo *columns; unsigned num_cols; unsigned row_size; WCHAR name[1]; -} MSITABLEVIEW; +} LibmsiTableVIEW; -static unsigned TABLE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned TABLE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned offset, n; if( !tv->table ) @@ -1053,14 +1053,14 @@ static unsigned TABLE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsi return ERROR_SUCCESS; } -static unsigned msi_stream_name( const MSITABLEVIEW *tv, unsigned row, WCHAR **pstname ) +static unsigned msi_stream_name( const LibmsiTableVIEW *tv, unsigned row, WCHAR **pstname ) { WCHAR *p; WCHAR *stname = NULL; unsigned i, r, type, ival; unsigned len; const WCHAR *sval; - MSIVIEW *view = (MSIVIEW *) tv; + LibmsiView *view = (LibmsiView *) tv; TRACE("%p %d\n", tv, row); @@ -1145,9 +1145,9 @@ err: * the name of the stream in the same table, and the table name * which may not be available at higher levels of the query */ -static unsigned TABLE_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, IStream **stm ) +static unsigned TABLE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned r; WCHAR *encname; WCHAR *full_name = NULL; @@ -1172,7 +1172,7 @@ static unsigned TABLE_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, I return r; } -static unsigned TABLE_set_int( MSITABLEVIEW *tv, unsigned row, unsigned col, unsigned val ) +static unsigned TABLE_set_int( LibmsiTableVIEW *tv, unsigned row, unsigned col, unsigned val ) { unsigned offset, n, i; @@ -1209,9 +1209,9 @@ static unsigned TABLE_set_int( MSITABLEVIEW *tv, unsigned row, unsigned col, uns return ERROR_SUCCESS; } -static unsigned TABLE_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned TABLE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; if (!tv->table) return ERROR_INVALID_PARAMETER; @@ -1219,15 +1219,15 @@ static unsigned TABLE_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) return msi_view_get_row(tv->db, view, row, rec); } -static unsigned msi_addstreamW( MSIDATABASE *db, const WCHAR *name, IStream *data ) +static unsigned msi_addstreamW( LibmsiDatabase *db, const WCHAR *name, IStream *data ) { static const WCHAR insert[] = { 'I','N','S','E','R','T',' ','I','N','T','O',' ', '`','_','S','t','r','e','a','m','s','`',' ', '(','`','N','a','m','e','`',',','`','D','a','t','a','`',')',' ', 'V','A','L','U','E','S',' ','(','?',',','?',')',0}; - MSIQUERY *query = NULL; - MSIRECORD *rec; + LibmsiQuery *query = NULL; + LibmsiRecord *rec; unsigned r; TRACE("%p %s %p\n", db, debugstr_w(name), data); @@ -1256,9 +1256,9 @@ err: return r; } -static unsigned get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, unsigned iField, unsigned *pvalue ) +static unsigned get_table_value_from_record( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned iField, unsigned *pvalue ) { - MSICOLUMNINFO columninfo; + LibmsiColumnInfo columninfo; unsigned r; if ( (iField <= 0) || @@ -1301,9 +1301,9 @@ static unsigned get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, u return ERROR_SUCCESS; } -static unsigned TABLE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask ) +static unsigned TABLE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned i, val, r = ERROR_SUCCESS; if ( !tv->table ) @@ -1321,7 +1321,7 @@ static unsigned TABLE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsi if ( !(mask&(1<table->persistent != MSICONDITION_FALSE) && + persistent = (tv->table->persistent != LIBMSI_CONDITION_FALSE) && (tv->table->data_persistent[row]); /* FIXME: should we allow updating keys? */ @@ -1386,9 +1386,9 @@ static unsigned TABLE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsi return r; } -static unsigned table_create_new_row( MSIVIEW *view, unsigned *num, bool temporary ) +static unsigned table_create_new_row( LibmsiView *view, unsigned *num, bool temporary ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; uint8_t **p, *row; bool *b; unsigned sz; @@ -1445,9 +1445,9 @@ static unsigned table_create_new_row( MSIVIEW *view, unsigned *num, bool tempora return ERROR_SUCCESS; } -static unsigned TABLE_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned TABLE_execute( LibmsiView *view, LibmsiRecord *record ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; TRACE("%p %p\n", tv, record); @@ -1456,16 +1456,16 @@ static unsigned TABLE_execute( MSIVIEW *view, MSIRECORD *record ) return ERROR_SUCCESS; } -static unsigned TABLE_close( MSIVIEW *view ) +static unsigned TABLE_close( LibmsiView *view ) { TRACE("%p\n", view ); return ERROR_SUCCESS; } -static unsigned TABLE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols) +static unsigned TABLE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; TRACE("%p %p %p\n", view, rows, cols ); @@ -1481,11 +1481,11 @@ static unsigned TABLE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *c return ERROR_SUCCESS; } -static unsigned TABLE_get_column_info( MSIVIEW *view, +static unsigned TABLE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; TRACE("%p %d %p %p\n", tv, n, name, type ); @@ -1515,9 +1515,9 @@ static unsigned TABLE_get_column_info( MSIVIEW *view, return ERROR_SUCCESS; } -static unsigned msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, unsigned *row, unsigned *column ); +static unsigned msi_table_find_row( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ); -static unsigned table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, unsigned *column ) +static unsigned table_validate_new( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *column ) { unsigned r, row, i; @@ -1561,7 +1561,7 @@ static unsigned table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec, unsigned * return ERROR_SUCCESS; } -static int compare_record( MSITABLEVIEW *tv, unsigned row, MSIRECORD *rec ) +static int compare_record( LibmsiTableVIEW *tv, unsigned row, LibmsiRecord *rec ) { unsigned r, i, ivalue, x; @@ -1594,7 +1594,7 @@ static int compare_record( MSITABLEVIEW *tv, unsigned row, MSIRECORD *rec ) return 1; } -static int find_insert_index( MSITABLEVIEW *tv, MSIRECORD *rec ) +static int find_insert_index( LibmsiTableVIEW *tv, LibmsiRecord *rec ) { int idx, c, low = 0, high = tv->table->row_count - 1; @@ -1619,9 +1619,9 @@ static int find_insert_index( MSITABLEVIEW *tv, MSIRECORD *rec ) return high + 1; } -static unsigned TABLE_insert_row( MSIVIEW *view, MSIRECORD *rec, unsigned row, bool temporary ) +static unsigned TABLE_insert_row( LibmsiView *view, LibmsiRecord *rec, unsigned row, bool temporary ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned i, r; TRACE("%p %p %s\n", tv, rec, temporary ? "true" : "false" ); @@ -1652,9 +1652,9 @@ static unsigned TABLE_insert_row( MSIVIEW *view, MSIRECORD *rec, unsigned row, b return TABLE_set_row( view, row, rec, (1<num_cols) - 1 ); } -static unsigned TABLE_delete_row( MSIVIEW *view, unsigned row ) +static unsigned TABLE_delete_row( LibmsiView *view, unsigned row ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned r, num_rows, num_cols, i; TRACE("%p %d\n", tv, row); @@ -1690,9 +1690,9 @@ static unsigned TABLE_delete_row( MSIVIEW *view, unsigned row ) return ERROR_SUCCESS; } -static unsigned msi_table_update(MSIVIEW *view, MSIRECORD *rec, unsigned row) +static unsigned msi_table_update(LibmsiView *view, LibmsiRecord *rec, unsigned row) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; unsigned r, new_row; /* FIXME: MsiViewFetch should set rec index 0 to some ID that @@ -1716,9 +1716,9 @@ static unsigned msi_table_update(MSIVIEW *view, MSIRECORD *rec, unsigned row) return TABLE_set_row(view, new_row, rec, (1 << tv->num_cols) - 1); } -static unsigned msi_table_assign(MSIVIEW *view, MSIRECORD *rec) +static unsigned msi_table_assign(LibmsiView *view, LibmsiRecord *rec) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; unsigned r, row; if (!tv->table) @@ -1731,9 +1731,9 @@ static unsigned msi_table_assign(MSIVIEW *view, MSIRECORD *rec) return TABLE_insert_row( view, rec, -1, false ); } -static unsigned modify_delete_row( MSIVIEW *view, MSIRECORD *rec ) +static unsigned modify_delete_row( LibmsiView *view, LibmsiRecord *rec ) { - MSITABLEVIEW *tv = (MSITABLEVIEW *)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW *)view; unsigned row, r; r = msi_table_find_row(tv, rec, &row, NULL); @@ -1743,9 +1743,9 @@ static unsigned modify_delete_row( MSIVIEW *view, MSIRECORD *rec ) return TABLE_delete_row(view, row); } -static unsigned msi_refresh_record( MSIVIEW *view, MSIRECORD *rec, unsigned row ) +static unsigned msi_refresh_record( LibmsiView *view, LibmsiRecord *rec, unsigned row ) { - MSIRECORD *curr; + LibmsiRecord *curr; unsigned r, i, count; r = TABLE_get_row(view, row - 1, &curr); @@ -1763,56 +1763,56 @@ static unsigned msi_refresh_record( MSIVIEW *view, MSIRECORD *rec, unsigned row return ERROR_SUCCESS; } -static unsigned TABLE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row) +static unsigned TABLE_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned r, frow, column; TRACE("%p %d %p\n", view, eModifyMode, rec ); switch (eModifyMode) { - case MSIMODIFY_DELETE: + case LIBMSI_MODIFY_DELETE: r = modify_delete_row( view, rec ); break; - case MSIMODIFY_VALIDATE_NEW: + case LIBMSI_MODIFY_VALIDATE_NEW: r = table_validate_new( tv, rec, &column ); if (r != ERROR_SUCCESS) { - tv->view.error = MSIDBERROR_DUPLICATEKEY; + tv->view.error = LIBMSI_DB_ERROR_DUPLICATEKEY; tv->view.error_column = tv->columns[column].colname; r = ERROR_INVALID_DATA; } break; - case MSIMODIFY_INSERT: + case LIBMSI_MODIFY_INSERT: r = table_validate_new( tv, rec, NULL ); if (r != ERROR_SUCCESS) break; r = TABLE_insert_row( view, rec, -1, false ); break; - case MSIMODIFY_INSERT_TEMPORARY: + case LIBMSI_MODIFY_INSERT_TEMPORARY: r = table_validate_new( tv, rec, NULL ); if (r != ERROR_SUCCESS) break; r = TABLE_insert_row( view, rec, -1, true ); break; - case MSIMODIFY_REFRESH: + case LIBMSI_MODIFY_REFRESH: r = msi_refresh_record( view, rec, row ); break; - case MSIMODIFY_UPDATE: + case LIBMSI_MODIFY_UPDATE: r = msi_table_update( view, rec, row ); break; - case MSIMODIFY_ASSIGN: + case LIBMSI_MODIFY_ASSIGN: r = msi_table_assign( view, rec ); break; - case MSIMODIFY_MERGE: + case LIBMSI_MODIFY_MERGE: /* check row that matches this record */ r = msi_table_find_row( tv, rec, &frow, &column ); if (r != ERROR_SUCCESS) @@ -1823,10 +1823,10 @@ static unsigned TABLE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, } break; - case MSIMODIFY_REPLACE: - case MSIMODIFY_VALIDATE: - case MSIMODIFY_VALIDATE_FIELD: - case MSIMODIFY_VALIDATE_DELETE: + case LIBMSI_MODIFY_REPLACE: + case LIBMSI_MODIFY_VALIDATE: + case LIBMSI_MODIFY_VALIDATE_FIELD: + case LIBMSI_MODIFY_VALIDATE_DELETE: FIXME("%p %d %p - mode not implemented\n", view, eModifyMode, rec ); r = ERROR_CALL_NOT_IMPLEMENTED; break; @@ -1838,9 +1838,9 @@ static unsigned TABLE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, return r; } -static unsigned TABLE_delete( MSIVIEW *view ) +static unsigned TABLE_delete( LibmsiView *view ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; TRACE("%p\n", view ); @@ -1852,11 +1852,11 @@ static unsigned TABLE_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned TABLE_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned TABLE_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - const MSICOLUMNHASHENTRY *entry; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + const LibmsiColumnHashEntry *entry; TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -1870,8 +1870,8 @@ static unsigned TABLE_find_matching_rows( MSIVIEW *view, unsigned col, { unsigned i; unsigned num_rows = tv->table->row_count; - MSICOLUMNHASHENTRY **hash_table; - MSICOLUMNHASHENTRY *new_entry; + LibmsiColumnHashEntry **hash_table; + LibmsiColumnHashEntry *new_entry; if( tv->columns[col-1].offset >= tv->row_size ) { @@ -1882,15 +1882,15 @@ static unsigned TABLE_find_matching_rows( MSIVIEW *view, unsigned col, /* allocate contiguous memory for the table and its entries so we * don't have to do an expensive cleanup */ - hash_table = msi_alloc(MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*) + - num_rows * sizeof(MSICOLUMNHASHENTRY)); + hash_table = msi_alloc(LibmsiTable_HASH_TABLE_SIZE * sizeof(LibmsiColumnHashEntry*) + + num_rows * sizeof(LibmsiColumnHashEntry)); if (!hash_table) return ERROR_OUTOFMEMORY; - memset(hash_table, 0, MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*)); + memset(hash_table, 0, LibmsiTable_HASH_TABLE_SIZE * sizeof(LibmsiColumnHashEntry*)); tv->columns[col-1].hash_table = hash_table; - new_entry = (MSICOLUMNHASHENTRY *)(hash_table + MSITABLE_HASH_TABLE_SIZE); + new_entry = (LibmsiColumnHashEntry *)(hash_table + LibmsiTable_HASH_TABLE_SIZE); for (i = 0; i < num_rows; i++, new_entry++) { @@ -1902,20 +1902,20 @@ static unsigned TABLE_find_matching_rows( MSIVIEW *view, unsigned col, new_entry->next = NULL; new_entry->value = row_value; new_entry->row = i; - if (hash_table[row_value % MSITABLE_HASH_TABLE_SIZE]) + if (hash_table[row_value % LibmsiTable_HASH_TABLE_SIZE]) { - MSICOLUMNHASHENTRY *prev_entry = hash_table[row_value % MSITABLE_HASH_TABLE_SIZE]; + LibmsiColumnHashEntry *prev_entry = hash_table[row_value % LibmsiTable_HASH_TABLE_SIZE]; while (prev_entry->next) prev_entry = prev_entry->next; prev_entry->next = new_entry; } else - hash_table[row_value % MSITABLE_HASH_TABLE_SIZE] = new_entry; + hash_table[row_value % LibmsiTable_HASH_TABLE_SIZE] = new_entry; } } if( !*handle ) - entry = tv->columns[col-1].hash_table[val % MSITABLE_HASH_TABLE_SIZE]; + entry = tv->columns[col-1].hash_table[val % LibmsiTable_HASH_TABLE_SIZE]; else entry = (*handle)->next; @@ -1931,9 +1931,9 @@ static unsigned TABLE_find_matching_rows( MSIVIEW *view, unsigned col, return ERROR_SUCCESS; } -static unsigned TABLE_add_ref(MSIVIEW *view) +static unsigned TABLE_add_ref(LibmsiView *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; unsigned i; TRACE("%p %d\n", view, tv->table->ref_count); @@ -1947,11 +1947,11 @@ static unsigned TABLE_add_ref(MSIVIEW *view) return InterlockedIncrement(&tv->table->ref_count); } -static unsigned TABLE_remove_column(MSIVIEW *view, const WCHAR *table, unsigned number) +static unsigned TABLE_remove_column(LibmsiView *view, const WCHAR *table, unsigned number) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - MSIRECORD *rec = NULL; - MSIVIEW *columns = NULL; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiRecord *rec = NULL; + LibmsiView *columns = NULL; unsigned row, r; rec = MSI_CreateRecord(2); @@ -1965,7 +1965,7 @@ static unsigned TABLE_remove_column(MSIVIEW *view, const WCHAR *table, unsigned if (r != ERROR_SUCCESS) return r; - r = msi_table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL); + r = msi_table_find_row((LibmsiTableVIEW *)columns, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; @@ -1981,9 +1981,9 @@ done: return r; } -static unsigned TABLE_release(MSIVIEW *view) +static unsigned TABLE_release(LibmsiView *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; int ref = tv->table->ref_count; unsigned i, r; @@ -2018,12 +2018,12 @@ static unsigned TABLE_release(MSIVIEW *view) return ref; } -static unsigned TABLE_add_column(MSIVIEW *view, const WCHAR *table, unsigned number, +static unsigned TABLE_add_column(LibmsiView *view, const WCHAR *table, unsigned number, const WCHAR *column, unsigned type, bool hold) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - MSITABLE *msitable; - MSIRECORD *rec; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiTable *msitable; + LibmsiRecord *rec; unsigned r, i; rec = MSI_CreateRecord(4); @@ -2059,11 +2059,11 @@ done: return r; } -static unsigned TABLE_drop(MSIVIEW *view) +static unsigned TABLE_drop(LibmsiView *view) { - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - MSIVIEW *tables = NULL; - MSIRECORD *rec = NULL; + LibmsiTableVIEW *tv = (LibmsiTableVIEW*)view; + LibmsiView *tables = NULL; + LibmsiRecord *rec = NULL; unsigned r, row; int i; @@ -2087,7 +2087,7 @@ static unsigned TABLE_drop(MSIVIEW *view) if (r != ERROR_SUCCESS) return r; - r = msi_table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL); + r = msi_table_find_row((LibmsiTableVIEW *)tables, rec, &row, NULL); if (r != ERROR_SUCCESS) goto done; @@ -2105,7 +2105,7 @@ done: return r; } -static const MSIVIEWOPS table_ops = +static const LibmsiViewOPS table_ops = { TABLE_fetch_int, TABLE_fetch_stream, @@ -2128,9 +2128,9 @@ static const MSIVIEWOPS table_ops = TABLE_drop, }; -unsigned TABLE_CreateView( MSIDATABASE *db, const WCHAR *name, MSIVIEW **view ) +unsigned TABLE_CreateView( LibmsiDatabase *db, const WCHAR *name, LibmsiView **view ) { - MSITABLEVIEW *tv ; + LibmsiTableVIEW *tv ; unsigned r, sz; TRACE("%p %s %p\n", db, debugstr_w(name), view ); @@ -2164,17 +2164,17 @@ unsigned TABLE_CreateView( MSIDATABASE *db, const WCHAR *name, MSIVIEW **view ) TRACE("%s one row is %d bytes\n", debugstr_w(name), tv->row_size ); - *view = (MSIVIEW*) tv; + *view = (LibmsiView*) tv; lstrcpyW( tv->name, name ); return ERROR_SUCCESS; } -unsigned MSI_CommitTables( MSIDATABASE *db ) +unsigned MSI_CommitTables( LibmsiDatabase *db ) { unsigned r, bytes_per_strref; HRESULT hr; - MSITABLE *table = NULL; + LibmsiTable *table = NULL; TRACE("%p\n",db); @@ -2185,7 +2185,7 @@ unsigned MSI_CommitTables( MSIDATABASE *db ) return r; } - LIST_FOR_EACH_ENTRY( table, &db->tables, MSITABLE, entry ) + LIST_FOR_EACH_ENTRY( table, &db->tables, LibmsiTable, entry ) { r = save_table( db, table, bytes_per_strref ); if( r != ERROR_SUCCESS ) @@ -2205,19 +2205,19 @@ unsigned MSI_CommitTables( MSIDATABASE *db ) return r; } -MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, const WCHAR *table ) +LibmsiCondition MSI_DatabaseIsTablePersistent( LibmsiDatabase *db, const WCHAR *table ) { - MSITABLE *t; + LibmsiTable *t; unsigned r; TRACE("%p %s\n", db, debugstr_w(table)); if (!table) - return MSICONDITION_ERROR; + return LIBMSI_CONDITION_ERROR; r = get_table( db, table, &t ); if (r != ERROR_SUCCESS) - return MSICONDITION_NONE; + return LIBMSI_CONDITION_NONE; return t->persistent; } @@ -2232,7 +2232,7 @@ static unsigned read_raw_int(const uint8_t *data, unsigned col, unsigned bytes) return ret; } -static unsigned msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, WCHAR **pstname ) +static unsigned msi_record_encoded_stream_name( const LibmsiTableVIEW *tv, LibmsiRecord *rec, WCHAR **pstname ) { WCHAR *stname = NULL; WCHAR *sval; @@ -2292,14 +2292,14 @@ err: return r; } -static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string_table *st, +static LibmsiRecord *msi_get_transform_record( const LibmsiTableVIEW *tv, const string_table *st, IStorage *stg, const uint8_t *rawdata, unsigned bytes_per_strref ) { unsigned i, val, ofs = 0; uint16_t mask; - MSICOLUMNINFO *columns = tv->columns; - MSIRECORD *rec; + LibmsiColumnInfo *columns = tv->columns; + LibmsiRecord *rec; mask = rawdata[0] | (rawdata[1] << 8); rawdata += 2; @@ -2378,7 +2378,7 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string return rec; } -static void dump_record( MSIRECORD *rec ) +static void dump_record( LibmsiRecord *rec ) { unsigned i, n; @@ -2408,7 +2408,7 @@ static void dump_table( const string_table *st, const uint16_t *rawdata, unsigne } } -static unsigned* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) +static unsigned* msi_record_to_row( const LibmsiTableVIEW *tv, LibmsiRecord *rec ) { const WCHAR *str; unsigned i, r, *data; @@ -2455,7 +2455,7 @@ static unsigned* msi_record_to_row( const MSITABLEVIEW *tv, MSIRECORD *rec ) return data; } -static unsigned msi_row_matches( MSITABLEVIEW *tv, unsigned row, const unsigned *data, unsigned *column ) +static unsigned msi_row_matches( LibmsiTableVIEW *tv, unsigned row, const unsigned *data, unsigned *column ) { unsigned i, r, x, ret = ERROR_FUNCTION_FAILED; @@ -2484,7 +2484,7 @@ static unsigned msi_row_matches( MSITABLEVIEW *tv, unsigned row, const unsigned return ret; } -static unsigned msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, unsigned *row, unsigned *column ) +static unsigned msi_table_find_row( LibmsiTableVIEW *tv, LibmsiRecord *rec, unsigned *row, unsigned *column ) { unsigned i, r = ERROR_FUNCTION_FAILED, *data; @@ -2510,14 +2510,14 @@ typedef struct WCHAR *name; } TRANSFORMDATA; -static unsigned msi_table_load_transform( MSIDATABASE *db, IStorage *stg, +static unsigned msi_table_load_transform( LibmsiDatabase *db, IStorage *stg, string_table *st, TRANSFORMDATA *transform, unsigned bytes_per_strref ) { uint8_t *rawdata = NULL; - MSITABLEVIEW *tv = NULL; + LibmsiTableVIEW *tv = NULL; unsigned r, n, sz, i, mask, num_cols, colcol = 0, rawsize = 0; - MSIRECORD *rec = NULL; + LibmsiRecord *rec = NULL; WCHAR coltable[32]; const WCHAR *name; @@ -2538,7 +2538,7 @@ static unsigned msi_table_load_transform( MSIDATABASE *db, IStorage *stg, } /* create a table view */ - r = TABLE_CreateView( db, name, (MSIVIEW**) &tv ); + r = TABLE_CreateView( db, name, (LibmsiView**) &tv ); if( r != ERROR_SUCCESS ) goto err; @@ -2692,7 +2692,7 @@ err: * * Enumerate the table transforms in a transform storage and apply each one. */ -unsigned msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) +unsigned msi_table_apply_transform( LibmsiDatabase *db, IStorage *stg ) { struct list transforms; IEnumSTATSTG *stgenum = NULL; @@ -2718,7 +2718,7 @@ unsigned msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) while ( true ) { - MSITABLEVIEW *tv = NULL; + LibmsiTableVIEW *tv = NULL; WCHAR name[0x40]; unsigned count = 0; @@ -2751,7 +2751,7 @@ unsigned msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) TRACE("transform contains stream %s\n", debugstr_w(name)); /* load the table */ - r = TABLE_CreateView( db, transform->name, (MSIVIEW**) &tv ); + r = TABLE_CreateView( db, transform->name, (LibmsiView**) &tv ); if( r != ERROR_SUCCESS ) continue; diff --git a/libmsi/update.c b/libmsi/update.c index f3f64df..b169644 100644 --- a/libmsi/update.c +++ b/libmsi/update.c @@ -36,30 +36,30 @@ /* below is the query interface to a table */ -typedef struct tagMSIUPDATEVIEW +typedef struct LibmsiUpdateView { - MSIVIEW view; - MSIDATABASE *db; - MSIVIEW *wv; + LibmsiView view; + LibmsiDatabase *db; + LibmsiView *wv; column_info *vals; -} MSIUPDATEVIEW; +} LibmsiUpdateView; -static unsigned UPDATE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned UPDATE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; TRACE("%p %d %d %p\n", uv, row, col, val ); return ERROR_FUNCTION_FAILED; } -static unsigned UPDATE_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned UPDATE_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; unsigned i, r, col_count = 0, row_count = 0; - MSIRECORD *values = NULL; - MSIRECORD *where = NULL; - MSIVIEW *wv; + LibmsiRecord *values = NULL; + LibmsiRecord *where = NULL; + LibmsiView *wv; unsigned cols_count, where_count; column_info *col = uv->vals; @@ -124,10 +124,10 @@ done: } -static unsigned UPDATE_close( MSIVIEW *view ) +static unsigned UPDATE_close( LibmsiView *view ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; - MSIVIEW *wv; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; + LibmsiView *wv; TRACE("%p\n", uv); @@ -138,10 +138,10 @@ static unsigned UPDATE_close( MSIVIEW *view ) return wv->ops->close( wv ); } -static unsigned UPDATE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned UPDATE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; - MSIVIEW *wv; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; + LibmsiView *wv; TRACE("%p %p %p\n", uv, rows, cols ); @@ -152,11 +152,11 @@ static unsigned UPDATE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned * return wv->ops->get_dimensions( wv, rows, cols ); } -static unsigned UPDATE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned UPDATE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; - MSIVIEW *wv; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; + LibmsiView *wv; TRACE("%p %d %p %p %p %p\n", uv, n, name, type, temporary, table_name ); @@ -167,20 +167,20 @@ static unsigned UPDATE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR * return wv->ops->get_column_info( wv, n, name, type, temporary, table_name ); } -static unsigned UPDATE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned UPDATE_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; TRACE("%p %d %p\n", uv, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } -static unsigned UPDATE_delete( MSIVIEW *view ) +static unsigned UPDATE_delete( LibmsiView *view ) { - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; - MSIVIEW *wv; + LibmsiUpdateView *uv = (LibmsiUpdateView*)view; + LibmsiView *wv; TRACE("%p\n", uv ); @@ -193,7 +193,7 @@ static unsigned UPDATE_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned UPDATE_find_matching_rows( MSIVIEW *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) +static unsigned UPDATE_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { TRACE("%p %d %d %p\n", view, col, val, *handle ); @@ -201,7 +201,7 @@ static unsigned UPDATE_find_matching_rows( MSIVIEW *view, unsigned col, unsigned } -static const MSIVIEWOPS update_ops = +static const LibmsiViewOPS update_ops = { UPDATE_fetch_int, NULL, @@ -223,12 +223,12 @@ static const MSIVIEWOPS update_ops = NULL, }; -unsigned UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *table, +unsigned UPDATE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *table, column_info *columns, struct expr *expr ) { - MSIUPDATEVIEW *uv = NULL; + LibmsiUpdateView *uv = NULL; unsigned r; - MSIVIEW *sv = NULL, *wv = NULL; + LibmsiView *sv = NULL, *wv = NULL; TRACE("%p\n", uv ); @@ -261,7 +261,7 @@ unsigned UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *table, uv->db = db; uv->vals = columns; uv->wv = sv; - *view = (MSIVIEW*) uv; + *view = (LibmsiView*) uv; return ERROR_SUCCESS; } diff --git a/libmsi/where.c b/libmsi/where.c index 7848749..2c10d18 100644 --- a/libmsi/where.c +++ b/libmsi/where.c @@ -37,51 +37,51 @@ /* below is the query interface to a table */ -typedef struct tagMSIROWENTRY +typedef struct LibmsiRowEntry { - struct tagMSIWHEREVIEW *wv; /* used during sorting */ + struct LibmsiWhereView *wv; /* used during sorting */ unsigned values[1]; -} MSIROWENTRY; +} LibmsiRowEntry; typedef struct tagJOINTABLE { struct tagJOINTABLE *next; - MSIVIEW *view; + LibmsiView *view; unsigned col_count; unsigned row_count; unsigned table_index; } JOINTABLE; -typedef struct tagMSIORDERINFO +typedef struct LibmsiOrderInfo { unsigned col_count; unsigned error; union ext_column columns[1]; -} MSIORDERINFO; +} LibmsiOrderInfo; -typedef struct tagMSIWHEREVIEW +typedef struct LibmsiWhereView { - MSIVIEW view; - MSIDATABASE *db; + LibmsiView view; + LibmsiDatabase *db; JOINTABLE *tables; unsigned row_count; unsigned col_count; unsigned table_count; - MSIROWENTRY **reorder; + LibmsiRowEntry **reorder; unsigned reorder_size; /* number of entries available in reorder */ struct expr *cond; unsigned rec_index; - MSIORDERINFO *order_info; -} MSIWHEREVIEW; + LibmsiOrderInfo *order_info; +} LibmsiWhereView; -static unsigned WHERE_evaluate( MSIWHEREVIEW *wv, const unsigned rows[], - struct expr *cond, int *val, MSIRECORD *record ); +static unsigned WHERE_evaluate( LibmsiWhereView *wv, const unsigned rows[], + struct expr *cond, int *val, LibmsiRecord *record ); #define INITIAL_REORDER_SIZE 16 #define INVALID_ROW_INDEX (-1) -static void free_reorder(MSIWHEREVIEW *wv) +static void free_reorder(LibmsiWhereView *wv) { unsigned i; @@ -97,9 +97,9 @@ static void free_reorder(MSIWHEREVIEW *wv) wv->row_count = 0; } -static unsigned init_reorder(MSIWHEREVIEW *wv) +static unsigned init_reorder(LibmsiWhereView *wv) { - MSIROWENTRY **new = msi_alloc_zero(sizeof(MSIROWENTRY *) * INITIAL_REORDER_SIZE); + LibmsiRowEntry **new = msi_alloc_zero(sizeof(LibmsiRowEntry *) * INITIAL_REORDER_SIZE); if (!new) return ERROR_OUTOFMEMORY; @@ -111,7 +111,7 @@ static unsigned init_reorder(MSIWHEREVIEW *wv) return ERROR_SUCCESS; } -static inline unsigned find_row(MSIWHEREVIEW *wv, unsigned row, unsigned *(values[])) +static inline unsigned find_row(LibmsiWhereView *wv, unsigned row, unsigned *(values[])) { if (row >= wv->row_count) return ERROR_NO_MORE_ITEMS; @@ -121,16 +121,16 @@ static inline unsigned find_row(MSIWHEREVIEW *wv, unsigned row, unsigned *(value return ERROR_SUCCESS; } -static unsigned add_row(MSIWHEREVIEW *wv, unsigned vals[]) +static unsigned add_row(LibmsiWhereView *wv, unsigned vals[]) { - MSIROWENTRY *new; + LibmsiRowEntry *new; if (wv->reorder_size <= wv->row_count) { - MSIROWENTRY **new_reorder; + LibmsiRowEntry **new_reorder; unsigned newsize = wv->reorder_size * 2; - new_reorder = msi_realloc_zero(wv->reorder, sizeof(MSIROWENTRY *) * newsize); + new_reorder = msi_realloc_zero(wv->reorder, sizeof(LibmsiRowEntry *) * newsize); if (!new_reorder) return ERROR_OUTOFMEMORY; @@ -138,7 +138,7 @@ static unsigned add_row(MSIWHEREVIEW *wv, unsigned vals[]) wv->reorder_size = newsize; } - new = msi_alloc(FIELD_OFFSET( MSIROWENTRY, values[wv->table_count] )); + new = msi_alloc(FIELD_OFFSET( LibmsiRowEntry, values[wv->table_count] )); if (!new) return ERROR_OUTOFMEMORY; @@ -151,7 +151,7 @@ static unsigned add_row(MSIWHEREVIEW *wv, unsigned vals[]) return ERROR_SUCCESS; } -static JOINTABLE *find_table(MSIWHEREVIEW *wv, unsigned col, unsigned *table_col) +static JOINTABLE *find_table(LibmsiWhereView *wv, unsigned col, unsigned *table_col) { JOINTABLE *table = wv->tables; @@ -169,7 +169,7 @@ static JOINTABLE *find_table(MSIWHEREVIEW *wv, unsigned col, unsigned *table_col return table; } -static unsigned parse_column(MSIWHEREVIEW *wv, union ext_column *column, +static unsigned parse_column(LibmsiWhereView *wv, union ext_column *column, unsigned *column_type) { JOINTABLE *table = wv->tables; @@ -211,9 +211,9 @@ static unsigned parse_column(MSIWHEREVIEW *wv, union ext_column *column, return ERROR_BAD_QUERY_SYNTAX; } -static unsigned WHERE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsigned *val ) +static unsigned WHERE_fetch_int( LibmsiView *view, unsigned row, unsigned col, unsigned *val ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table; unsigned *rows; unsigned r; @@ -234,9 +234,9 @@ static unsigned WHERE_fetch_int( MSIVIEW *view, unsigned row, unsigned col, unsi return table->view->ops->fetch_int(table->view, rows[table->table_index], col, val); } -static unsigned WHERE_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, IStream **stm ) +static unsigned WHERE_fetch_stream( LibmsiView *view, unsigned row, unsigned col, IStream **stm ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table; unsigned *rows; unsigned r; @@ -257,9 +257,9 @@ static unsigned WHERE_fetch_stream( MSIVIEW *view, unsigned row, unsigned col, I return table->view->ops->fetch_stream( table->view, rows[table->table_index], col, stm ); } -static unsigned WHERE_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) +static unsigned WHERE_get_row( LibmsiView *view, unsigned row, LibmsiRecord **rec ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; + LibmsiWhereView *wv = (LibmsiWhereView *)view; TRACE("%p %d %p\n", wv, row, rec ); @@ -269,9 +269,9 @@ static unsigned WHERE_get_row( MSIVIEW *view, unsigned row, MSIRECORD **rec ) return msi_view_get_row( wv->db, view, row, rec ); } -static unsigned WHERE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsigned mask ) +static unsigned WHERE_set_row( LibmsiView *view, unsigned row, LibmsiRecord *rec, unsigned mask ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; unsigned i, r, offset = 0; JOINTABLE *table = wv->tables; unsigned *rows; @@ -313,7 +313,7 @@ static unsigned WHERE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsi { const unsigned col_count = table->col_count; unsigned i; - MSIRECORD *reduced; + LibmsiRecord *reduced; unsigned reduced_mask = (mask >> offset) & ((1 << col_count) - 1); if (!reduced_mask) @@ -344,9 +344,9 @@ static unsigned WHERE_set_row( MSIVIEW *view, unsigned row, MSIRECORD *rec, unsi return r; } -static unsigned WHERE_delete_row(MSIVIEW *view, unsigned row) +static unsigned WHERE_delete_row(LibmsiView *view, unsigned row) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; + LibmsiWhereView *wv = (LibmsiWhereView *)view; unsigned r; unsigned *rows; @@ -365,8 +365,8 @@ static unsigned WHERE_delete_row(MSIVIEW *view, unsigned row) return wv->tables->view->ops->delete_row(wv->tables->view, rows[0]); } -static int INT_evaluate_binary( MSIWHEREVIEW *wv, const unsigned rows[], - const struct complex_expr *expr, int *val, MSIRECORD *record ) +static int INT_evaluate_binary( LibmsiWhereView *wv, const unsigned rows[], + const struct complex_expr *expr, int *val, LibmsiRecord *record ) { unsigned rl, rr; int lval, rval; @@ -455,8 +455,8 @@ static inline unsigned expr_fetch_value(const union ext_column *expr, const unsi } -static unsigned INT_evaluate_unary( MSIWHEREVIEW *wv, const unsigned rows[], - const struct complex_expr *expr, int *val, MSIRECORD *record ) +static unsigned INT_evaluate_unary( LibmsiWhereView *wv, const unsigned rows[], + const struct complex_expr *expr, int *val, LibmsiRecord *record ) { unsigned r; unsigned lval; @@ -480,9 +480,9 @@ static unsigned INT_evaluate_unary( MSIWHEREVIEW *wv, const unsigned rows[], return ERROR_SUCCESS; } -static unsigned STRING_evaluate( MSIWHEREVIEW *wv, const unsigned rows[], +static unsigned STRING_evaluate( LibmsiWhereView *wv, const unsigned rows[], const struct expr *expr, - const MSIRECORD *record, + const LibmsiRecord *record, const WCHAR **str ) { unsigned val = 0, r = ERROR_SUCCESS; @@ -514,8 +514,8 @@ static unsigned STRING_evaluate( MSIWHEREVIEW *wv, const unsigned rows[], return r; } -static unsigned STRCMP_Evaluate( MSIWHEREVIEW *wv, const unsigned rows[], const struct complex_expr *expr, - int *val, const MSIRECORD *record ) +static unsigned STRCMP_Evaluate( LibmsiWhereView *wv, const unsigned rows[], const struct complex_expr *expr, + int *val, const LibmsiRecord *record ) { int sr; const WCHAR *l_str, *r_str; @@ -545,8 +545,8 @@ static unsigned STRCMP_Evaluate( MSIWHEREVIEW *wv, const unsigned rows[], const return ERROR_SUCCESS; } -static unsigned WHERE_evaluate( MSIWHEREVIEW *wv, const unsigned rows[], - struct expr *cond, int *val, MSIRECORD *record ) +static unsigned WHERE_evaluate( LibmsiWhereView *wv, const unsigned rows[], + struct expr *cond, int *val, LibmsiRecord *record ) { unsigned r, tval; @@ -597,7 +597,7 @@ static unsigned WHERE_evaluate( MSIWHEREVIEW *wv, const unsigned rows[], return ERROR_SUCCESS; } -static unsigned check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, JOINTABLE **tables, +static unsigned check_condition( LibmsiWhereView *wv, LibmsiRecord *record, JOINTABLE **tables, unsigned table_rows[] ) { unsigned r = ERROR_FUNCTION_FAILED; @@ -634,10 +634,10 @@ static unsigned check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, JOINTABLE static int compare_entry( const void *left, const void *right ) { - const MSIROWENTRY *le = *(const MSIROWENTRY**)left; - const MSIROWENTRY *re = *(const MSIROWENTRY**)right; - const MSIWHEREVIEW *wv = le->wv; - MSIORDERINFO *order = wv->order_info; + const LibmsiRowEntry *le = *(const LibmsiRowEntry**)left; + const LibmsiRowEntry *re = *(const LibmsiRowEntry**)right; + const LibmsiWhereView *wv = le->wv; + LibmsiOrderInfo *order = wv->order_info; unsigned i, j, r, l_val, r_val; assert(le->wv == re->wv); @@ -737,7 +737,7 @@ static unsigned reorder_check( const struct expr *expr, JOINTABLE **ordered_tabl } /* reorders the tablelist in a way to evaluate the condition as fast as possible */ -static JOINTABLE **ordertables( MSIWHEREVIEW *wv ) +static JOINTABLE **ordertables( LibmsiWhereView *wv ) { JOINTABLE *table; JOINTABLE **tables; @@ -761,9 +761,9 @@ static JOINTABLE **ordertables( MSIWHEREVIEW *wv ) return tables; } -static unsigned WHERE_execute( MSIVIEW *view, MSIRECORD *record ) +static unsigned WHERE_execute( LibmsiView *view, LibmsiRecord *record ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; unsigned r; JOINTABLE *table = wv->tables; unsigned *rows; @@ -807,7 +807,7 @@ static unsigned WHERE_execute( MSIVIEW *view, MSIRECORD *record ) if (wv->order_info) wv->order_info->error = ERROR_SUCCESS; - qsort(wv->reorder, wv->row_count, sizeof(MSIROWENTRY *), compare_entry); + qsort(wv->reorder, wv->row_count, sizeof(LibmsiRowEntry *), compare_entry); if (wv->order_info) r = wv->order_info->error; @@ -817,9 +817,9 @@ static unsigned WHERE_execute( MSIVIEW *view, MSIRECORD *record ) return r; } -static unsigned WHERE_close( MSIVIEW *view ) +static unsigned WHERE_close( LibmsiView *view ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table = wv->tables; TRACE("%p\n", wv ); @@ -834,9 +834,9 @@ static unsigned WHERE_close( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned WHERE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *cols ) +static unsigned WHERE_get_dimensions( LibmsiView *view, unsigned *rows, unsigned *cols ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; TRACE("%p %p %p\n", wv, rows, cols ); @@ -856,10 +856,10 @@ static unsigned WHERE_get_dimensions( MSIVIEW *view, unsigned *rows, unsigned *c return ERROR_SUCCESS; } -static unsigned WHERE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR **name, +static unsigned WHERE_get_column_info( LibmsiView *view, unsigned n, const WCHAR **name, unsigned *type, bool *temporary, const WCHAR **table_name ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table; TRACE("%p %d %p %p %p %p\n", wv, n, name, type, temporary, table_name ); @@ -875,7 +875,7 @@ static unsigned WHERE_get_column_info( MSIVIEW *view, unsigned n, const WCHAR ** type, temporary, table_name); } -static unsigned join_find_row( MSIWHEREVIEW *wv, MSIRECORD *rec, unsigned *row ) +static unsigned join_find_row( LibmsiWhereView *wv, LibmsiRecord *rec, unsigned *row ) { const WCHAR *str; unsigned r, i, id, data; @@ -899,11 +899,11 @@ static unsigned join_find_row( MSIWHEREVIEW *wv, MSIRECORD *rec, unsigned *row ) return ERROR_FUNCTION_FAILED; } -static unsigned join_modify_update( MSIVIEW *view, MSIRECORD *rec ) +static unsigned join_modify_update( LibmsiView *view, LibmsiRecord *rec ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; + LibmsiWhereView *wv = (LibmsiWhereView *)view; unsigned r, row, i, mask = 0; - MSIRECORD *current; + LibmsiRecord *current; r = join_find_row( wv, rec, &row ); @@ -926,10 +926,10 @@ static unsigned join_modify_update( MSIVIEW *view, MSIRECORD *rec ) return WHERE_set_row( view, row, rec, mask ); } -static unsigned WHERE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, - MSIRECORD *rec, unsigned row ) +static unsigned WHERE_modify( LibmsiView *view, LibmsiModify eModifyMode, + LibmsiRecord *rec, unsigned row ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table = wv->tables; unsigned r; @@ -952,24 +952,24 @@ static unsigned WHERE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, switch (eModifyMode) { - case MSIMODIFY_UPDATE: + case LIBMSI_MODIFY_UPDATE: return join_modify_update( view, rec ); - case MSIMODIFY_ASSIGN: - case MSIMODIFY_DELETE: - case MSIMODIFY_INSERT: - case MSIMODIFY_INSERT_TEMPORARY: - case MSIMODIFY_MERGE: - case MSIMODIFY_REPLACE: - case MSIMODIFY_SEEK: - case MSIMODIFY_VALIDATE: - case MSIMODIFY_VALIDATE_DELETE: - case MSIMODIFY_VALIDATE_FIELD: - case MSIMODIFY_VALIDATE_NEW: + case LIBMSI_MODIFY_ASSIGN: + case LIBMSI_MODIFY_DELETE: + case LIBMSI_MODIFY_INSERT: + case LIBMSI_MODIFY_INSERT_TEMPORARY: + case LIBMSI_MODIFY_MERGE: + case LIBMSI_MODIFY_REPLACE: + case LIBMSI_MODIFY_SEEK: + case LIBMSI_MODIFY_VALIDATE: + case LIBMSI_MODIFY_VALIDATE_DELETE: + case LIBMSI_MODIFY_VALIDATE_FIELD: + case LIBMSI_MODIFY_VALIDATE_NEW: r = ERROR_FUNCTION_FAILED; break; - case MSIMODIFY_REFRESH: + case LIBMSI_MODIFY_REFRESH: r = ERROR_CALL_NOT_IMPLEMENTED; break; @@ -982,9 +982,9 @@ static unsigned WHERE_modify( MSIVIEW *view, MSIMODIFY eModifyMode, return r; } -static unsigned WHERE_delete( MSIVIEW *view ) +static unsigned WHERE_delete( LibmsiView *view ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; JOINTABLE *table = wv->tables; TRACE("%p\n", wv ); @@ -1013,10 +1013,10 @@ static unsigned WHERE_delete( MSIVIEW *view ) return ERROR_SUCCESS; } -static unsigned WHERE_find_matching_rows( MSIVIEW *view, unsigned col, +static unsigned WHERE_find_matching_rows( LibmsiView *view, unsigned col, unsigned val, unsigned *row, MSIITERHANDLE *handle ) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + LibmsiWhereView *wv = (LibmsiWhereView*)view; unsigned i, row_value; TRACE("%p, %d, %u, %p\n", view, col, val, *handle); @@ -1043,12 +1043,12 @@ static unsigned WHERE_find_matching_rows( MSIVIEW *view, unsigned col, return ERROR_NO_MORE_ITEMS; } -static unsigned WHERE_sort(MSIVIEW *view, column_info *columns) +static unsigned WHERE_sort(LibmsiView *view, column_info *columns) { - MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; + LibmsiWhereView *wv = (LibmsiWhereView *)view; JOINTABLE *table = wv->tables; column_info *column = columns; - MSIORDERINFO *orderinfo; + LibmsiOrderInfo *orderinfo; unsigned r, count = 0; int i; @@ -1066,7 +1066,7 @@ static unsigned WHERE_sort(MSIVIEW *view, column_info *columns) if (count == 0) return ERROR_SUCCESS; - orderinfo = msi_alloc(sizeof(MSIORDERINFO) + (count - 1) * sizeof(union ext_column)); + orderinfo = msi_alloc(sizeof(LibmsiOrderInfo) + (count - 1) * sizeof(union ext_column)); if (!orderinfo) return ERROR_OUTOFMEMORY; @@ -1092,7 +1092,7 @@ error: return r; } -static const MSIVIEWOPS where_ops = +static const LibmsiViewOPS where_ops = { WHERE_fetch_int, WHERE_fetch_stream, @@ -1115,7 +1115,7 @@ static const MSIVIEWOPS where_ops = NULL, }; -static unsigned WHERE_VerifyCondition( MSIWHEREVIEW *wv, struct expr *cond, +static unsigned WHERE_VerifyCondition( LibmsiWhereView *wv, struct expr *cond, unsigned *valid ) { unsigned r; @@ -1204,10 +1204,10 @@ static unsigned WHERE_VerifyCondition( MSIWHEREVIEW *wv, struct expr *cond, return ERROR_SUCCESS; } -unsigned WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *tables, +unsigned WHERE_CreateView( LibmsiDatabase *db, LibmsiView **view, WCHAR *tables, struct expr *cond ) { - MSIWHEREVIEW *wv = NULL; + LibmsiWhereView *wv = NULL; unsigned r, valid = 0; WCHAR *ptr; @@ -1277,7 +1277,7 @@ unsigned WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, WCHAR *tables, } } - *view = (MSIVIEW*) wv; + *view = (LibmsiView*) wv; return ERROR_SUCCESS; end: -- cgit