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