Changes in crossover-wine-src-6.1.0 except for configure
[wine/hacks.git] / dlls / msi / msipriv.h
blobb8af1d5bc7a3bbf4d292b46edf02ab85bfe1ab0d
1 /*
2 * Implementation of the Microsoft Installer (msi.dll)
4 * Copyright 2002-2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_MSI_PRIVATE__
23 #define __WINE_MSI_PRIVATE__
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "msi.h"
30 #include "msiquery.h"
31 #include "objbase.h"
32 #include "objidl.h"
33 #include "winnls.h"
34 #include "wine/list.h"
36 #define MSI_DATASIZEMASK 0x00ff
37 #define MSITYPE_VALID 0x0100
38 #define MSITYPE_LOCALIZABLE 0x200
39 #define MSITYPE_STRING 0x0800
40 #define MSITYPE_NULLABLE 0x1000
41 #define MSITYPE_KEY 0x2000
43 /* Word Count masks */
44 #define MSIWORDCOUNT_SHORTFILENAMES 0x0001
45 #define MSIWORDCOUNT_COMPRESSED 0x0002
46 #define MSIWORDCOUNT_ADMINISTRATIVE 0x0004
47 #define MSIWORDCOUNT_PRIVILEGES 0x0008
49 /* Install UI level mask for AND operation to exclude flags */
50 #define INSTALLUILEVEL_MASK 0x0007
52 #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
54 struct tagMSITABLE;
55 typedef struct tagMSITABLE MSITABLE;
57 struct string_table;
58 typedef struct string_table string_table;
60 struct tagMSIOBJECTHDR;
61 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR;
63 typedef VOID (*msihandledestructor)( MSIOBJECTHDR * );
65 struct tagMSIOBJECTHDR
67 UINT magic;
68 UINT type;
69 LONG refcount;
70 msihandledestructor destructor;
73 typedef struct tagMSIDATABASE
75 MSIOBJECTHDR hdr;
76 IStorage *storage;
77 string_table *strings;
78 LPWSTR path;
79 LPWSTR deletefile;
80 LPCWSTR mode;
81 struct list tables;
82 struct list transforms;
83 } MSIDATABASE;
85 typedef struct tagMSIVIEW MSIVIEW;
87 typedef struct tagMSIQUERY
89 MSIOBJECTHDR hdr;
90 MSIVIEW *view;
91 UINT row;
92 MSIDATABASE *db;
93 struct list mem;
94 } MSIQUERY;
96 /* maybe we can use a Variant instead of doing it ourselves? */
97 typedef struct tagMSIFIELD
99 UINT type;
100 union
102 INT iVal;
103 LPWSTR szwVal;
104 IStream *stream;
105 } u;
106 } MSIFIELD;
108 typedef struct tagMSIRECORD
110 MSIOBJECTHDR hdr;
111 UINT count; /* as passed to MsiCreateRecord */
112 MSIFIELD fields[1]; /* nb. array size is count+1 */
113 } MSIRECORD;
115 typedef const struct tagMSICOLUMNHASHENTRY *MSIITERHANDLE;
117 typedef struct tagMSIVIEWOPS
120 * fetch_int - reads one integer from {row,col} in the table
122 * This function should be called after the execute method.
123 * Data returned by the function should not change until
124 * close or delete is called.
125 * To get a string value, query the database's string table with
126 * the integer value returned from this function.
128 UINT (*fetch_int)( struct tagMSIVIEW *, UINT row, UINT col, UINT *val );
131 * fetch_stream - gets a stream from {row,col} in the table
133 * This function is similar to fetch_int, except fetches a
134 * stream instead of an integer.
136 UINT (*fetch_stream)( struct tagMSIVIEW *, UINT row, UINT col, IStream **stm );
139 * set_row - sets values in a row as specified by mask
141 * Similar semantics to fetch_int
143 UINT (*set_row)( struct tagMSIVIEW *, UINT row, MSIRECORD *rec, UINT mask );
146 * Inserts a new row into the database from the records contents
148 UINT (*insert_row)( struct tagMSIVIEW *, MSIRECORD * );
151 * execute - loads the underlying data into memory so it can be read
153 UINT (*execute)( struct tagMSIVIEW *, MSIRECORD * );
156 * close - clears the data read by execute from memory
158 UINT (*close)( struct tagMSIVIEW * );
161 * get_dimensions - returns the number of rows or columns in a table.
163 * The number of rows can only be queried after the execute method
164 * is called. The number of columns can be queried at any time.
166 UINT (*get_dimensions)( struct tagMSIVIEW *, UINT *rows, UINT *cols );
169 * get_column_info - returns the name and type of a specific column
171 * The name is HeapAlloc'ed by this function and should be freed by
172 * the caller.
173 * The column information can be queried at any time.
175 UINT (*get_column_info)( struct tagMSIVIEW *, UINT n, LPWSTR *name, UINT *type );
178 * modify - not yet implemented properly
180 UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIRECORD * );
183 * delete - destroys the structure completely
185 UINT (*delete)( struct tagMSIVIEW * );
188 * find_matching_rows - iterates through rows that match a value
190 * If the column type is a string then a string ID should be passed in.
191 * If the value to be looked up is an integer then no transformation of
192 * the input value is required, except if the column is a string, in which
193 * case a string ID should be passed in.
194 * The handle is an input/output parameter that keeps track of the current
195 * position in the iteration. It must be initialised to zero before the
196 * first call and continued to be passed in to subsequent calls.
198 UINT (*find_matching_rows)( struct tagMSIVIEW *, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle );
199 } MSIVIEWOPS;
201 struct tagMSIVIEW
203 MSIOBJECTHDR hdr;
204 const MSIVIEWOPS *ops;
207 struct msi_dialog_tag;
208 typedef struct msi_dialog_tag msi_dialog;
210 #define PROPERTY_HASH_SIZE 67
212 typedef struct tagMSIPACKAGE
214 MSIOBJECTHDR hdr;
215 MSIDATABASE *db;
216 struct list components;
217 struct list features;
218 struct list files;
219 struct list tempfiles;
220 struct list folders;
221 LPWSTR ActionFormat;
222 LPWSTR LastAction;
224 struct list classes;
225 struct list extensions;
226 struct list progids;
227 struct list mimes;
228 struct list appids;
230 struct tagMSISCRIPT *script;
232 struct list RunningActions;
234 LPWSTR BaseURL;
235 LPWSTR PackagePath;
236 LPWSTR ProductCode;
238 UINT CurrentInstallState;
239 msi_dialog *dialog;
240 LPWSTR next_dialog;
241 float center_x;
242 float center_y;
244 UINT WordCount;
246 struct list props[PROPERTY_HASH_SIZE];
248 struct list subscriptions;
249 } MSIPACKAGE;
251 typedef struct tagMSIPREVIEW
253 MSIOBJECTHDR hdr;
254 MSIPACKAGE *package;
255 msi_dialog *dialog;
256 } MSIPREVIEW;
258 #define MSI_MAX_PROPS 20
260 typedef struct tagMSISUMMARYINFO
262 MSIOBJECTHDR hdr;
263 IStorage *storage;
264 DWORD update_count;
265 PROPVARIANT property[MSI_MAX_PROPS];
266 } MSISUMMARYINFO;
268 typedef struct tagMSIFEATURE
270 struct list entry;
271 LPWSTR Feature;
272 LPWSTR Feature_Parent;
273 LPWSTR Title;
274 LPWSTR Description;
275 INT Display;
276 INT Level;
277 LPWSTR Directory;
278 INT Attributes;
279 INSTALLSTATE Installed;
280 INSTALLSTATE ActionRequest;
281 INSTALLSTATE Action;
282 struct list Children;
283 struct list Components;
284 INT Cost;
285 } MSIFEATURE;
287 typedef struct tagMSICOMPONENT
289 struct list entry;
290 DWORD magic;
291 LPWSTR Component;
292 LPWSTR ComponentId;
293 LPWSTR Directory;
294 INT Attributes;
295 LPWSTR Condition;
296 LPWSTR KeyPath;
297 INSTALLSTATE Installed;
298 INSTALLSTATE ActionRequest;
299 INSTALLSTATE Action;
300 BOOL ForceLocalState;
301 BOOL Enabled;
302 INT Cost;
303 INT RefCount;
304 LPWSTR FullKeypath;
305 LPWSTR AdvertiseString;
307 int hasAdvertiseFeature:1;
308 int hasLocalFeature:1;
309 int hasSourceFeature:1;
310 } MSICOMPONENT;
312 typedef struct tagComponentList
314 struct list entry;
315 MSICOMPONENT *component;
316 } ComponentList;
318 typedef struct tagFeatureList
320 struct list entry;
321 MSIFEATURE *feature;
322 } FeatureList;
324 typedef struct tagMSIFOLDER
326 struct list entry;
327 LPWSTR Directory;
328 LPWSTR Parent;
329 LPWSTR TargetDefault;
330 LPWSTR SourceLongPath;
331 LPWSTR SourceShortPath;
333 LPWSTR ResolvedTarget;
334 LPWSTR ResolvedSource;
335 LPWSTR Property; /* initially set property */
336 INT State;
337 /* 0 = uninitialized */
338 /* 1 = existing */
339 /* 2 = created remove if empty */
340 /* 3 = created persist if empty */
341 INT Cost;
342 INT Space;
343 } MSIFOLDER;
345 typedef enum _msi_file_state {
346 msifs_invalid,
347 msifs_missing,
348 msifs_overwrite,
349 msifs_present,
350 msifs_installed,
351 msifs_skipped,
352 } msi_file_state;
354 typedef struct tagMSIFILE
356 struct list entry;
357 LPWSTR File;
358 MSICOMPONENT *Component;
359 LPWSTR FileName;
360 LPWSTR ShortName;
361 LPWSTR LongName;
362 INT FileSize;
363 LPWSTR Version;
364 LPWSTR Language;
365 INT Attributes;
366 INT Sequence;
367 msi_file_state state;
368 LPWSTR SourcePath;
369 LPWSTR TargetPath;
370 BOOL IsCompressed;
371 } MSIFILE;
373 typedef struct tagMSITEMPFILE
375 struct list entry;
376 LPWSTR Path;
377 } MSITEMPFILE;
379 typedef struct tagMSIAPPID
381 struct list entry;
382 LPWSTR AppID; /* Primary key */
383 LPWSTR RemoteServerName;
384 LPWSTR LocalServer;
385 LPWSTR ServiceParameters;
386 LPWSTR DllSurrogate;
387 BOOL ActivateAtStorage;
388 BOOL RunAsInteractiveUser;
389 } MSIAPPID;
391 typedef struct tagMSIPROGID MSIPROGID;
393 typedef struct tagMSICLASS
395 struct list entry;
396 LPWSTR clsid; /* Primary Key */
397 LPWSTR Context; /* Primary Key */
398 MSICOMPONENT *Component;
399 MSIPROGID *ProgID;
400 LPWSTR ProgIDText;
401 LPWSTR Description;
402 MSIAPPID *AppID;
403 LPWSTR FileTypeMask;
404 LPWSTR IconPath;
405 LPWSTR DefInprocHandler;
406 LPWSTR DefInprocHandler32;
407 LPWSTR Argument;
408 MSIFEATURE *Feature;
409 INT Attributes;
410 /* not in the table, set during installation */
411 BOOL Installed;
412 } MSICLASS;
414 typedef struct tagMSIMIME MSIMIME;
416 typedef struct tagMSIEXTENSION
418 struct list entry;
419 LPWSTR Extension; /* Primary Key */
420 MSICOMPONENT *Component;
421 MSIPROGID *ProgID;
422 LPWSTR ProgIDText;
423 MSIMIME *Mime;
424 MSIFEATURE *Feature;
425 /* not in the table, set during installation */
426 BOOL Installed;
427 struct list verbs;
428 } MSIEXTENSION;
430 struct tagMSIPROGID
432 struct list entry;
433 LPWSTR ProgID; /* Primary Key */
434 MSIPROGID *Parent;
435 MSICLASS *Class;
436 LPWSTR Description;
437 LPWSTR IconPath;
438 /* not in the table, set during installation */
439 BOOL InstallMe;
440 MSIPROGID *CurVer;
441 MSIPROGID *VersionInd;
444 typedef struct tagMSIVERB
446 struct list entry;
447 LPWSTR Verb;
448 INT Sequence;
449 LPWSTR Command;
450 LPWSTR Argument;
451 } MSIVERB;
453 struct tagMSIMIME
455 struct list entry;
456 LPWSTR ContentType; /* Primary Key */
457 MSIEXTENSION *Extension;
458 LPWSTR clsid;
459 MSICLASS *Class;
460 /* not in the table, set during installation */
461 BOOL InstallMe;
464 enum SCRIPTS {
465 INSTALL_SCRIPT = 0,
466 COMMIT_SCRIPT = 1,
467 ROLLBACK_SCRIPT = 2,
468 TOTAL_SCRIPTS = 3
471 #define SEQUENCE_UI 0x1
472 #define SEQUENCE_EXEC 0x2
473 #define SEQUENCE_INSTALL 0x10
475 typedef struct tagMSISCRIPT
477 LPWSTR *Actions[TOTAL_SCRIPTS];
478 UINT ActionCount[TOTAL_SCRIPTS];
479 BOOL ExecuteSequenceRun;
480 BOOL CurrentlyScripting;
481 UINT InWhatSequence;
482 LPWSTR *UniqueActions;
483 UINT UniqueActionsCount;
484 } MSISCRIPT;
486 #define MSIHANDLETYPE_ANY 0
487 #define MSIHANDLETYPE_DATABASE 1
488 #define MSIHANDLETYPE_SUMMARYINFO 2
489 #define MSIHANDLETYPE_VIEW 3
490 #define MSIHANDLETYPE_RECORD 4
491 #define MSIHANDLETYPE_PACKAGE 5
492 #define MSIHANDLETYPE_PREVIEW 6
494 #define MSI_MAJORVERSION 3
495 #define MSI_MINORVERSION 1
496 #define MSI_BUILDNUMBER 4000
498 #define GUID_SIZE 39
500 #define MSIHANDLE_MAGIC 0x4d434923
502 DEFINE_GUID(CLSID_IMsiServer, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
503 DEFINE_GUID(CLSID_IMsiServerX1, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
504 DEFINE_GUID(CLSID_IMsiServerX2, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
505 DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
507 DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
509 /* handle unicode/ascii output in the Msi* API functions */
510 typedef struct {
511 BOOL unicode;
512 union {
513 LPSTR a;
514 LPWSTR w;
515 } str;
516 } awstring;
518 typedef struct {
519 BOOL unicode;
520 union {
521 LPCSTR a;
522 LPCWSTR w;
523 } str;
524 } awcstring;
526 UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz );
528 /* msi server interface */
529 extern ITypeLib *get_msi_typelib( LPWSTR *path );
531 /* handle functions */
532 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
533 extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * );
534 extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy );
535 extern void msiobj_addref(MSIOBJECTHDR *);
536 extern int msiobj_release(MSIOBJECTHDR *);
537 extern void msiobj_lock(MSIOBJECTHDR *);
538 extern void msiobj_unlock(MSIOBJECTHDR *);
539 extern void msi_free_handle_table(void);
541 extern void free_cached_tables( MSIDATABASE *db );
542 extern void msi_free_transforms( MSIDATABASE *db );
543 extern string_table *load_string_table( IStorage *stg );
544 extern UINT MSI_CommitTables( MSIDATABASE *db );
545 extern HRESULT init_string_table( IStorage *stg );
548 /* string table functions */
549 extern BOOL msi_addstring( string_table *st, UINT string_no, const CHAR *data, int len, UINT refcount );
550 extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, int len, UINT refcount );
551 extern UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
552 extern UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
554 extern UINT msi_string2idW( string_table *st, LPCWSTR buffer, UINT *id );
555 extern UINT msi_string2idA( string_table *st, LPCSTR str, UINT *id );
556 extern string_table *msi_init_stringtable( int entries, UINT codepage );
557 extern VOID msi_destroy_stringtable( string_table *st );
558 extern UINT msi_string_count( string_table *st );
559 extern UINT msi_id_refcount( string_table *st, UINT i );
560 extern UINT msi_string_totalsize( string_table *st, UINT *datasize, UINT *poolsize );
561 extern UINT msi_strcmp( string_table *st, UINT lval, UINT rval, UINT *res );
562 extern const WCHAR *msi_string_lookup_id( string_table *st, UINT id );
563 extern UINT msi_string_get_codepage( string_table *st );
566 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );
567 extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table );
569 extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
570 USHORT **pdata, UINT *psz );
572 /* transform functions */
573 extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg );
574 extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
575 LPCWSTR szTransformFile, int iErrorCond );
576 extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg );
578 /* action internals */
579 extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR );
580 extern void ACTION_free_package_structures( MSIPACKAGE* );
581 extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR);
582 extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode );
583 extern UINT MSI_SetFeatureStates( MSIPACKAGE *package );
585 /* record internals */
586 extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);
587 extern UINT MSI_RecordGetIStream( MSIRECORD *, unsigned int, IStream **);
588 extern const WCHAR *MSI_RecordGetString( MSIRECORD *, unsigned int );
589 extern MSIRECORD *MSI_CreateRecord( unsigned int );
590 extern UINT MSI_RecordSetInteger( MSIRECORD *, unsigned int, int );
591 extern UINT MSI_RecordSetStringW( MSIRECORD *, unsigned int, LPCWSTR );
592 extern UINT MSI_RecordSetStringA( MSIRECORD *, unsigned int, LPCSTR );
593 extern BOOL MSI_RecordIsNull( MSIRECORD *, unsigned int );
594 extern UINT MSI_RecordGetStringW( MSIRECORD * , unsigned int, LPWSTR, DWORD *);
595 extern UINT MSI_RecordGetStringA( MSIRECORD *, unsigned int, LPSTR, DWORD *);
596 extern int MSI_RecordGetInteger( MSIRECORD *, unsigned int );
597 extern UINT MSI_RecordReadStream( MSIRECORD *, unsigned int, char *, DWORD *);
598 extern unsigned int MSI_RecordGetFieldCount( MSIRECORD *rec );
599 extern UINT MSI_RecordSetStreamW( MSIRECORD *, unsigned int, LPCWSTR );
600 extern UINT MSI_RecordSetStreamA( MSIRECORD *, unsigned int, LPCSTR );
601 extern UINT MSI_RecordDataSize( MSIRECORD *, unsigned int );
602 extern UINT MSI_RecordStreamToFile( MSIRECORD *, unsigned int, LPCWSTR );
603 extern UINT MSI_RecordCopyField( MSIRECORD *, unsigned int, MSIRECORD *, unsigned int );
605 /* stream internals */
606 extern UINT get_raw_stream( MSIHANDLE hdb, LPCWSTR stname, IStream **stm );
607 extern UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm );
608 extern void enum_stream_names( IStorage *stg );
610 /* database internals */
611 extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** );
612 extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
613 extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... );
614 typedef UINT (*record_func)( MSIRECORD *, LPVOID );
615 extern UINT MSI_IterateRecords( MSIQUERY *, DWORD *, record_func, LPVOID );
616 extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... );
617 extern UINT MSI_DatabaseImport( MSIDATABASE *, LPCWSTR, LPCWSTR );
618 extern UINT MSI_DatabaseExport( MSIDATABASE *, LPCWSTR, LPCWSTR, LPCWSTR );
619 extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** );
621 /* view internals */
622 extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * );
623 extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** );
624 extern UINT MSI_ViewClose( MSIQUERY* );
625 extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **);
626 extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * );
629 /* install internals */
630 extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
632 /* package internals */
633 extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPWSTR );
634 extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE ** );
635 extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
636 extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
637 extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * );
638 extern UINT MSI_GetPropertyW( MSIPACKAGE *, LPCWSTR, LPWSTR, DWORD * );
639 extern UINT MSI_GetPropertyA(MSIPACKAGE *, LPCSTR, LPSTR, DWORD* );
640 extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR );
641 extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * );
642 extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * );
643 extern UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE );
644 extern LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename );
646 /* for deformating */
647 extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, DWORD * );
648 extern UINT MSI_FormatRecordA( MSIPACKAGE *, MSIRECORD *, LPSTR, DWORD * );
650 /* registry data encoding/decoding functions */
651 extern BOOL unsquash_guid(LPCWSTR in, LPWSTR out);
652 extern BOOL squash_guid(LPCWSTR in, LPWSTR out);
653 extern BOOL encode_base85_guid(GUID *,LPWSTR);
654 extern BOOL decode_base85_guid(LPCWSTR,GUID*);
655 extern UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create);
656 extern UINT MSIREG_OpenUserProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
657 extern UINT MSIREG_OpenFeatures(HKEY* key);
658 extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
659 extern UINT MSIREG_OpenComponents(HKEY* key);
660 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
661 extern UINT MSIREG_OpenComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
662 extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
663 extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
664 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
665 extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
666 extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
668 extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
669 extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);
671 extern DWORD msi_version_str_to_dword(LPCWSTR p);
672 extern LPWSTR msi_version_dword_to_str(DWORD version);
674 extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
675 extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
676 extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val );
677 extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val );
679 /* msi dialog interface */
680 typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
681 extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog*, msi_dialog_event_handler );
682 extern UINT msi_dialog_run_message_loop( msi_dialog* );
683 extern void msi_dialog_end_dialog( msi_dialog* );
684 extern void msi_dialog_check_messages( HANDLE );
685 extern void msi_dialog_do_preview( msi_dialog* );
686 extern void msi_dialog_destroy( msi_dialog* );
687 extern BOOL msi_dialog_register_class( void );
688 extern void msi_dialog_unregister_class( void );
689 extern void msi_dialog_handle_event( msi_dialog*, LPCWSTR, LPCWSTR, MSIRECORD * );
690 extern UINT msi_dialog_reset( msi_dialog *dialog );
691 extern UINT msi_dialog_directorylist_up( msi_dialog *dialog );
692 extern msi_dialog *msi_dialog_get_parent( msi_dialog *dialog );
693 extern LPWSTR msi_dialog_get_name( msi_dialog *dialog );
694 extern UINT msi_spawn_error_dialog( MSIPACKAGE*, LPWSTR, LPWSTR );
696 /* preview */
697 extern MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE * );
698 extern UINT MSI_PreviewDialogW( MSIPREVIEW *, LPCWSTR );
700 /* summary information */
701 extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount );
702 extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty );
703 extern LPWSTR msi_get_suminfo_product( IStorage *stg );
705 /* undocumented functions */
706 UINT WINAPI MsiCreateAndVerifyInstallerDirectory( DWORD );
707 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR, LPWSTR, LPWSTR, LPWSTR, DWORD * );
708 UINT WINAPI MsiDecomposeDescriptorA( LPCSTR, LPSTR, LPSTR, LPSTR, DWORD * );
709 LANGID WINAPI MsiLoadStringW( MSIHANDLE, UINT, LPWSTR, int, LANGID );
710 LANGID WINAPI MsiLoadStringA( MSIHANDLE, UINT, LPSTR, int, LANGID );
712 /* UI globals */
713 extern INSTALLUILEVEL gUILevel;
714 extern HWND gUIhwnd;
715 extern INSTALLUI_HANDLERA gUIHandlerA;
716 extern INSTALLUI_HANDLERW gUIHandlerW;
717 extern DWORD gUIFilter;
718 extern LPVOID gUIContext;
719 extern WCHAR gszLogFile[MAX_PATH];
720 extern HINSTANCE msi_hInstance;
722 /* action related functions */
723 extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
724 extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
725 extern void ACTION_FinishCustomActions( MSIPACKAGE* package);
726 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
728 static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
730 feature->ActionRequest = state;
731 feature->Action = state;
734 static inline void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE state )
736 comp->ActionRequest = state;
737 comp->Action = state;
740 /* actions in other modules */
741 extern UINT ACTION_AppSearch(MSIPACKAGE *package);
742 extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
743 extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
744 extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
745 extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
746 extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
747 extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
748 extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
749 extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
750 extern UINT ACTION_RegisterFonts(MSIPACKAGE *package);
752 /* Helpers */
753 extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
754 extern LPWSTR msi_dup_record_field(MSIRECORD *row, INT index);
755 extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
756 extern int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def );
757 extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
758 BOOL set_prop, BOOL load_prop, MSIFOLDER **folder);
759 extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
760 extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
761 extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
762 extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
763 extern int track_tempfile(MSIPACKAGE *package, LPCWSTR path);
764 extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
765 extern void msi_free_action_script(MSIPACKAGE *package, UINT script);
766 extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
767 extern LPWSTR build_directory_name(DWORD , ...);
768 extern BOOL create_full_pathW(const WCHAR *path);
769 extern BOOL ACTION_VerifyComponentForAction(MSICOMPONENT*, INSTALLSTATE);
770 extern BOOL ACTION_VerifyFeatureForAction(MSIFEATURE*, INSTALLSTATE);
771 extern void reduce_to_longfilename(WCHAR*);
772 extern void reduce_to_shortfilename(WCHAR*);
773 extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
774 extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
775 extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
776 extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
777 extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
778 extern UINT msi_create_component_directories( MSIPACKAGE *package );
779 extern void msi_ui_error( DWORD msg_id, DWORD type );
781 /* control event stuff */
782 extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
783 MSIRECORD *data);
784 extern VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog);
785 extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
786 extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog,
787 LPCWSTR event, LPCWSTR control, LPCWSTR attribute);
788 extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
789 LPCWSTR control, LPCWSTR attribute );
791 /* User Interface messages from the actions */
792 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
793 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
795 /* string consts use a number of places and defined in helpers.c*/
796 extern const WCHAR cszSourceDir[];
797 extern const WCHAR cszSOURCEDIR[];
798 extern const WCHAR szProductCode[];
799 extern const WCHAR cszRootDrive[];
800 extern const WCHAR cszbs[];
802 extern DWORD tls_slot;
804 /* memory allocation macro functions */
805 static inline void *msi_alloc( size_t len )
807 return HeapAlloc( GetProcessHeap(), 0, len );
810 static inline void *msi_alloc_zero( size_t len )
812 return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
815 static inline void *msi_realloc( void *mem, size_t len )
817 return HeapReAlloc( GetProcessHeap(), 0, mem, len );
820 static inline void *msi_realloc_zero( void *mem, size_t len )
822 return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len );
825 static inline BOOL msi_free( void *mem )
827 return HeapFree( GetProcessHeap(), 0, mem );
830 static inline char *strdupWtoA( LPCWSTR str )
832 LPSTR ret = NULL;
833 DWORD len;
835 if (!str) return ret;
836 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
837 ret = msi_alloc( len );
838 if (ret)
839 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
840 return ret;
843 static inline LPWSTR strdupAtoW( LPCSTR str )
845 LPWSTR ret = NULL;
846 DWORD len;
848 if (!str) return ret;
849 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
850 ret = msi_alloc( len * sizeof(WCHAR) );
851 if (ret)
852 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
853 return ret;
856 static inline LPWSTR strdupW( LPCWSTR src )
858 LPWSTR dest;
859 if (!src) return NULL;
860 dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) );
861 if (dest)
862 lstrcpyW(dest, src);
863 return dest;
866 #endif /* __WINE_MSI_PRIVATE__ */