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