2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2002 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_MSI_PRIVATE__
22 #define __WINE_MSI_PRIVATE__
32 #define MSI_DATASIZEMASK 0x00ff
33 #define MSITYPE_VALID 0x0100
34 #define MSITYPE_STRING 0x0800
35 #define MSITYPE_NULLABLE 0x1000
36 #define MSITYPE_KEY 0x2000
39 typedef struct tagMSITABLE MSITABLE;
42 typedef struct string_table string_table;
44 typedef struct tagMSIDATABASE
47 string_table *strings;
49 MSITABLE *first_table, *last_table;
54 typedef struct tagMSIVIEWOPS
57 * fetch_int - reads one integer from {row,col} in the table
59 * This function should be called after the execute method.
60 * Data returned by the function should not change until
61 * close or delete is called.
62 * To get a string value, query the database's string table with
63 * the integer value returned from this function.
65 UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
68 * get_int - sets one integer at {row,col} in the table
70 * Similar semantics to fetch_int
72 UINT (*set_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT val );
75 * Inserts a new, blank row into the database
76 * *row receives the number of the new row
78 UINT (*insert_row)( struct tagMSIVIEW *, UINT *row );
81 * execute - loads the underlying data into memory so it can be read
83 UINT (*execute)( struct tagMSIVIEW *, MSIHANDLE );
86 * close - clears the data read by execute from memory
88 UINT (*close)( struct tagMSIVIEW * );
91 * get_dimensions - returns the number of rows or columns in a table.
93 * The number of rows can only be queried after the execute method
94 * is called. The number of columns can be queried at any time.
96 UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
99 * get_column_info - returns the name and type of a specific column
101 * The name is HeapAlloc'ed by this function and should be freed by
103 * The column information can be queried at any time.
105 UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
108 * modify - not yet implemented properly
110 UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE );
113 * delete - destroys the structure completely
115 UINT (*delete)( struct tagMSIVIEW * );
119 typedef struct tagMSIVIEW
124 typedef struct tagMSISUMMARYINFO
126 IPropertyStorage *propstg;
129 typedef VOID (*msihandledestructor)( VOID * );
131 typedef struct tagMSIHANDLEINFO
135 msihandledestructor destructor;
136 struct tagMSIHANDLEINFO *next;
137 struct tagMSIHANDLEINFO *prev;
140 #define MSIHANDLETYPE_ANY 0
141 #define MSIHANDLETYPE_DATABASE 1
142 #define MSIHANDLETYPE_SUMMARYINFO 2
143 #define MSIHANDLETYPE_VIEW 3
144 #define MSIHANDLETYPE_RECORD 4
146 #define MSI_MAJORVERSION 1
147 #define MSI_MINORVERSION 10
148 #define MSI_BUILDNUMBER 1029
152 #define MSIHANDLE_MAGIC 0x4d434923
153 #define MSIMAXHANDLES 0x80
155 #define MSISUMINFO_OFFSET 0x30LL
157 DEFINE_GUID(CLSID_IMsiServer, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
158 DEFINE_GUID(CLSID_IMsiServerX1, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
159 DEFINE_GUID(CLSID_IMsiServerX2, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
160 DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
162 DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
164 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
166 MSIHANDLE alloc_msihandle(UINT type, UINT extra, msihandledestructor destroy, void **out);
168 /* add this table to the list of cached tables in the database */
169 extern void add_table(MSIDATABASE *db, MSITABLE *table);
170 extern void remove_table( MSIDATABASE *db, MSITABLE *table );
171 extern void free_table( MSIDATABASE *db, MSITABLE *table );
172 extern void free_cached_tables( MSIDATABASE *db );
173 extern UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
174 extern UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
175 extern UINT load_string_table( MSIDATABASE *db );
176 extern UINT MSI_CommitTables( MSIDATABASE *db );
177 extern HRESULT init_string_table( IStorage *stg );
180 /* string table functions */
181 extern BOOL msi_addstring( string_table *st, UINT string_no, const CHAR *data, UINT len, UINT refcount );
182 extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, UINT len, UINT refcount );
183 extern UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
184 extern UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
186 extern LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid);
187 extern UINT msi_string2id( string_table *st, LPCWSTR buffer, UINT *id );
188 extern UINT msi_string2idA( string_table *st, LPCSTR str, UINT *id );
189 extern string_table *msi_init_stringtable( int entries );
190 extern VOID msi_destroy_stringtable( string_table *st );
191 extern UINT msi_string_count( string_table *st );
192 extern UINT msi_id_refcount( string_table *st, UINT i );
193 extern UINT msi_string_totalsize( string_table *st );
195 UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
197 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );
199 #endif /* __WINE_MSI_PRIVATE__ */