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 typedef struct tagMSIDATABASE
49 string_table
*strings
;
51 MSITABLE
*first_table
, *last_table
;
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
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
* );
121 typedef struct tagMSIVIEW
126 typedef struct tagMSISUMMARYINFO
128 IPropertyStorage
*propstg
;
131 typedef VOID (*msihandledestructor
)( VOID
* );
133 typedef struct tagMSIHANDLEINFO
138 msihandledestructor destructor
;
139 struct tagMSIHANDLEINFO
*next
;
140 struct tagMSIHANDLEINFO
*prev
;
143 typedef struct tagMSIPACKAGE
146 struct tagMSIFEATURE
*features
;
147 UINT loaded_features
;
148 struct tagMSIFOLDER
*folders
;
150 struct tagMSICOMPONENT
*components
;
151 UINT loaded_components
;
154 #define MSIHANDLETYPE_ANY 0
155 #define MSIHANDLETYPE_DATABASE 1
156 #define MSIHANDLETYPE_SUMMARYINFO 2
157 #define MSIHANDLETYPE_VIEW 3
158 #define MSIHANDLETYPE_RECORD 4
159 #define MSIHANDLETYPE_PACKAGE 5
161 #define MSI_MAJORVERSION 1
162 #define MSI_MINORVERSION 10
163 #define MSI_BUILDNUMBER 1029
167 #define MSIHANDLE_MAGIC 0x4d434923
168 #define MSIMAXHANDLES 0x80
170 #define MSISUMINFO_OFFSET 0x30LL
172 DEFINE_GUID(CLSID_IMsiServer
, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
173 DEFINE_GUID(CLSID_IMsiServerX1
, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
174 DEFINE_GUID(CLSID_IMsiServerX2
, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
175 DEFINE_GUID(CLSID_IMsiServerX3
, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
177 DEFINE_GUID(CLSID_IMsiServerMessage
, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
179 extern void *msihandle2msiinfo(MSIHANDLE handle
, UINT type
);
181 MSIHANDLE
alloc_msihandle(UINT type
, UINT extra
, msihandledestructor destroy
, void **out
);
182 void msihandle_addref(MSIHANDLE handle
);
184 /* add this table to the list of cached tables in the database */
185 extern void add_table(MSIDATABASE
*db
, MSITABLE
*table
);
186 extern void remove_table( MSIDATABASE
*db
, MSITABLE
*table
);
187 extern void free_table( MSIDATABASE
*db
, MSITABLE
*table
);
188 extern void free_cached_tables( MSIDATABASE
*db
);
189 extern UINT
find_cached_table(MSIDATABASE
*db
, LPCWSTR name
, MSITABLE
**table
);
190 extern UINT
get_table(MSIDATABASE
*db
, LPCWSTR name
, MSITABLE
**table
);
191 extern UINT
load_string_table( MSIDATABASE
*db
);
192 extern UINT
MSI_CommitTables( MSIDATABASE
*db
);
193 extern HRESULT
init_string_table( IStorage
*stg
);
196 /* string table functions */
197 extern BOOL
msi_addstring( string_table
*st
, int string_no
, const CHAR
*data
, int len
, UINT refcount
);
198 extern BOOL
msi_addstringW( string_table
*st
, int string_no
, const WCHAR
*data
, int len
, UINT refcount
);
199 extern UINT
msi_id2stringW( string_table
*st
, UINT string_no
, LPWSTR buffer
, UINT
*sz
);
200 extern UINT
msi_id2stringA( string_table
*st
, UINT string_no
, LPSTR buffer
, UINT
*sz
);
202 extern LPWSTR
MSI_makestring( MSIDATABASE
*db
, UINT stringid
);
203 extern UINT
msi_string2idW( string_table
*st
, LPCWSTR buffer
, UINT
*id
);
204 extern UINT
msi_string2idA( string_table
*st
, LPCSTR str
, UINT
*id
);
205 extern string_table
*msi_init_stringtable( int entries
, UINT codepage
);
206 extern VOID
msi_destroy_stringtable( string_table
*st
);
207 extern UINT
msi_string_count( string_table
*st
);
208 extern UINT
msi_id_refcount( string_table
*st
, UINT i
);
209 extern UINT
msi_string_totalsize( string_table
*st
, UINT
*last
);
210 extern UINT
msi_strcmp( string_table
*st
, UINT lval
, UINT rval
, UINT
*res
);
211 extern const WCHAR
*msi_string_lookup_id( string_table
*st
, UINT id
);
212 extern UINT
msi_string_get_codepage( string_table
*st
);
215 UINT
VIEW_find_column( MSIVIEW
*view
, LPWSTR name
, UINT
*n
);
217 extern BOOL
TABLE_Exists( MSIDATABASE
*db
, LPWSTR name
);
219 UINT
read_raw_stream_data( MSIHANDLE hdb
, LPCWSTR stname
,
220 USHORT
**pdata
, UINT
*psz
);
221 UINT
ACTION_DoTopLevelINSTALL(MSIHANDLE hPackage
, LPCWSTR szPackagePath
,
222 LPCWSTR szCommandLine
);
224 /* record internals */
225 extern UINT WINAPI
MSI_RecordSetIStream( MSIHANDLE handle
,
226 unsigned int iField
, IStream
*stm
);
227 extern const WCHAR
*MSI_RecordGetString( MSIHANDLE handle
, unsigned int iField
);
230 /* stream internals */
231 extern UINT
get_raw_stream( MSIHANDLE hdb
, LPCWSTR stname
, IStream
**stm
);
232 extern UINT
db_get_raw_stream( MSIDATABASE
*db
, LPCWSTR stname
, IStream
**stm
);
233 extern void enum_stream_names( IStorage
*stg
);
237 extern INSTALLUILEVEL gUILevel
;
239 extern INSTALLUI_HANDLERA gUIHandler
;
240 extern DWORD gUIFilter
;
241 extern LPVOID gUIContext
;
243 #endif /* __WINE_MSI_PRIVATE__ */