Implemented ProcessComponents.
[wine/wine64.git] / dlls / msi / msipriv.h
blobce2ebd96c2138088f6a380f239e85291daa84a82
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 #define MSITYPE_BINARY 0x8900
40 struct tagMSITABLE;
41 typedef struct tagMSITABLE MSITABLE;
43 struct string_table;
44 typedef struct string_table string_table;
46 typedef struct tagMSIDATABASE
48 IStorage *storage;
49 string_table *strings;
50 LPWSTR mode;
51 MSITABLE *first_table, *last_table;
52 } MSIDATABASE;
54 struct tagMSIVIEW;
56 typedef struct tagMSIVIEWOPS
59 * fetch_int - reads one integer from {row,col} in the table
61 * This function should be called after the execute method.
62 * Data returned by the function should not change until
63 * close or delete is called.
64 * To get a string value, query the database's string table with
65 * the integer value returned from this function.
67 UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
70 * get_int - sets one integer at {row,col} in the table
72 * Similar semantics to fetch_int
74 UINT (*set_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT val );
77 * Inserts a new, blank row into the database
78 * *row receives the number of the new row
80 UINT (*insert_row)( struct tagMSIVIEW *, UINT *row );
83 * execute - loads the underlying data into memory so it can be read
85 UINT (*execute)( struct tagMSIVIEW *, MSIHANDLE );
88 * close - clears the data read by execute from memory
90 UINT (*close)( struct tagMSIVIEW * );
93 * get_dimensions - returns the number of rows or columns in a table.
95 * The number of rows can only be queried after the execute method
96 * is called. The number of columns can be queried at any time.
98 UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
101 * get_column_info - returns the name and type of a specific column
103 * The name is HeapAlloc'ed by this function and should be freed by
104 * the caller.
105 * The column information can be queried at any time.
107 UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
110 * modify - not yet implemented properly
112 UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE );
115 * delete - destroys the structure completely
117 UINT (*delete)( struct tagMSIVIEW * );
119 } MSIVIEWOPS;
121 typedef struct tagMSIVIEW
123 MSIVIEWOPS *ops;
124 } MSIVIEW;
126 typedef struct tagMSISUMMARYINFO
128 IPropertyStorage *propstg;
129 } MSISUMMARYINFO;
131 typedef VOID (*msihandledestructor)( VOID * );
133 typedef struct tagMSIHANDLEINFO
135 UINT magic;
136 UINT type;
137 UINT refcount;
138 msihandledestructor destructor;
139 struct tagMSIHANDLEINFO *next;
140 struct tagMSIHANDLEINFO *prev;
141 } MSIHANDLEINFO;
143 typedef struct tagMSIPACKAGE
145 MSIHANDLE db;
146 struct tagMSIFEATURE *features;
147 UINT loaded_features;
148 struct tagMSIFOLDER *folders;
149 UINT loaded_folders;
150 struct tagMSICOMPONENT *components;
151 UINT loaded_components;
152 struct tagMSIFILE *files;
153 UINT loaded_files;
154 } MSIPACKAGE;
156 #define MSIHANDLETYPE_ANY 0
157 #define MSIHANDLETYPE_DATABASE 1
158 #define MSIHANDLETYPE_SUMMARYINFO 2
159 #define MSIHANDLETYPE_VIEW 3
160 #define MSIHANDLETYPE_RECORD 4
161 #define MSIHANDLETYPE_PACKAGE 5
163 #define MSI_MAJORVERSION 1
164 #define MSI_MINORVERSION 10
165 #define MSI_BUILDNUMBER 1029
167 #define GUID_SIZE 39
169 #define MSIHANDLE_MAGIC 0x4d434923
170 #define MSIMAXHANDLES 0x80
172 #define MSISUMINFO_OFFSET 0x30LL
174 DEFINE_GUID(CLSID_IMsiServer, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
175 DEFINE_GUID(CLSID_IMsiServerX1, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
176 DEFINE_GUID(CLSID_IMsiServerX2, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
177 DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
179 DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
181 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
183 MSIHANDLE alloc_msihandle(UINT type, UINT extra, msihandledestructor destroy, void **out);
184 void msihandle_addref(MSIHANDLE handle);
186 /* add this table to the list of cached tables in the database */
187 extern void add_table(MSIDATABASE *db, MSITABLE *table);
188 extern void remove_table( MSIDATABASE *db, MSITABLE *table );
189 extern void free_table( MSIDATABASE *db, MSITABLE *table );
190 extern void free_cached_tables( MSIDATABASE *db );
191 extern UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
192 extern UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
193 extern UINT load_string_table( MSIDATABASE *db );
194 extern UINT MSI_CommitTables( MSIDATABASE *db );
195 extern HRESULT init_string_table( IStorage *stg );
198 /* string table functions */
199 extern BOOL msi_addstring( string_table *st, int string_no, const CHAR *data, int len, UINT refcount );
200 extern BOOL msi_addstringW( string_table *st, int string_no, const WCHAR *data, int len, UINT refcount );
201 extern UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
202 extern UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
204 extern LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid);
205 extern UINT msi_string2idW( string_table *st, LPCWSTR buffer, UINT *id );
206 extern UINT msi_string2idA( string_table *st, LPCSTR str, UINT *id );
207 extern string_table *msi_init_stringtable( int entries, UINT codepage );
208 extern VOID msi_destroy_stringtable( string_table *st );
209 extern UINT msi_string_count( string_table *st );
210 extern UINT msi_id_refcount( string_table *st, UINT i );
211 extern UINT msi_string_totalsize( string_table *st, UINT *last );
212 extern UINT msi_strcmp( string_table *st, UINT lval, UINT rval, UINT *res );
213 extern const WCHAR *msi_string_lookup_id( string_table *st, UINT id );
214 extern UINT msi_string_get_codepage( string_table *st );
217 UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
219 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );
221 UINT read_raw_stream_data( MSIHANDLE hdb, LPCWSTR stname,
222 USHORT **pdata, UINT *psz );
223 UINT ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage, LPCWSTR szPackagePath,
224 LPCWSTR szCommandLine);
225 void ACTION_remove_tracked_tempfiles(MSIPACKAGE* hPackage);
227 /* record internals */
228 extern UINT WINAPI MSI_RecordSetIStream( MSIHANDLE handle,
229 unsigned int iField, IStream *stm );
230 extern const WCHAR *MSI_RecordGetString( MSIHANDLE handle, unsigned int iField );
233 /* stream internals */
234 extern UINT get_raw_stream( MSIHANDLE hdb, LPCWSTR stname, IStream **stm );
235 extern UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm );
236 extern void enum_stream_names( IStorage *stg );
238 BOOL unsquash_guid(LPCWSTR in, LPWSTR out);
239 BOOL squash_guid(LPCWSTR in, LPWSTR out);
241 /* UI globals */
242 extern INSTALLUILEVEL gUILevel;
243 extern HWND gUIhwnd;
244 extern INSTALLUI_HANDLERA gUIHandler;
245 extern DWORD gUIFilter;
246 extern LPVOID gUIContext;
248 #endif /* __WINE_MSI_PRIVATE__ */