Fixed header dependencies to be fully compatible with the Windows
[wine/multimedia.git] / dlls / msi / msipriv.h
blob728ee221f03943018f6e406e556c347f51bdfaa9
1 /*
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__
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "msi.h"
29 #include "msiquery.h"
30 #include "objidl.h"
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
38 struct tagMSITABLE;
39 typedef struct tagMSITABLE MSITABLE;
41 typedef struct pool_data_tag
43 USHORT *data;
44 UINT size;
45 } pool_data;
47 typedef struct string_data_tag
49 CHAR *data;
50 UINT size;
51 } string_data;
53 typedef struct string_table_tag
55 pool_data pool;
56 string_data info;
57 } string_table;
59 typedef struct tagMSIDATABASE
61 IStorage *storage;
62 string_table strings;
63 MSITABLE *first_table, *last_table;
64 } MSIDATABASE;
66 struct tagMSIVIEW;
68 typedef struct tagMSIVIEWOPS
71 * fetch_int - reads one integer from {row,col} in the table
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.
79 UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
82 * execute - loads the underlying data into memory so it can be read
84 UINT (*execute)( struct tagMSIVIEW *, MSIHANDLE );
87 * close - clears the data read by execute from memory
89 UINT (*close)( struct tagMSIVIEW * );
92 * get_dimensions - returns the number of rows or columns in a table.
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.
97 UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
100 * get_column_info - returns the name and type of a specific column
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.
106 UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
109 * modify - not yet implemented properly
111 UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE );
114 * delete - destroys the structure completely
116 UINT (*delete)( struct tagMSIVIEW * );
118 } MSIVIEWOPS;
120 typedef struct tagMSIVIEW
122 MSIVIEWOPS *ops;
123 } MSIVIEW;
125 typedef struct tagMSISUMMARYINFO
127 IPropertyStorage *propstg;
128 } MSISUMMARYINFO;
130 typedef VOID (*msihandledestructor)( VOID * );
132 typedef struct tagMSIHANDLEINFO
134 UINT magic;
135 UINT type;
136 msihandledestructor destructor;
137 struct tagMSIHANDLEINFO *next;
138 struct tagMSIHANDLEINFO *prev;
139 } MSIHANDLEINFO;
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
147 #define MSI_MAJORVERSION 1
148 #define MSI_MINORVERSION 10
149 #define MSI_BUILDNUMBER 1029
151 #define GUID_SIZE 39
153 #define MSIHANDLE_MAGIC 0x4d434923
154 #define MSIMAXHANDLES 0x80
156 #define MSISUMINFO_OFFSET 0x30LL
158 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
160 MSIHANDLE alloc_msihandle(UINT type, UINT extra, msihandledestructor destroy);
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);
174 UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
176 /* FIXME! should get rid of that */
177 #include "winnls.h"
178 inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
180 LPWSTR ret;
181 INT len;
183 if (!str) return NULL;
184 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
185 ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
186 if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
187 return ret;
190 #endif /* __WINE_MSI_PRIVATE__ */