joy.cpl: Remove uneeded FIXME message.
[wine] / dlls / msi / msipriv.h
1 /*
2  * Implementation of the Microsoft Installer (msi.dll)
3  *
4  * Copyright 2002-2005 Mike McCormack for CodeWeavers
5  * Copyright 2005 Aric Stewart for CodeWeavers
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef __WINE_MSI_PRIVATE__
23 #define __WINE_MSI_PRIVATE__
24
25 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "fdi.h"
30 #include "msi.h"
31 #include "msiquery.h"
32 #include "msidefs.h"
33 #include "objbase.h"
34 #include "objidl.h"
35 #include "fusion.h"
36 #include "winnls.h"
37 #include "winver.h"
38 #include "wine/list.h"
39 #include "wine/debug.h"
40
41 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
42 BOOL is_wow64;
43
44 #define MSI_DATASIZEMASK 0x00ff
45 #define MSITYPE_VALID    0x0100
46 #define MSITYPE_LOCALIZABLE 0x200
47 #define MSITYPE_STRING   0x0800
48 #define MSITYPE_NULLABLE 0x1000
49 #define MSITYPE_KEY      0x2000
50 #define MSITYPE_TEMPORARY 0x4000
51 #define MSITYPE_UNKNOWN   0x8000
52
53 #define MAX_STREAM_NAME_LEN     62
54 #define LONG_STR_BYTES  3
55
56 /* Install UI level mask for AND operation to exclude flags */
57 #define INSTALLUILEVEL_MASK             0x0007
58
59 #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
60
61 struct tagMSITABLE;
62 typedef struct tagMSITABLE MSITABLE;
63
64 struct string_table;
65 typedef struct string_table string_table;
66
67 struct tagMSIOBJECTHDR;
68 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR;
69
70 typedef VOID (*msihandledestructor)( MSIOBJECTHDR * );
71
72 struct tagMSIOBJECTHDR
73 {
74     UINT magic;
75     UINT type;
76     LONG refcount;
77     msihandledestructor destructor;
78 };
79
80 #define MSI_INITIAL_MEDIA_TRANSFORM_OFFSET 10000
81 #define MSI_INITIAL_MEDIA_TRANSFORM_DISKID 30000
82
83 typedef struct tagMSIDATABASE
84 {
85     MSIOBJECTHDR hdr;
86     IStorage *storage;
87     string_table *strings;
88     UINT bytes_per_strref;
89     LPWSTR path;
90     LPWSTR deletefile;
91     LPCWSTR mode;
92     UINT media_transform_offset;
93     UINT media_transform_disk_id;
94     struct list tables;
95     struct list transforms;
96     struct list streams;
97 } MSIDATABASE;
98
99 typedef struct tagMSIVIEW MSIVIEW;
100
101 typedef struct tagMSIQUERY
102 {
103     MSIOBJECTHDR hdr;
104     MSIVIEW *view;
105     UINT row;
106     MSIDATABASE *db;
107     struct list mem;
108 } MSIQUERY;
109
110 /* maybe we can use a Variant instead of doing it ourselves? */
111 typedef struct tagMSIFIELD
112 {
113     UINT type;
114     union
115     {
116         INT iVal;
117         INT_PTR pVal;
118         LPWSTR szwVal;
119         IStream *stream;
120     } u;
121 } MSIFIELD;
122
123 typedef struct tagMSIRECORD
124 {
125     MSIOBJECTHDR hdr;
126     UINT count;       /* as passed to MsiCreateRecord */
127     MSIFIELD fields[1]; /* nb. array size is count+1 */
128 } MSIRECORD;
129
130 typedef struct tagMSISOURCELISTINFO
131 {
132     struct list entry;
133     DWORD context;
134     DWORD options;
135     LPCWSTR property;
136     LPWSTR value;
137 } MSISOURCELISTINFO;
138
139 typedef struct tagMSIMEDIADISK
140 {
141     struct list entry;
142     DWORD context;
143     DWORD options;
144     DWORD disk_id;
145     LPWSTR volume_label;
146     LPWSTR disk_prompt;
147 } MSIMEDIADISK;
148
149 typedef struct tagMSIMEDIAINFO
150 {
151     UINT disk_id;
152     UINT type;
153     UINT last_sequence;
154     LPWSTR disk_prompt;
155     LPWSTR cabinet;
156     LPWSTR first_volume;
157     LPWSTR volume_label;
158     BOOL is_continuous;
159     BOOL is_extracted;
160     WCHAR sourcedir[MAX_PATH];
161 } MSIMEDIAINFO;
162
163 typedef struct tagMSICABINETSTREAM
164 {
165     struct list entry;
166     UINT disk_id;
167     IStorage *storage;
168     WCHAR *stream;
169 } MSICABINETSTREAM;
170
171 typedef struct tagMSIPATCHINFO
172 {
173     struct list entry;
174     LPWSTR patchcode;
175     LPWSTR products;
176     LPWSTR transforms;
177     LPWSTR filename;
178     LPWSTR localfile;
179     MSIPATCHSTATE state;
180     BOOL delete_on_close;
181 } MSIPATCHINFO;
182
183 typedef struct tagMSIBINARY
184 {
185     struct list entry;
186     WCHAR *source;
187     WCHAR *tmpfile;
188     HMODULE module;
189 } MSIBINARY;
190
191 typedef struct _column_info
192 {
193     LPCWSTR table;
194     LPCWSTR column;
195     INT   type;
196     BOOL   temporary;
197     struct expr *val;
198     struct _column_info *next;
199 } column_info;
200
201 typedef const struct tagMSICOLUMNHASHENTRY *MSIITERHANDLE;
202
203 typedef struct tagMSIVIEWOPS
204 {
205     /*
206      * fetch_int - reads one integer from {row,col} in the table
207      *
208      *  This function should be called after the execute method.
209      *  Data returned by the function should not change until
210      *   close or delete is called.
211      *  To get a string value, query the database's string table with
212      *   the integer value returned from this function.
213      */
214     UINT (*fetch_int)( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val );
215
216     /*
217      * fetch_stream - gets a stream from {row,col} in the table
218      *
219      *  This function is similar to fetch_int, except fetches a
220      *    stream instead of an integer.
221      */
222     UINT (*fetch_stream)( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm );
223
224     /*
225      * get_row - gets values from a row
226      *
227      */
228     UINT (*get_row)( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec );
229
230     /*
231      * set_row - sets values in a row as specified by mask
232      *
233      *  Similar semantics to fetch_int
234      */
235     UINT (*set_row)( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask );
236
237     /*
238      * Inserts a new row into the database from the records contents
239      */
240     UINT (*insert_row)( struct tagMSIVIEW *view, MSIRECORD *record, UINT row, BOOL temporary );
241
242     /*
243      * Deletes a row from the database
244      */
245     UINT (*delete_row)( struct tagMSIVIEW *view, UINT row );
246
247     /*
248      * execute - loads the underlying data into memory so it can be read
249      */
250     UINT (*execute)( struct tagMSIVIEW *view, MSIRECORD *record );
251
252     /*
253      * close - clears the data read by execute from memory
254      */
255     UINT (*close)( struct tagMSIVIEW *view );
256
257     /*
258      * get_dimensions - returns the number of rows or columns in a table.
259      *
260      *  The number of rows can only be queried after the execute method
261      *   is called. The number of columns can be queried at any time.
262      */
263     UINT (*get_dimensions)( struct tagMSIVIEW *view, UINT *rows, UINT *cols );
264
265     /*
266      * get_column_info - returns the name and type of a specific column
267      *
268      *  The column information can be queried at any time.
269      */
270     UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type,
271                              BOOL *temporary, LPCWSTR *table_name );
272
273     /*
274      * modify - not yet implemented properly
275      */
276     UINT (*modify)( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *record, UINT row );
277
278     /*
279      * delete - destroys the structure completely
280      */
281     UINT (*delete)( struct tagMSIVIEW * );
282
283     /*
284      * find_matching_rows - iterates through rows that match a value
285      *
286      * If the column type is a string then a string ID should be passed in.
287      *  If the value to be looked up is an integer then no transformation of
288      *  the input value is required, except if the column is a string, in which
289      *  case a string ID should be passed in.
290      * The handle is an input/output parameter that keeps track of the current
291      *  position in the iteration. It must be initialised to zero before the
292      *  first call and continued to be passed in to subsequent calls.
293      */
294     UINT (*find_matching_rows)( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle );
295
296     /*
297      * add_ref - increases the reference count of the table
298      */
299     UINT (*add_ref)( struct tagMSIVIEW *view );
300
301     /*
302      * release - decreases the reference count of the table
303      */
304     UINT (*release)( struct tagMSIVIEW *view );
305
306     /*
307      * add_column - adds a column to the table
308      */
309     UINT (*add_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number, LPCWSTR column, UINT type, BOOL hold );
310
311     /*
312      * remove_column - removes the column represented by table name and column number from the table
313      */
314     UINT (*remove_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number );
315
316     /*
317      * sort - orders the table by columns
318      */
319     UINT (*sort)( struct tagMSIVIEW *view, column_info *columns );
320
321     /*
322      * drop - drops the table from the database
323      */
324     UINT (*drop)( struct tagMSIVIEW *view );
325 } MSIVIEWOPS;
326
327 struct tagMSIVIEW
328 {
329     MSIOBJECTHDR hdr;
330     const MSIVIEWOPS *ops;
331     MSIDBERROR error;
332     const WCHAR *error_column;
333 };
334
335 struct msi_dialog_tag;
336 typedef struct msi_dialog_tag msi_dialog;
337
338 enum platform
339 {
340     PLATFORM_INTEL,
341     PLATFORM_INTEL64,
342     PLATFORM_X64,
343     PLATFORM_ARM
344 };
345
346 enum clr_version
347 {
348     CLR_VERSION_V10,
349     CLR_VERSION_V11,
350     CLR_VERSION_V20,
351     CLR_VERSION_V40,
352     CLR_VERSION_MAX
353 };
354
355 typedef struct tagMSIPACKAGE
356 {
357     MSIOBJECTHDR hdr;
358     MSIDATABASE *db;
359     INT version;
360     enum platform platform;
361     UINT num_langids;
362     LANGID *langids;
363     struct list patches;
364     struct list components;
365     struct list features;
366     struct list files;
367     struct list filepatches;
368     struct list tempfiles;
369     struct list folders;
370     struct list binaries;
371     struct list cabinet_streams;
372     LPWSTR ActionFormat;
373     LPWSTR LastAction;
374     UINT   action_progress_increment;
375     HANDLE log_file;
376     IAssemblyCache *cache_net[CLR_VERSION_MAX];
377     IAssemblyCache *cache_sxs;
378
379     struct list classes;
380     struct list extensions;
381     struct list progids;
382     struct list mimes;
383     struct list appids;
384
385     struct tagMSISCRIPT *script;
386
387     struct list RunningActions;
388
389     LPWSTR BaseURL;
390     LPWSTR PackagePath;
391     LPWSTR ProductCode;
392     LPWSTR localfile;
393     BOOL delete_on_close;
394
395     INSTALLUILEVEL ui_level;
396     UINT CurrentInstallState;
397     msi_dialog *dialog;
398     LPWSTR next_dialog;
399     float center_x;
400     float center_y;
401
402     UINT WordCount;
403     UINT Context;
404
405     struct list subscriptions;
406
407     struct list sourcelist_info;
408     struct list sourcelist_media;
409
410     unsigned char scheduled_action_running : 1;
411     unsigned char commit_action_running : 1;
412     unsigned char rollback_action_running : 1;
413     unsigned char need_reboot_at_end : 1;
414     unsigned char need_reboot_now : 1;
415     unsigned char need_rollback : 1;
416 } MSIPACKAGE;
417
418 typedef struct tagMSIPREVIEW
419 {
420     MSIOBJECTHDR hdr;
421     MSIPACKAGE *package;
422     msi_dialog *dialog;
423 } MSIPREVIEW;
424
425 #define MSI_MAX_PROPS 20
426
427 typedef struct tagMSISUMMARYINFO
428 {
429     MSIOBJECTHDR hdr;
430     IStorage *storage;
431     DWORD update_count;
432     PROPVARIANT property[MSI_MAX_PROPS];
433 } MSISUMMARYINFO;
434
435 typedef struct tagMSIFEATURE
436 {
437     struct list entry;
438     LPWSTR Feature;
439     LPWSTR Feature_Parent;
440     LPWSTR Title;
441     LPWSTR Description;
442     INT Display;
443     INT Level;
444     LPWSTR Directory;
445     INT Attributes;
446     INSTALLSTATE Installed;
447     INSTALLSTATE ActionRequest;
448     INSTALLSTATE Action;
449     struct list Children;
450     struct list Components;
451 } MSIFEATURE;
452
453 typedef struct tagMSIASSEMBLY
454 {
455     LPWSTR feature;
456     LPWSTR manifest;
457     LPWSTR application;
458     DWORD attributes;
459     LPWSTR display_name;
460     LPWSTR tempdir;
461     BOOL installed;
462     BOOL clr_version[CLR_VERSION_MAX];
463 } MSIASSEMBLY;
464
465 typedef struct tagMSICOMPONENT
466 {
467     struct list entry;
468     LPWSTR Component;
469     LPWSTR ComponentId;
470     LPWSTR Directory;
471     INT Attributes;
472     LPWSTR Condition;
473     LPWSTR KeyPath;
474     INSTALLSTATE Installed;
475     INSTALLSTATE ActionRequest;
476     INSTALLSTATE Action;
477     BOOL ForceLocalState;
478     BOOL Enabled;
479     INT  Cost;
480     INT  RefCount;
481     LPWSTR FullKeypath;
482     LPWSTR AdvertiseString;
483     MSIASSEMBLY *assembly;
484
485     unsigned int anyAbsent:1;
486     unsigned int hasAdvertiseFeature:1;
487     unsigned int hasLocalFeature:1;
488     unsigned int hasSourceFeature:1;
489 } MSICOMPONENT;
490
491 typedef struct tagComponentList
492 {
493     struct list entry;
494     MSICOMPONENT *component;
495 } ComponentList;
496
497 typedef struct tagFeatureList
498 {
499     struct list entry;
500     MSIFEATURE *feature;
501 } FeatureList;
502
503 enum folder_state
504 {
505     FOLDER_STATE_UNINITIALIZED,
506     FOLDER_STATE_EXISTS,
507     FOLDER_STATE_CREATED,
508     FOLDER_STATE_CREATED_PERSISTENT,
509     FOLDER_STATE_REMOVED
510 };
511
512 typedef struct tagMSIFOLDER
513 {
514     struct list entry;
515     struct list children;
516     LPWSTR Directory;
517     LPWSTR Parent;
518     LPWSTR TargetDefault;
519     LPWSTR SourceLongPath;
520     LPWSTR SourceShortPath;
521     LPWSTR ResolvedTarget;
522     LPWSTR ResolvedSource;
523     enum folder_state State;
524     BOOL persistent;
525     INT Cost;
526     INT Space;
527 } MSIFOLDER;
528
529 typedef struct tagFolderList
530 {
531     struct list entry;
532     MSIFOLDER *folder;
533 } FolderList;
534
535 typedef enum _msi_file_state {
536     msifs_invalid,
537     msifs_missing,
538     msifs_overwrite,
539     msifs_present,
540     msifs_installed,
541     msifs_skipped,
542     msifs_hashmatch
543 } msi_file_state;
544
545 typedef struct tagMSIFILE
546 {
547     struct list entry;
548     LPWSTR File;
549     MSICOMPONENT *Component;
550     LPWSTR FileName;
551     LPWSTR ShortName;
552     LPWSTR LongName;
553     INT FileSize;
554     LPWSTR Version;
555     LPWSTR Language;
556     INT Attributes;
557     INT Sequence;
558     msi_file_state state;
559     LPWSTR  TargetPath;
560     BOOL IsCompressed;
561     MSIFILEHASHINFO hash;
562     UINT disk_id;
563 } MSIFILE;
564
565 typedef struct tagMSITEMPFILE
566 {
567     struct list entry;
568     LPWSTR Path;
569 } MSITEMPFILE;
570
571 typedef struct tagMSIFILEPATCH
572 {
573     struct list entry;
574     MSIFILE *File;
575     INT Sequence;
576     INT PatchSize;
577     INT Attributes;
578     BOOL IsApplied;
579 } MSIFILEPATCH;
580
581 typedef struct tagMSIAPPID
582 {
583     struct list entry;
584     LPWSTR AppID; /* Primary key */
585     LPWSTR RemoteServerName;
586     LPWSTR LocalServer;
587     LPWSTR ServiceParameters;
588     LPWSTR DllSurrogate;
589     BOOL ActivateAtStorage;
590     BOOL RunAsInteractiveUser;
591 } MSIAPPID;
592
593 typedef struct tagMSIPROGID MSIPROGID;
594
595 typedef struct tagMSICLASS
596 {
597     struct list entry;
598     LPWSTR clsid;     /* Primary Key */
599     LPWSTR Context;   /* Primary Key */
600     MSICOMPONENT *Component;
601     MSIPROGID *ProgID;
602     LPWSTR ProgIDText;
603     LPWSTR Description;
604     MSIAPPID *AppID;
605     LPWSTR FileTypeMask;
606     LPWSTR IconPath;
607     LPWSTR DefInprocHandler;
608     LPWSTR DefInprocHandler32;
609     LPWSTR Argument;
610     MSIFEATURE *Feature;
611     INT Attributes;
612     /* not in the table, set during installation */
613     BOOL Installed;
614 } MSICLASS;
615
616 typedef struct tagMSIMIME MSIMIME;
617
618 typedef struct tagMSIEXTENSION
619 {
620     struct list entry;
621     LPWSTR Extension;  /* Primary Key */
622     MSICOMPONENT *Component;
623     MSIPROGID *ProgID;
624     LPWSTR ProgIDText;
625     MSIMIME *Mime;
626     MSIFEATURE *Feature;
627     /* not in the table, set during installation */
628     BOOL Installed;
629     struct list verbs;
630 } MSIEXTENSION;
631
632 struct tagMSIPROGID
633 {
634     struct list entry;
635     LPWSTR ProgID;  /* Primary Key */
636     MSIPROGID *Parent;
637     MSICLASS *Class;
638     LPWSTR Description;
639     LPWSTR IconPath;
640     /* not in the table, set during installation */
641     BOOL InstallMe;
642     MSIPROGID *CurVer;
643     MSIPROGID *VersionInd;
644 };
645
646 typedef struct tagMSIVERB
647 {
648     struct list entry;
649     LPWSTR Verb;
650     INT Sequence;
651     LPWSTR Command;
652     LPWSTR Argument;
653 } MSIVERB;
654
655 struct tagMSIMIME
656 {
657     struct list entry;
658     LPWSTR ContentType;  /* Primary Key */
659     MSIEXTENSION *Extension;
660     LPWSTR suffix;
661     LPWSTR clsid;
662     MSICLASS *Class;
663     /* not in the table, set during installation */
664     BOOL InstallMe;
665 };
666
667 enum SCRIPTS
668 {
669     SCRIPT_NONE     = -1,
670     SCRIPT_INSTALL  = 0,
671     SCRIPT_COMMIT   = 1,
672     SCRIPT_ROLLBACK = 2,
673     SCRIPT_MAX      = 3
674 };
675
676 #define SEQUENCE_UI       0x1
677 #define SEQUENCE_EXEC     0x2
678 #define SEQUENCE_INSTALL  0x10
679
680 typedef struct tagMSISCRIPT
681 {
682     LPWSTR  *Actions[SCRIPT_MAX];
683     UINT    ActionCount[SCRIPT_MAX];
684     BOOL    ExecuteSequenceRun;
685     BOOL    CurrentlyScripting;
686     UINT    InWhatSequence;
687     LPWSTR  *UniqueActions;
688     UINT    UniqueActionsCount;
689 } MSISCRIPT;
690
691 #define MSIHANDLETYPE_ANY 0
692 #define MSIHANDLETYPE_DATABASE 1
693 #define MSIHANDLETYPE_SUMMARYINFO 2
694 #define MSIHANDLETYPE_VIEW 3
695 #define MSIHANDLETYPE_RECORD 4
696 #define MSIHANDLETYPE_PACKAGE 5
697 #define MSIHANDLETYPE_PREVIEW 6
698
699 #define MSI_MAJORVERSION 4
700 #define MSI_MINORVERSION 5
701 #define MSI_BUILDNUMBER 6001
702
703 #define GUID_SIZE 39
704 #define SQUISH_GUID_SIZE 33
705
706 #define MSIHANDLE_MAGIC 0x4d434923
707
708 /* handle unicode/ascii output in the Msi* API functions */
709 typedef struct {
710     BOOL unicode;
711     union {
712        LPSTR a;
713        LPWSTR w;
714     } str;
715 } awstring;
716
717 typedef struct {
718     BOOL unicode;
719     union {
720        LPCSTR a;
721        LPCWSTR w;
722     } str;
723 } awcstring;
724
725 UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz ) DECLSPEC_HIDDEN;
726
727 /* msi server interface */
728 extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
729 extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
730 extern HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
731 extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN;
732
733 /* handle functions */
734 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN;
735 extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ) DECLSPEC_HIDDEN;
736 extern MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) DECLSPEC_HIDDEN;
737 extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) DECLSPEC_HIDDEN;
738 extern void msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
739 extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
740 extern void msiobj_lock(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
741 extern void msiobj_unlock(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
742 extern void msi_free_handle_table(void) DECLSPEC_HIDDEN;
743
744 extern void free_cached_tables( MSIDATABASE *db ) DECLSPEC_HIDDEN;
745 extern UINT MSI_CommitTables( MSIDATABASE *db ) DECLSPEC_HIDDEN;
746
747
748 /* string table functions */
749 enum StringPersistence
750 {
751     StringPersistent = 0,
752     StringNonPersistent = 1
753 };
754
755 extern BOOL msi_addstringW( string_table *st, const WCHAR *data, int len, USHORT refcount, enum StringPersistence persistence ) DECLSPEC_HIDDEN;
756 extern UINT msi_string2idW( const string_table *st, LPCWSTR buffer, UINT *id ) DECLSPEC_HIDDEN;
757 extern VOID msi_destroy_stringtable( string_table *st ) DECLSPEC_HIDDEN;
758 extern const WCHAR *msi_string_lookup_id( const string_table *st, UINT id ) DECLSPEC_HIDDEN;
759 extern HRESULT msi_init_string_table( IStorage *stg ) DECLSPEC_HIDDEN;
760 extern string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) DECLSPEC_HIDDEN;
761 extern UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *bytes_per_strref ) DECLSPEC_HIDDEN;
762 extern UINT msi_get_string_table_codepage( const string_table *st ) DECLSPEC_HIDDEN;
763 extern UINT msi_set_string_table_codepage( string_table *st, UINT codepage ) DECLSPEC_HIDDEN;
764
765 extern BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) DECLSPEC_HIDDEN;
766 extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table ) DECLSPEC_HIDDEN;
767
768 extern UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table,
769                               BYTE **pdata, UINT *psz ) DECLSPEC_HIDDEN;
770 extern UINT write_stream_data( IStorage *stg, LPCWSTR stname,
771                                LPCVOID data, UINT sz, BOOL bTable ) DECLSPEC_HIDDEN;
772
773 /* transform functions */
774 extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) DECLSPEC_HIDDEN;
775 extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
776                  LPCWSTR szTransformFile, int iErrorCond ) DECLSPEC_HIDDEN;
777 extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) DECLSPEC_HIDDEN;
778 extern UINT msi_apply_transforms( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
779
780 /* patch functions */
781 extern UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) DECLSPEC_HIDDEN;
782 extern UINT msi_apply_patches( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
783 extern UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) DECLSPEC_HIDDEN;
784 extern void msi_free_patchinfo( MSIPATCHINFO *patch ) DECLSPEC_HIDDEN;
785
786 /* action internals */
787 extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
788 extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN;
789 extern UINT ACTION_ForceReboot(MSIPACKAGE *package) DECLSPEC_HIDDEN;
790 extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable ) DECLSPEC_HIDDEN;
791 extern UINT MSI_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
792 extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) DECLSPEC_HIDDEN;
793 extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN;
794 extern INSTALLSTATE msi_get_component_action( MSIPACKAGE *package, MSICOMPONENT *comp ) DECLSPEC_HIDDEN;
795 extern INSTALLSTATE msi_get_feature_action( MSIPACKAGE *package, MSIFEATURE *feature ) DECLSPEC_HIDDEN;
796 extern UINT msi_load_all_components( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
797 extern UINT msi_load_all_features( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
798 extern UINT msi_validate_product_id( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
799
800 /* record internals */
801 extern void MSI_CloseRecord( MSIOBJECTHDR * ) DECLSPEC_HIDDEN;
802 extern UINT MSI_RecordSetIStream( MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN;
803 extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN;
804 extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
805 extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN;
806 extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN;
807 extern UINT MSI_RecordSetIntPtr( MSIRECORD *, UINT, INT_PTR ) DECLSPEC_HIDDEN;
808 extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN;
809 extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
810 extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN;
811 extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN;
812 extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
813 extern INT_PTR MSI_RecordGetIntPtr( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
814 extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN;
815 extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN;
816 extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN;
817 extern UINT MSI_RecordStreamToFile( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN;
818 extern UINT MSI_RecordSetStreamFromFileW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN;
819 extern UINT MSI_RecordCopyField( MSIRECORD *, UINT, MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
820 extern MSIRECORD *MSI_CloneRecord( MSIRECORD * ) DECLSPEC_HIDDEN;
821 extern BOOL MSI_RecordsAreEqual( MSIRECORD *, MSIRECORD * ) DECLSPEC_HIDDEN;
822 extern BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field) DECLSPEC_HIDDEN;
823
824 /* stream internals */
825 extern void enum_stream_names( IStorage *stg ) DECLSPEC_HIDDEN;
826 extern LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) DECLSPEC_HIDDEN;
827 extern BOOL decode_streamname(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN;
828
829 /* database internals */
830 extern UINT msi_get_raw_stream( MSIDATABASE *, LPCWSTR, IStream ** ) DECLSPEC_HIDDEN;
831 extern UINT msi_clone_open_stream( MSIDATABASE *, IStorage *, const WCHAR *, IStream ** ) DECLSPEC_HIDDEN;
832 void msi_destroy_stream( MSIDATABASE *, const WCHAR * ) DECLSPEC_HIDDEN;
833 extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** ) DECLSPEC_HIDDEN;
834 extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** ) DECLSPEC_HIDDEN;
835 extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ) DECLSPEC_HIDDEN;
836 typedef UINT (*record_func)( MSIRECORD *, LPVOID );
837 extern UINT MSI_IterateRecords( MSIQUERY *, LPDWORD, record_func, LPVOID ) DECLSPEC_HIDDEN;
838 extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... ) DECLSPEC_HIDDEN;
839 extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** ) DECLSPEC_HIDDEN;
840
841 /* view internals */
842 extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * ) DECLSPEC_HIDDEN;
843 extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** ) DECLSPEC_HIDDEN;
844 extern UINT MSI_ViewClose( MSIQUERY* ) DECLSPEC_HIDDEN;
845 extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **) DECLSPEC_HIDDEN;
846 extern UINT MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * ) DECLSPEC_HIDDEN;
847 extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, LPCWSTR, UINT * ) DECLSPEC_HIDDEN;
848 extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **) DECLSPEC_HIDDEN;
849
850 /* install internals */
851 extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) DECLSPEC_HIDDEN;
852
853 /* package internals */
854 extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPCWSTR ) DECLSPEC_HIDDEN;
855 extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE **pPackage ) DECLSPEC_HIDDEN;
856 extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
857 extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * ) DECLSPEC_HIDDEN;
858 extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR ) DECLSPEC_HIDDEN;
859 extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ) DECLSPEC_HIDDEN;
860 extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ) DECLSPEC_HIDDEN;
861 extern UINT MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE ) DECLSPEC_HIDDEN;
862 extern UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename ) DECLSPEC_HIDDEN;
863 extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR) DECLSPEC_HIDDEN;
864 extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR) DECLSPEC_HIDDEN;
865 extern UINT msi_clone_properties(MSIPACKAGE *) DECLSPEC_HIDDEN;
866 extern UINT msi_set_context(MSIPACKAGE *) DECLSPEC_HIDDEN;
867 extern void msi_adjust_privilege_properties(MSIPACKAGE *) DECLSPEC_HIDDEN;
868 extern UINT MSI_GetFeatureCost(MSIPACKAGE *, MSIFEATURE *, MSICOSTTREE, INSTALLSTATE, LPINT) DECLSPEC_HIDDEN;
869
870 /* for deformating */
871 extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, LPDWORD ) DECLSPEC_HIDDEN;
872
873 /* registry data encoding/decoding functions */
874 extern BOOL unsquash_guid(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN;
875 extern BOOL squash_guid(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN;
876 extern BOOL encode_base85_guid(GUID *,LPWSTR) DECLSPEC_HIDDEN;
877 extern BOOL decode_base85_guid(LPCWSTR,GUID*) DECLSPEC_HIDDEN;
878 extern UINT MSIREG_OpenUninstallKey(const WCHAR *, enum platform, HKEY *, BOOL) DECLSPEC_HIDDEN;
879 extern UINT MSIREG_DeleteUninstallKey(const WCHAR *, enum platform) DECLSPEC_HIDDEN;
880 extern UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid,
881                                   MSIINSTALLCONTEXT context, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
882 extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context,
883                                    HKEY *key, BOOL create) DECLSPEC_HIDDEN;
884 extern UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
885 UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context,
886                                     HKEY *key, BOOL create) DECLSPEC_HIDDEN;
887 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
888 extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid,
889                                             HKEY *key, BOOL create) DECLSPEC_HIDDEN;
890 extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
891 extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
892                                           LPCWSTR szUserSid, HKEY *key, BOOL create) DECLSPEC_HIDDEN;
893 extern UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext,
894                                         HKEY *key, BOOL create) DECLSPEC_HIDDEN;
895 extern UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT context,
896                                                  HKEY *key, BOOL create) DECLSPEC_HIDDEN;
897 extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext,
898                                     LPCWSTR szUserSid, HKEY *key, BOOL create) DECLSPEC_HIDDEN;
899 extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
900 extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
901 extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
902 extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
903 extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) DECLSPEC_HIDDEN;
904 extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
905 extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
906 extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) DECLSPEC_HIDDEN;
907 extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
908 extern UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
909 extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
910 extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN;
911 extern UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN;
912 extern UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context) DECLSPEC_HIDDEN;
913 extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name ) DECLSPEC_HIDDEN;
914 extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val) DECLSPEC_HIDDEN;
915
916 extern DWORD msi_version_str_to_dword(LPCWSTR p) DECLSPEC_HIDDEN;
917 extern void msi_parse_version_string(LPCWSTR, PDWORD, PDWORD) DECLSPEC_HIDDEN;
918 extern VS_FIXEDFILEINFO *msi_get_disk_file_version(LPCWSTR) DECLSPEC_HIDDEN;
919 extern int msi_compare_file_versions(VS_FIXEDFILEINFO *, const WCHAR *) DECLSPEC_HIDDEN;
920 extern int msi_compare_font_versions(const WCHAR *, const WCHAR *) DECLSPEC_HIDDEN;
921 extern DWORD msi_get_disk_file_size(LPCWSTR) DECLSPEC_HIDDEN;
922 extern BOOL msi_file_hash_matches(MSIFILE *) DECLSPEC_HIDDEN;
923
924 extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN;
925 extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) DECLSPEC_HIDDEN;
926 extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val ) DECLSPEC_HIDDEN;
927 extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val ) DECLSPEC_HIDDEN;
928
929 /* msi dialog interface */
930 typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
931 extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog*, msi_dialog_event_handler ) DECLSPEC_HIDDEN;
932 extern UINT msi_dialog_run_message_loop( msi_dialog* ) DECLSPEC_HIDDEN;
933 extern void msi_dialog_end_dialog( msi_dialog* ) DECLSPEC_HIDDEN;
934 extern void msi_dialog_check_messages( HANDLE ) DECLSPEC_HIDDEN;
935 extern void msi_dialog_destroy( msi_dialog* ) DECLSPEC_HIDDEN;
936 extern void msi_dialog_unregister_class( void ) DECLSPEC_HIDDEN;
937 extern void msi_dialog_handle_event( msi_dialog*, LPCWSTR, LPCWSTR, MSIRECORD * ) DECLSPEC_HIDDEN;
938 extern UINT msi_dialog_reset( msi_dialog *dialog ) DECLSPEC_HIDDEN;
939 extern UINT msi_dialog_directorylist_up( msi_dialog *dialog ) DECLSPEC_HIDDEN;
940 extern msi_dialog *msi_dialog_get_parent( msi_dialog *dialog ) DECLSPEC_HIDDEN;
941 extern LPWSTR msi_dialog_get_name( msi_dialog *dialog ) DECLSPEC_HIDDEN;
942 extern UINT msi_spawn_error_dialog( MSIPACKAGE*, LPWSTR, LPWSTR ) DECLSPEC_HIDDEN;
943
944 /* summary information */
945 extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount ) DECLSPEC_HIDDEN;
946 extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC_HIDDEN;
947 extern INT msi_suminfo_get_int32( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC_HIDDEN;
948 extern LPWSTR msi_get_suminfo_product( IStorage *stg ) DECLSPEC_HIDDEN;
949 extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ) DECLSPEC_HIDDEN;
950
951 /* undocumented functions */
952 UINT WINAPI MsiCreateAndVerifyInstallerDirectory( DWORD );
953 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR, LPWSTR, LPWSTR, LPWSTR, LPDWORD );
954 UINT WINAPI MsiDecomposeDescriptorA( LPCSTR, LPSTR, LPSTR, LPSTR, LPDWORD );
955 LANGID WINAPI MsiLoadStringW( MSIHANDLE, UINT, LPWSTR, int, LANGID );
956 LANGID WINAPI MsiLoadStringA( MSIHANDLE, UINT, LPSTR, int, LANGID );
957
958 /* UI globals */
959 extern INSTALLUILEVEL gUILevel DECLSPEC_HIDDEN;
960 extern HWND gUIhwnd DECLSPEC_HIDDEN;
961 extern INSTALLUI_HANDLERA gUIHandlerA DECLSPEC_HIDDEN;
962 extern INSTALLUI_HANDLERW gUIHandlerW DECLSPEC_HIDDEN;
963 extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord DECLSPEC_HIDDEN;
964 extern DWORD gUIFilter DECLSPEC_HIDDEN;
965 extern LPVOID gUIContext DECLSPEC_HIDDEN;
966 extern WCHAR *gszLogFile DECLSPEC_HIDDEN;
967 extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
968
969 /* action related functions */
970 extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script) DECLSPEC_HIDDEN;
971 extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script) DECLSPEC_HIDDEN;
972 extern void ACTION_FinishCustomActions( const MSIPACKAGE* package) DECLSPEC_HIDDEN;
973 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, UINT script, BOOL execute) DECLSPEC_HIDDEN;
974
975 /* actions in other modules */
976 extern UINT ACTION_AppSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN;
977 extern UINT ACTION_CCPSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN;
978 extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package) DECLSPEC_HIDDEN;
979 extern UINT ACTION_InstallFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN;
980 extern UINT ACTION_PatchFiles( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
981 extern UINT ACTION_RemoveFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN;
982 extern UINT ACTION_MoveFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN;
983 extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN;
984 extern UINT ACTION_RemoveDuplicateFiles(MSIPACKAGE *package) DECLSPEC_HIDDEN;
985 extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
986 extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
987 extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
988 extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
989 extern UINT ACTION_RegisterFonts(MSIPACKAGE *package) DECLSPEC_HIDDEN;
990 extern UINT ACTION_UnregisterClassInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
991 extern UINT ACTION_UnregisterExtensionInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
992 extern UINT ACTION_UnregisterFonts(MSIPACKAGE *package) DECLSPEC_HIDDEN;
993 extern UINT ACTION_UnregisterMIMEInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
994 extern UINT ACTION_UnregisterProgIdInfo(MSIPACKAGE *package) DECLSPEC_HIDDEN;
995 extern UINT ACTION_MsiPublishAssemblies(MSIPACKAGE *package) DECLSPEC_HIDDEN;
996 extern UINT ACTION_MsiUnpublishAssemblies(MSIPACKAGE *package) DECLSPEC_HIDDEN;
997
998 /* Helpers */
999 extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data ) DECLSPEC_HIDDEN;
1000 extern WCHAR *msi_dup_record_field(MSIRECORD *row, INT index) DECLSPEC_HIDDEN;
1001 extern LPWSTR msi_dup_property( MSIDATABASE *db, LPCWSTR prop ) DECLSPEC_HIDDEN;
1002 extern UINT msi_set_property( MSIDATABASE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
1003 extern UINT msi_get_property( MSIDATABASE *, LPCWSTR, LPWSTR, LPDWORD ) DECLSPEC_HIDDEN;
1004 extern int msi_get_property_int( MSIDATABASE *package, LPCWSTR prop, int def ) DECLSPEC_HIDDEN;
1005 extern WCHAR *msi_resolve_source_folder(MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder) DECLSPEC_HIDDEN;
1006 extern void msi_resolve_target_folder(MSIPACKAGE *package, const WCHAR *name, BOOL load_prop) DECLSPEC_HIDDEN;
1007 extern WCHAR *msi_normalize_path(const WCHAR *) DECLSPEC_HIDDEN;
1008 extern WCHAR *msi_resolve_file_source(MSIPACKAGE *package, MSIFILE *file) DECLSPEC_HIDDEN;
1009 extern const WCHAR *msi_get_target_folder(MSIPACKAGE *package, const WCHAR *name) DECLSPEC_HIDDEN;
1010 extern void msi_reset_folders( MSIPACKAGE *package, BOOL source ) DECLSPEC_HIDDEN;
1011 extern MSICOMPONENT *msi_get_loaded_component(MSIPACKAGE *package, const WCHAR *Component) DECLSPEC_HIDDEN;
1012 extern MSIFEATURE *msi_get_loaded_feature(MSIPACKAGE *package, const WCHAR *Feature) DECLSPEC_HIDDEN;
1013 extern MSIFILE *msi_get_loaded_file(MSIPACKAGE *package, const WCHAR *file) DECLSPEC_HIDDEN;
1014 extern MSIFILEPATCH *msi_get_loaded_filepatch(MSIPACKAGE* package, const WCHAR *key) DECLSPEC_HIDDEN;
1015 extern MSIFOLDER *msi_get_loaded_folder(MSIPACKAGE *package, const WCHAR *dir) DECLSPEC_HIDDEN;
1016 extern int msi_track_tempfile(MSIPACKAGE *package, const WCHAR *path) DECLSPEC_HIDDEN;
1017 extern void msi_free_action_script(MSIPACKAGE *package, UINT script) DECLSPEC_HIDDEN;
1018 extern WCHAR *msi_build_icon_path(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
1019 extern WCHAR *msi_build_directory_name(DWORD , ...) DECLSPEC_HIDDEN;
1020 extern BOOL msi_create_full_path(const WCHAR *path) DECLSPEC_HIDDEN;
1021 extern void msi_reduce_to_long_filename(WCHAR *) DECLSPEC_HIDDEN;
1022 extern WCHAR *msi_create_component_advertise_string(MSIPACKAGE *, MSICOMPONENT *, const WCHAR *) DECLSPEC_HIDDEN;
1023 extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, MSIFEATURE *feature) DECLSPEC_HIDDEN;
1024 extern UINT msi_register_unique_action(MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
1025 extern BOOL msi_action_is_unique(const MSIPACKAGE *, const WCHAR *) DECLSPEC_HIDDEN;
1026 extern WCHAR *msi_build_error_string(MSIPACKAGE *, UINT, DWORD, ...) DECLSPEC_HIDDEN;
1027 extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
1028                         MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value) DECLSPEC_HIDDEN;
1029 extern UINT msi_create_empty_local_file(LPWSTR path, LPCWSTR suffix) DECLSPEC_HIDDEN;
1030 extern UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) DECLSPEC_HIDDEN;
1031 extern MSIASSEMBLY *msi_load_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN;
1032 extern UINT msi_install_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN;
1033 extern UINT msi_uninstall_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN;
1034 extern BOOL msi_init_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
1035 extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
1036 extern WCHAR *msi_font_version_from_file(const WCHAR *) DECLSPEC_HIDDEN;
1037 extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN;
1038
1039 /* media */
1040
1041 typedef BOOL (*PMSICABEXTRACTCB)(MSIPACKAGE *, LPCWSTR, DWORD, LPWSTR *, DWORD *, PVOID);
1042
1043 #define MSICABEXTRACT_BEGINEXTRACT  0x01
1044 #define MSICABEXTRACT_FILEEXTRACTED 0x02
1045
1046 typedef struct
1047 {
1048     MSIPACKAGE* package;
1049     MSIMEDIAINFO *mi;
1050     PMSICABEXTRACTCB cb;
1051     LPWSTR curfile;
1052     PVOID user;
1053 } MSICABDATA;
1054
1055 extern UINT ready_media(MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi) DECLSPEC_HIDDEN;
1056 extern UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) DECLSPEC_HIDDEN;
1057 extern void msi_free_media_info(MSIMEDIAINFO *mi) DECLSPEC_HIDDEN;
1058 extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data) DECLSPEC_HIDDEN;
1059 extern UINT msi_add_cabinet_stream(MSIPACKAGE *, UINT, IStorage *, const WCHAR *) DECLSPEC_HIDDEN;
1060
1061 /* control event stuff */
1062 extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
1063                                       MSIRECORD *data) DECLSPEC_HIDDEN;
1064 extern VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog) DECLSPEC_HIDDEN;
1065 extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package) DECLSPEC_HIDDEN;
1066 extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog,
1067                                       LPCWSTR event, LPCWSTR control, LPCWSTR attribute) DECLSPEC_HIDDEN;
1068
1069 /* OLE automation */
1070 extern HRESULT create_msiserver(IUnknown *pOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
1071 extern HRESULT create_session(MSIHANDLE msiHandle, IDispatch *pInstaller, IDispatch **pDispatch) DECLSPEC_HIDDEN;
1072 extern HRESULT load_type_info(IDispatch *iface, ITypeInfo **pptinfo, REFIID clsid, LCID lcid) DECLSPEC_HIDDEN;
1073
1074 /* Scripting */
1075 extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action) DECLSPEC_HIDDEN;
1076
1077 /* User interface messages from the actions */
1078 extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN;
1079 extern void msi_ui_actiondata(MSIPACKAGE *, const WCHAR *, MSIRECORD *) DECLSPEC_HIDDEN;
1080
1081 /* common strings */
1082 static const WCHAR szSourceDir[] = {'S','o','u','r','c','e','D','i','r',0};
1083 static const WCHAR szSOURCEDIR[] = {'S','O','U','R','C','E','D','I','R',0};
1084 static const WCHAR szRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
1085 static const WCHAR szTargetDir[] = {'T','A','R','G','E','T','D','I','R',0};
1086 static const WCHAR szLocalSid[] = {'S','-','1','-','5','-','1','8',0};
1087 static const WCHAR szAllSid[] = {'S','-','1','-','1','-','0',0};
1088 static const WCHAR szEmpty[] = {0};
1089 static const WCHAR szAll[] = {'A','L','L',0};
1090 static const WCHAR szOne[] = {'1',0};
1091 static const WCHAR szZero[] = {'0',0};
1092 static const WCHAR szSpace[] = {' ',0};
1093 static const WCHAR szBackSlash[] = {'\\',0};
1094 static const WCHAR szForwardSlash[] = {'/',0};
1095 static const WCHAR szDot[] = {'.',0};
1096 static const WCHAR szDotDot[] = {'.','.',0};
1097 static const WCHAR szSemiColon[] = {';',0};
1098 static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0};
1099 static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0};
1100 static const WCHAR szState[] = {'S','t','a','t','e',0};
1101 static const WCHAR szMsi[] = {'m','s','i',0};
1102 static const WCHAR szPatch[] = {'P','A','T','C','H',0};
1103 static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
1104 static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0};
1105 static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0};
1106 static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
1107 static const WCHAR szRemove[] = {'R','E','M','O','V','E',0};
1108 static const WCHAR szUserSID[] = {'U','s','e','r','S','I','D',0};
1109 static const WCHAR szProductCode[] = {'P','r','o','d','u','c','t','C','o','d','e',0};
1110 static const WCHAR szRegisterClassInfo[] = {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
1111 static const WCHAR szRegisterProgIdInfo[] = {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
1112 static const WCHAR szRegisterExtensionInfo[] = {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
1113 static const WCHAR szRegisterMIMEInfo[] = {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
1114 static const WCHAR szDuplicateFiles[] = {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
1115 static const WCHAR szRemoveDuplicateFiles[] = {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
1116 static const WCHAR szInstallFiles[] = {'I','n','s','t','a','l','l','F','i','l','e','s',0};
1117 static const WCHAR szPatchFiles[] = {'P','a','t','c','h','F','i','l','e','s',0};
1118 static const WCHAR szRemoveFiles[] = {'R','e','m','o','v','e','F','i','l','e','s',0};
1119 static const WCHAR szFindRelatedProducts[] = {'F','i','n','d','R','e','l','a','t','e','d','P','r','o','d','u','c','t','s',0};
1120 static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0};
1121 static const WCHAR szCustomActionData[] = {'C','u','s','t','o','m','A','c','t','i','o','n','D','a','t','a',0};
1122 static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
1123 static const WCHAR szProductID[] = {'P','r','o','d','u','c','t','I','D',0};
1124 static const WCHAR szPIDTemplate[] = {'P','I','D','T','e','m','p','l','a','t','e',0};
1125 static const WCHAR szPIDKEY[] = {'P','I','D','K','E','Y',0};
1126 static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
1127 static const WCHAR szSumInfo[] = {5 ,'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0};
1128 static const WCHAR szHCR[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T','\\',0};
1129 static const WCHAR szHCU[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R','\\',0};
1130 static const WCHAR szHLM[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\',0};
1131 static const WCHAR szHU[] = {'H','K','E','Y','_','U','S','E','R','S','\\',0};
1132 static const WCHAR szWindowsFolder[] = {'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
1133 static const WCHAR szAppSearch[] = {'A','p','p','S','e','a','r','c','h',0};
1134 static const WCHAR szMoveFiles[] = {'M','o','v','e','F','i','l','e','s',0};
1135 static const WCHAR szCCPSearch[] = {'C','C','P','S','e','a','r','c','h',0};
1136 static const WCHAR szUnregisterClassInfo[] = {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
1137 static const WCHAR szUnregisterExtensionInfo[] = {'U','n','r','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
1138 static const WCHAR szUnregisterMIMEInfo[] = {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
1139 static const WCHAR szUnregisterProgIdInfo[] = {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
1140 static const WCHAR szRegisterFonts[] = {'R','e','g','i','s','t','e','r','F','o','n','t','s',0};
1141 static const WCHAR szUnregisterFonts[] = {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0};
1142 static const WCHAR szCLSID[] = {'C','L','S','I','D',0};
1143 static const WCHAR szProgID[] = {'P','r','o','g','I','D',0};
1144 static const WCHAR szVIProgID[] = {'V','e','r','s','i','o','n','I','n','d','e','p','e','n','d','e','n','t','P','r','o','g','I','D',0};
1145 static const WCHAR szAppID[] = {'A','p','p','I','D',0};
1146 static const WCHAR szDefaultIcon[] = {'D','e','f','a','u','l','t','I','c','o','n',0};
1147 static const WCHAR szInprocHandler[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r',0};
1148 static const WCHAR szInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
1149 static const WCHAR szMIMEDatabase[] = {'M','I','M','E','\\','D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',' ','T','y','p','e','\\',0};
1150 static const WCHAR szLocalPackage[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
1151 static const WCHAR szOriginalDatabase[] = {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
1152 static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0};
1153 static const WCHAR szAdminUser[] = {'A','d','m','i','n','U','s','e','r',0};
1154 static const WCHAR szIntel[] = {'I','n','t','e','l',0};
1155 static const WCHAR szIntel64[] = {'I','n','t','e','l','6','4',0};
1156 static const WCHAR szX64[] = {'x','6','4',0};
1157 static const WCHAR szAMD64[] = {'A','M','D','6','4',0};
1158 static const WCHAR szARM[] = {'A','r','m',0};
1159 static const WCHAR szWow6432NodeCLSID[] = {'W','o','w','6','4','3','2','N','o','d','e','\\','C','L','S','I','D',0};
1160 static const WCHAR szWow6432Node[] = {'W','o','w','6','4','3','2','N','o','d','e',0};
1161 static const WCHAR szStreams[] = {'_','S','t','r','e','a','m','s',0};
1162 static const WCHAR szStorages[] = {'_','S','t','o','r','a','g','e','s',0};
1163 static const WCHAR szMsiPublishAssemblies[] = {'M','s','i','P','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0};
1164 static const WCHAR szCostingComplete[] = {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0};
1165 static const WCHAR szTempFolder[] = {'T','e','m','p','F','o','l','d','e','r',0};
1166 static const WCHAR szDatabase[] = {'D','A','T','A','B','A','S','E',0};
1167 static const WCHAR szCRoot[] = {'C',':','\\',0};
1168 static const WCHAR szProductLanguage[] = {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
1169 static const WCHAR szProductVersion[] = {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
1170 static const WCHAR szWindowsInstaller[] = {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
1171 static const WCHAR szStringData[] = {'_','S','t','r','i','n','g','D','a','t','a',0};
1172 static const WCHAR szStringPool[] = {'_','S','t','r','i','n','g','P','o','o','l',0};
1173 static const WCHAR szInstallLevel[] = {'I','N','S','T','A','L','L','L','E','V','E','L',0};
1174 static const WCHAR szCostInitialize[] = {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
1175 static const WCHAR szAppDataFolder[] = {'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
1176 static const WCHAR szRollbackDisabled[] = {'R','o','l','l','b','a','c','k','D','i','s','a','b','l','e','d',0};
1177 static const WCHAR szName[] = {'N','a','m','e',0};
1178 static const WCHAR szData[] = {'D','a','t','a',0};
1179 static const WCHAR szLangResource[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n',0};
1180 static const WCHAR szInstallLocation[] = {'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0};
1181
1182 /* memory allocation macro functions */
1183 static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
1184 static inline void *msi_alloc( size_t len )
1185 {
1186     return HeapAlloc( GetProcessHeap(), 0, len );
1187 }
1188
1189 static void *msi_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1);
1190 static inline void *msi_alloc_zero( size_t len )
1191 {
1192     return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
1193 }
1194
1195 static void *msi_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
1196 static inline void *msi_realloc( void *mem, size_t len )
1197 {
1198     return HeapReAlloc( GetProcessHeap(), 0, mem, len );
1199 }
1200
1201 static void *msi_realloc_zero( void *mem, size_t len ) __WINE_ALLOC_SIZE(2);
1202 static inline void *msi_realloc_zero( void *mem, size_t len )
1203 {
1204     return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len );
1205 }
1206
1207 static inline BOOL msi_free( void *mem )
1208 {
1209     return HeapFree( GetProcessHeap(), 0, mem );
1210 }
1211
1212 static inline char *strdupWtoA( LPCWSTR str )
1213 {
1214     LPSTR ret = NULL;
1215     DWORD len;
1216
1217     if (!str) return ret;
1218     len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1219     ret = msi_alloc( len );
1220     if (ret)
1221         WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
1222     return ret;
1223 }
1224
1225 static inline LPWSTR strdupAtoW( LPCSTR str )
1226 {
1227     LPWSTR ret = NULL;
1228     DWORD len;
1229
1230     if (!str) return ret;
1231     len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
1232     ret = msi_alloc( len * sizeof(WCHAR) );
1233     if (ret)
1234         MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
1235     return ret;
1236 }
1237
1238 static inline LPWSTR strdupW( LPCWSTR src )
1239 {
1240     LPWSTR dest;
1241     if (!src) return NULL;
1242     dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) );
1243     if (dest)
1244         lstrcpyW(dest, src);
1245     return dest;
1246 }
1247
1248 #endif /* __WINE_MSI_PRIVATE__ */