Assorted spelling fixes.
[wine] / dlls / msi / msipriv.h
1 /*
2  * Implementation of the Microsoft Installer (msi.dll)
3  *
4  * Copyright 2002 Mike McCormack for CodeWeavers
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_MSI_PRIVATE__
22 #define __WINE_MSI_PRIVATE__
23
24 #include <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "msi.h"
29 #include "msiquery.h"
30 #include "objidl.h"
31
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
37
38 struct tagMSITABLE;
39 typedef struct tagMSITABLE MSITABLE;
40
41 struct string_table;
42 typedef struct string_table string_table;
43
44 typedef struct tagMSIDATABASE
45 {
46     IStorage *storage;
47     string_table *strings;
48     LPWSTR mode;
49     MSITABLE *first_table, *last_table;
50 } MSIDATABASE;
51
52 struct tagMSIVIEW;
53
54 typedef struct tagMSIVIEWOPS
55 {
56     /*
57      * fetch_int - reads one integer from {row,col} in the table
58      *
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.
64      */
65     UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
66
67     /*
68      * get_int - sets one integer at {row,col} in the table
69      *
70      *  Similar semantics to fetch_int
71      */
72     UINT (*set_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT val );
73
74     /*
75      * Inserts a new, blank row into the database
76      *  *row receives the number of the new row
77      */
78     UINT (*insert_row)( struct tagMSIVIEW *, UINT *row );
79
80     /*
81      * execute - loads the underlying data into memory so it can be read
82      */
83     UINT (*execute)( struct tagMSIVIEW *, MSIHANDLE );
84
85     /*
86      * close - clears the data read by execute from memory
87      */
88     UINT (*close)( struct tagMSIVIEW * );
89
90     /*
91      * get_dimensions - returns the number of rows or columns in a table.
92      *
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.
95      */
96     UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
97
98     /*
99      * get_column_info - returns the name and type of a specific column
100      *
101      *  The name is HeapAlloc'ed by this function and should be freed by
102      *   the caller.
103      *  The column information can be queried at any time.
104      */
105     UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
106
107     /*
108      * modify - not yet implemented properly
109      */
110     UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE );
111
112     /*
113      * delete - destroys the structure completely
114      */
115     UINT (*delete)( struct tagMSIVIEW * );
116
117 } MSIVIEWOPS;
118
119 typedef struct tagMSIVIEW
120 {
121     MSIVIEWOPS   *ops;
122 } MSIVIEW;
123
124 typedef struct tagMSISUMMARYINFO
125 {
126     IPropertyStorage *propstg;
127 } MSISUMMARYINFO;
128
129 typedef VOID (*msihandledestructor)( VOID * );
130
131 typedef struct tagMSIHANDLEINFO
132 {
133     UINT magic;
134     UINT type;
135     msihandledestructor destructor;
136     struct tagMSIHANDLEINFO *next;
137     struct tagMSIHANDLEINFO *prev;
138 } MSIHANDLEINFO;
139
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
145
146 #define MSI_MAJORVERSION 1
147 #define MSI_MINORVERSION 10
148 #define MSI_BUILDNUMBER 1029
149
150 #define GUID_SIZE 39
151
152 #define MSIHANDLE_MAGIC 0x4d434923
153 #define MSIMAXHANDLES 0x80
154
155 #define MSISUMINFO_OFFSET 0x30LL
156
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);
161
162 DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
163
164 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
165
166 MSIHANDLE alloc_msihandle(UINT type, UINT extra, msihandledestructor destroy, void **out);
167
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 );
178
179
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 );
185
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 );
194
195 UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
196
197 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );
198
199 #endif /* __WINE_MSI_PRIVATE__ */