If using the default values, also set dwType to REG_SZ as our default
[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 typedef struct pool_data_tag
42 {
43     USHORT *data;
44     UINT size;
45 } pool_data;
46
47 typedef struct string_data_tag
48 {
49     CHAR *data;
50     UINT size;
51 } string_data;
52
53 typedef struct string_table_tag
54 {
55     pool_data   pool;
56     string_data info;
57 } string_table;
58
59 typedef struct tagMSIDATABASE
60 {
61     IStorage *storage;
62     string_table strings;
63     MSITABLE *first_table, *last_table;
64 } MSIDATABASE;
65
66 struct tagMSIVIEW;
67
68 typedef struct tagMSIVIEWOPS
69 {
70     /*
71      * fetch_int - reads one integer from {row,col} in the table
72      *
73      *  This function should be called after the execute method.
74      *  Data returned by the function should not change until 
75      *   close or delete is called.
76      *  To get a string value, query the database's string table with
77      *   the integer value returned from this function.
78      */
79     UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
80
81     /*
82      * execute - loads the underlying data into memory so it can be read
83      */
84     UINT (*execute)( struct tagMSIVIEW *, MSIHANDLE );
85
86     /*
87      * close - clears the data read by execute from memory
88      */
89     UINT (*close)( struct tagMSIVIEW * );
90
91     /*
92      * get_dimensions - returns the number of rows or columns in a table.
93      *
94      *  The number of rows can only be queried after the execute method
95      *   is called. The number of columns can be queried at any time.
96      */
97     UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
98
99     /*
100      * get_column_info - returns the name and type of a specific column
101      *
102      *  The name is HeapAlloc'ed by this function and should be freed by
103      *   the caller.
104      *  The column information can be queried at any time.
105      */
106     UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
107
108     /*
109      * modify - not yet implemented properly
110      */
111     UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE );
112
113     /*
114      * delete - destroys the structure completely
115      */
116     UINT (*delete)( struct tagMSIVIEW * );
117
118 } MSIVIEWOPS;
119
120 typedef struct tagMSIVIEW
121 {
122     MSIVIEWOPS   *ops;
123 } MSIVIEW;
124
125 typedef struct tagMSISUMMARYINFO
126 {
127     IPropertyStorage *propstg;
128 } MSISUMMARYINFO;
129
130 typedef VOID (*msihandledestructor)( VOID * );
131
132 typedef struct tagMSIHANDLEINFO
133 {
134     UINT magic;
135     UINT type;
136     msihandledestructor destructor;
137     struct tagMSIHANDLEINFO *next;
138     struct tagMSIHANDLEINFO *prev;
139 } MSIHANDLEINFO;
140
141 #define MSIHANDLETYPE_ANY 0
142 #define MSIHANDLETYPE_DATABASE 1
143 #define MSIHANDLETYPE_SUMMARYINFO 2
144 #define MSIHANDLETYPE_VIEW 3
145 #define MSIHANDLETYPE_RECORD 4
146
147 #define MSI_MAJORVERSION 1
148 #define MSI_MINORVERSION 10
149 #define MSI_BUILDNUMBER 1029
150
151 #define GUID_SIZE 39
152
153 #define MSIHANDLE_MAGIC 0x4d434923
154 #define MSIMAXHANDLES 0x80
155
156 #define MSISUMINFO_OFFSET 0x30LL
157
158 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
159
160 MSIHANDLE alloc_msihandle(UINT type, UINT extra, msihandledestructor destroy);
161
162 /* add this table to the list of cached tables in the database */
163 extern void add_table(MSIDATABASE *db, MSITABLE *table);
164 extern void remove_table( MSIDATABASE *db, MSITABLE *table );
165 extern void free_table( MSIDATABASE *db, MSITABLE *table );
166 extern void free_cached_tables( MSIDATABASE *db );
167 extern UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
168 extern UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
169 extern UINT dump_string_table(MSIDATABASE *db);
170 extern UINT load_string_table( MSIDATABASE *db, string_table *pst);
171 extern UINT msi_id2string( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
172 extern LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid);
173
174 UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
175
176 #endif /* __WINE_MSI_PRIVATE__ */