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
38 #define MSITYPE_BINARY 0x8900
41 typedef struct tagMSITABLE MSITABLE
;
44 typedef struct string_table string_table
;
46 struct tagMSIOBJECTHDR
;
47 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR
;
49 typedef VOID (*msihandledestructor
)( MSIOBJECTHDR
* );
51 struct tagMSIOBJECTHDR
56 msihandledestructor destructor
;
57 struct tagMSIOBJECTHDR
*next
;
58 struct tagMSIOBJECTHDR
*prev
;
61 typedef struct tagMSIDATABASE
65 string_table
*strings
;
67 MSITABLE
*first_table
, *last_table
;
70 typedef struct tagMSIVIEW MSIVIEW
;
72 typedef struct tagMSIQUERY
80 /* maybe we can use a Variant instead of doing it ourselves? */
81 typedef struct tagMSIFIELD
92 typedef struct tagMSIRECORD
95 UINT count
; /* as passed to MsiCreateRecord */
96 MSIFIELD fields
[1]; /* nb. array size is count+1 */
99 typedef struct tagMSIVIEWOPS
102 * fetch_int - reads one integer from {row,col} in the table
104 * This function should be called after the execute method.
105 * Data returned by the function should not change until
106 * close or delete is called.
107 * To get a string value, query the database's string table with
108 * the integer value returned from this function.
110 UINT (*fetch_int
)( struct tagMSIVIEW
*, UINT row
, UINT col
, UINT
*val
);
113 * fetch_int - reads one integer from {row,col} in the table
115 * This function is similar to fetch_int, except fetches a
116 * stream instead of an integer.
118 UINT (*fetch_stream
)( struct tagMSIVIEW
*, UINT row
, UINT col
, IStream
**stm
);
121 * get_int - sets one integer at {row,col} in the table
123 * Similar semantics to fetch_int
125 UINT (*set_int
)( struct tagMSIVIEW
*, UINT row
, UINT col
, UINT val
);
128 * Inserts a new, blank row into the database
129 * *row receives the number of the new row
131 UINT (*insert_row
)( struct tagMSIVIEW
*, UINT
*row
);
134 * execute - loads the underlying data into memory so it can be read
136 UINT (*execute
)( struct tagMSIVIEW
*, MSIRECORD
* );
139 * close - clears the data read by execute from memory
141 UINT (*close
)( struct tagMSIVIEW
* );
144 * get_dimensions - returns the number of rows or columns in a table.
146 * The number of rows can only be queried after the execute method
147 * is called. The number of columns can be queried at any time.
149 UINT (*get_dimensions
)( struct tagMSIVIEW
*, UINT
*rows
, UINT
*cols
);
152 * get_column_info - returns the name and type of a specific column
154 * The name is HeapAlloc'ed by this function and should be freed by
156 * The column information can be queried at any time.
158 UINT (*get_column_info
)( struct tagMSIVIEW
*, UINT n
, LPWSTR
*name
, UINT
*type
);
161 * modify - not yet implemented properly
163 UINT (*modify
)( struct tagMSIVIEW
*, MSIMODIFY
, MSIHANDLE
);
166 * delete - destroys the structure completely
168 UINT (*delete)( struct tagMSIVIEW
* );
172 typedef struct tagMSISUMMARYINFO
175 IPropertyStorage
*propstg
;
184 typedef struct tagMSIPACKAGE
188 struct tagMSIFEATURE
*features
;
189 UINT loaded_features
;
190 struct tagMSIFOLDER
*folders
;
192 struct tagMSICOMPONENT
*components
;
193 UINT loaded_components
;
194 struct tagMSIFILE
*files
;
198 #define MSIHANDLETYPE_ANY 0
199 #define MSIHANDLETYPE_DATABASE 1
200 #define MSIHANDLETYPE_SUMMARYINFO 2
201 #define MSIHANDLETYPE_VIEW 3
202 #define MSIHANDLETYPE_RECORD 4
203 #define MSIHANDLETYPE_PACKAGE 5
205 #define MSI_MAJORVERSION 2
206 #define MSI_MINORVERSION 0
207 #define MSI_BUILDNUMBER 2600
211 #define MSIHANDLE_MAGIC 0x4d434923
212 #define MSIMAXHANDLES 0x80
214 #define MSISUMINFO_OFFSET 0x30LL
216 DEFINE_GUID(CLSID_IMsiServer
, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
217 DEFINE_GUID(CLSID_IMsiServerX1
, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
218 DEFINE_GUID(CLSID_IMsiServerX2
, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
219 DEFINE_GUID(CLSID_IMsiServerX3
, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
221 DEFINE_GUID(CLSID_IMsiServerMessage
, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
224 /* handle functions */
225 extern void *msihandle2msiinfo(MSIHANDLE handle
, UINT type
);
226 extern MSIHANDLE
alloc_msihandle( MSIOBJECTHDR
* );
227 extern void *alloc_msiobject(UINT type
, UINT size
, msihandledestructor destroy
);
228 extern void msiobj_addref(MSIOBJECTHDR
*);
229 extern int msiobj_release(MSIOBJECTHDR
*);
230 extern MSIHANDLE
msiobj_findhandle( MSIOBJECTHDR
*hdr
);
232 /* add this table to the list of cached tables in the database */
233 extern void add_table(MSIDATABASE
*db
, MSITABLE
*table
);
234 extern void remove_table( MSIDATABASE
*db
, MSITABLE
*table
);
235 extern void free_table( MSIDATABASE
*db
, MSITABLE
*table
);
236 extern void free_cached_tables( MSIDATABASE
*db
);
237 extern UINT
find_cached_table(MSIDATABASE
*db
, LPCWSTR name
, MSITABLE
**table
);
238 extern UINT
get_table(MSIDATABASE
*db
, LPCWSTR name
, MSITABLE
**table
);
239 extern UINT
load_string_table( MSIDATABASE
*db
);
240 extern UINT
MSI_CommitTables( MSIDATABASE
*db
);
241 extern HRESULT
init_string_table( IStorage
*stg
);
244 /* string table functions */
245 extern BOOL
msi_addstring( string_table
*st
, int string_no
, const CHAR
*data
, int len
, UINT refcount
);
246 extern BOOL
msi_addstringW( string_table
*st
, int string_no
, const WCHAR
*data
, int len
, UINT refcount
);
247 extern UINT
msi_id2stringW( string_table
*st
, UINT string_no
, LPWSTR buffer
, UINT
*sz
);
248 extern UINT
msi_id2stringA( string_table
*st
, UINT string_no
, LPSTR buffer
, UINT
*sz
);
250 extern LPWSTR
MSI_makestring( MSIDATABASE
*db
, UINT stringid
);
251 extern UINT
msi_string2idW( string_table
*st
, LPCWSTR buffer
, UINT
*id
);
252 extern UINT
msi_string2idA( string_table
*st
, LPCSTR str
, UINT
*id
);
253 extern string_table
*msi_init_stringtable( int entries
, UINT codepage
);
254 extern VOID
msi_destroy_stringtable( string_table
*st
);
255 extern UINT
msi_string_count( string_table
*st
);
256 extern UINT
msi_id_refcount( string_table
*st
, UINT i
);
257 extern UINT
msi_string_totalsize( string_table
*st
, UINT
*last
);
258 extern UINT
msi_strcmp( string_table
*st
, UINT lval
, UINT rval
, UINT
*res
);
259 extern const WCHAR
*msi_string_lookup_id( string_table
*st
, UINT id
);
260 extern UINT
msi_string_get_codepage( string_table
*st
);
263 extern UINT
VIEW_find_column( MSIVIEW
*view
, LPWSTR name
, UINT
*n
);
265 extern BOOL
TABLE_Exists( MSIDATABASE
*db
, LPWSTR name
);
267 extern UINT
read_raw_stream_data( MSIDATABASE
*, LPCWSTR stname
,
268 USHORT
**pdata
, UINT
*psz
);
269 extern UINT
ACTION_DoTopLevelINSTALL( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
270 extern void ACTION_remove_tracked_tempfiles( MSIPACKAGE
* );
272 /* record internals */
273 extern UINT
MSI_RecordSetIStream( MSIRECORD
*, unsigned int, IStream
*);
274 extern const WCHAR
*MSI_RecordGetString( MSIRECORD
*, unsigned int );
275 extern MSIRECORD
*MSI_CreateRecord( unsigned int );
276 extern UINT
MSI_RecordSetInteger( MSIRECORD
*, unsigned int, int );
277 extern UINT
MSI_RecordSetStringW( MSIRECORD
*, unsigned int, LPCWSTR
);
278 extern BOOL
MSI_RecordIsNull( MSIRECORD
*, unsigned int );
279 extern UINT
MSI_RecordGetStringW( MSIRECORD
* , unsigned int, LPWSTR
, DWORD
*);
280 extern int MSI_RecordGetInteger( MSIRECORD
*, unsigned int );
281 extern UINT
MSI_RecordReadStream( MSIRECORD
*, unsigned int, char *, DWORD
*);
282 extern unsigned int MSI_RecordGetFieldCount( MSIRECORD
*rec
);
284 /* stream internals */
285 extern UINT
get_raw_stream( MSIHANDLE hdb
, LPCWSTR stname
, IStream
**stm
);
286 extern UINT
db_get_raw_stream( MSIDATABASE
*db
, LPCWSTR stname
, IStream
**stm
);
287 extern void enum_stream_names( IStorage
*stg
);
289 /* database internals */
290 extern UINT
MSI_OpenDatabaseW( LPCWSTR
, LPCWSTR
, MSIDATABASE
** );
291 extern UINT
MSI_DatabaseOpenViewW(MSIDATABASE
*, LPCWSTR
, MSIQUERY
** );
294 extern UINT
MSI_ViewExecute( MSIQUERY
*, MSIRECORD
* );
295 extern UINT
MSI_ViewFetch( MSIQUERY
*, MSIRECORD
** );
296 extern UINT
MSI_ViewClose( MSIQUERY
* );
298 /* package internals */
299 extern UINT
MSI_OpenPackageW(LPCWSTR szPackage
, MSIPACKAGE
** );
300 extern UINT
MSI_SetTargetPathW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
301 extern UINT
MSI_SetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
302 extern INT
MSI_ProcessMessage( MSIPACKAGE
*, INSTALLMESSAGE
, MSIRECORD
* );
303 extern UINT
MSI_GetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPWSTR
, DWORD
*);
304 extern MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*, LPCWSTR
);
305 extern UINT
MSI_SetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
306 extern UINT
MSI_GetComponentStateW(MSIPACKAGE
*, LPWSTR
, INSTALLSTATE
*, INSTALLSTATE
*);
307 extern UINT
MSI_GetFeatureStateW(MSIPACKAGE
*, LPWSTR
, INSTALLSTATE
*, INSTALLSTATE
*);
309 /* registry data encoding/decoding functions */
310 BOOL
unsquash_guid(LPCWSTR in
, LPWSTR out
);
311 BOOL
squash_guid(LPCWSTR in
, LPWSTR out
);
312 BOOL
encode_base85_guid(GUID
*,LPWSTR
);
313 BOOL
decode_base85_guid(LPCWSTR
,GUID
*);
316 extern INSTALLUILEVEL gUILevel
;
318 extern INSTALLUI_HANDLERA gUIHandler
;
319 extern DWORD gUIFilter
;
320 extern LPVOID gUIContext
;
321 extern WCHAR gszLogFile
[MAX_PATH
];
323 #endif /* __WINE_MSI_PRIVATE__ */