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