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