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__
34 #include "wine/list.h"
36 #define MSI_DATASIZEMASK 0x00ff
37 #define MSITYPE_VALID 0x0100
38 #define MSITYPE_LOCALIZABLE 0x200
39 #define MSITYPE_STRING 0x0800
40 #define MSITYPE_NULLABLE 0x1000
41 #define MSITYPE_KEY 0x2000
43 /* Word Count masks */
44 #define MSIWORDCOUNT_SHORTFILENAMES 0x0001
45 #define MSIWORDCOUNT_COMPRESSED 0x0002
46 #define MSIWORDCOUNT_ADMINISTRATIVE 0x0004
47 #define MSIWORDCOUNT_PRIVILEGES 0x0008
49 /* Install UI level mask for AND operation to exclude flags */
50 #define INSTALLUILEVEL_MASK 0x0007
52 #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
55 typedef struct tagMSITABLE MSITABLE
;
58 typedef struct string_table string_table
;
60 struct tagMSIOBJECTHDR
;
61 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR
;
63 typedef VOID (*msihandledestructor
)( MSIOBJECTHDR
* );
65 struct tagMSIOBJECTHDR
70 msihandledestructor destructor
;
73 typedef struct tagMSIDATABASE
77 string_table
*strings
;
78 UINT bytes_per_strref
;
83 struct list transforms
;
86 typedef struct tagMSIVIEW MSIVIEW
;
88 typedef struct tagMSIQUERY
97 /* maybe we can use a Variant instead of doing it ourselves? */
98 typedef struct tagMSIFIELD
109 typedef struct tagMSIRECORD
112 UINT count
; /* as passed to MsiCreateRecord */
113 MSIFIELD fields
[1]; /* nb. array size is count+1 */
116 typedef struct tagMSISOURCELISTINFO
125 typedef struct tagMSIMEDIADISK
135 typedef const struct tagMSICOLUMNHASHENTRY
*MSIITERHANDLE
;
137 typedef struct tagMSIVIEWOPS
140 * fetch_int - reads one integer from {row,col} in the table
142 * This function should be called after the execute method.
143 * Data returned by the function should not change until
144 * close or delete is called.
145 * To get a string value, query the database's string table with
146 * the integer value returned from this function.
148 UINT (*fetch_int
)( struct tagMSIVIEW
*view
, UINT row
, UINT col
, UINT
*val
);
151 * fetch_stream - gets a stream from {row,col} in the table
153 * This function is similar to fetch_int, except fetches a
154 * stream instead of an integer.
156 UINT (*fetch_stream
)( struct tagMSIVIEW
*view
, UINT row
, UINT col
, IStream
**stm
);
159 * set_row - sets values in a row as specified by mask
161 * Similar semantics to fetch_int
163 UINT (*set_row
)( struct tagMSIVIEW
*view
, UINT row
, MSIRECORD
*rec
, UINT mask
);
166 * Inserts a new row into the database from the records contents
168 UINT (*insert_row
)( struct tagMSIVIEW
*view
, MSIRECORD
*record
, BOOL temporary
);
171 * Deletes a row from the database
173 UINT (*delete_row
)( struct tagMSIVIEW
*view
, UINT row
);
176 * execute - loads the underlying data into memory so it can be read
178 UINT (*execute
)( struct tagMSIVIEW
*view
, MSIRECORD
*record
);
181 * close - clears the data read by execute from memory
183 UINT (*close
)( struct tagMSIVIEW
*view
);
186 * get_dimensions - returns the number of rows or columns in a table.
188 * The number of rows can only be queried after the execute method
189 * is called. The number of columns can be queried at any time.
191 UINT (*get_dimensions
)( struct tagMSIVIEW
*view
, UINT
*rows
, UINT
*cols
);
194 * get_column_info - returns the name and type of a specific column
196 * The name is HeapAlloc'ed by this function and should be freed by
198 * The column information can be queried at any time.
200 UINT (*get_column_info
)( struct tagMSIVIEW
*view
, UINT n
, LPWSTR
*name
, UINT
*type
);
203 * modify - not yet implemented properly
205 UINT (*modify
)( struct tagMSIVIEW
*view
, MSIMODIFY eModifyMode
, MSIRECORD
*record
);
208 * delete - destroys the structure completely
210 UINT (*delete)( struct tagMSIVIEW
* );
213 * find_matching_rows - iterates through rows that match a value
215 * If the column type is a string then a string ID should be passed in.
216 * If the value to be looked up is an integer then no transformation of
217 * the input value is required, except if the column is a string, in which
218 * case a string ID should be passed in.
219 * The handle is an input/output parameter that keeps track of the current
220 * position in the iteration. It must be initialised to zero before the
221 * first call and continued to be passed in to subsequent calls.
223 UINT (*find_matching_rows
)( struct tagMSIVIEW
*view
, UINT col
, UINT val
, UINT
*row
, MSIITERHANDLE
*handle
);
229 const MSIVIEWOPS
*ops
;
232 struct msi_dialog_tag
;
233 typedef struct msi_dialog_tag msi_dialog
;
235 typedef struct tagMSIPACKAGE
239 struct list components
;
240 struct list features
;
242 struct list tempfiles
;
248 struct list extensions
;
253 struct tagMSISCRIPT
*script
;
255 struct list RunningActions
;
261 UINT CurrentInstallState
;
269 struct list subscriptions
;
271 struct list sourcelist_info
;
272 struct list sourcelist_media
;
274 unsigned char scheduled_action_running
: 1;
275 unsigned char commit_action_running
: 1;
276 unsigned char rollback_action_running
: 1;
279 typedef struct tagMSIPREVIEW
286 #define MSI_MAX_PROPS 20
288 typedef struct tagMSISUMMARYINFO
293 PROPVARIANT property
[MSI_MAX_PROPS
];
296 typedef struct tagMSIFEATURE
300 LPWSTR Feature_Parent
;
307 INSTALLSTATE Installed
;
308 INSTALLSTATE ActionRequest
;
310 struct list Children
;
311 struct list Components
;
315 typedef struct tagMSICOMPONENT
325 INSTALLSTATE Installed
;
326 INSTALLSTATE ActionRequest
;
328 BOOL ForceLocalState
;
333 LPWSTR AdvertiseString
;
335 unsigned int hasAdvertiseFeature
:1;
336 unsigned int hasLocalFeature
:1;
337 unsigned int hasSourceFeature
:1;
340 typedef struct tagComponentList
343 MSICOMPONENT
*component
;
346 typedef struct tagFeatureList
352 typedef struct tagMSIFOLDER
357 LPWSTR TargetDefault
;
358 LPWSTR SourceLongPath
;
359 LPWSTR SourceShortPath
;
361 LPWSTR ResolvedTarget
;
362 LPWSTR ResolvedSource
;
363 LPWSTR Property
; /* initially set property */
365 /* 0 = uninitialized */
367 /* 2 = created remove if empty */
368 /* 3 = created persist if empty */
373 typedef enum _msi_file_state
{
382 typedef struct tagMSIFILE
386 MSICOMPONENT
*Component
;
395 msi_file_state state
;
401 typedef struct tagMSITEMPFILE
407 typedef struct tagMSIAPPID
410 LPWSTR AppID
; /* Primary key */
411 LPWSTR RemoteServerName
;
413 LPWSTR ServiceParameters
;
415 BOOL ActivateAtStorage
;
416 BOOL RunAsInteractiveUser
;
419 typedef struct tagMSIPROGID MSIPROGID
;
421 typedef struct tagMSICLASS
424 LPWSTR clsid
; /* Primary Key */
425 LPWSTR Context
; /* Primary Key */
426 MSICOMPONENT
*Component
;
433 LPWSTR DefInprocHandler
;
434 LPWSTR DefInprocHandler32
;
438 /* not in the table, set during installation */
442 typedef struct tagMSIMIME MSIMIME
;
444 typedef struct tagMSIEXTENSION
447 LPWSTR Extension
; /* Primary Key */
448 MSICOMPONENT
*Component
;
453 /* not in the table, set during installation */
461 LPWSTR ProgID
; /* Primary Key */
466 /* not in the table, set during installation */
469 MSIPROGID
*VersionInd
;
472 typedef struct tagMSIVERB
484 LPWSTR ContentType
; /* Primary Key */
485 MSIEXTENSION
*Extension
;
488 /* not in the table, set during installation */
499 #define SEQUENCE_UI 0x1
500 #define SEQUENCE_EXEC 0x2
501 #define SEQUENCE_INSTALL 0x10
503 typedef struct tagMSISCRIPT
505 LPWSTR
*Actions
[TOTAL_SCRIPTS
];
506 UINT ActionCount
[TOTAL_SCRIPTS
];
507 BOOL ExecuteSequenceRun
;
508 BOOL CurrentlyScripting
;
510 LPWSTR
*UniqueActions
;
511 UINT UniqueActionsCount
;
514 #define MSIHANDLETYPE_ANY 0
515 #define MSIHANDLETYPE_DATABASE 1
516 #define MSIHANDLETYPE_SUMMARYINFO 2
517 #define MSIHANDLETYPE_VIEW 3
518 #define MSIHANDLETYPE_RECORD 4
519 #define MSIHANDLETYPE_PACKAGE 5
520 #define MSIHANDLETYPE_PREVIEW 6
522 #define MSI_MAJORVERSION 3
523 #define MSI_MINORVERSION 1
524 #define MSI_BUILDNUMBER 4000
528 #define MSIHANDLE_MAGIC 0x4d434923
530 DEFINE_GUID(CLSID_IMsiServer
, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
531 DEFINE_GUID(CLSID_IMsiServerX1
, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
532 DEFINE_GUID(CLSID_IMsiServerX2
, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
533 DEFINE_GUID(CLSID_IMsiServerX3
, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
535 DEFINE_GUID(CLSID_IMsiServerMessage
, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
537 DEFINE_GUID(CLSID_IWineMsiRemoteCustomAction
,0xBA26E6FA,0x4F27,0x4f56,0x95,0x3A,0x3F,0x90,0x27,0x20,0x18,0xAA);
538 DEFINE_GUID(CLSID_IWineMsiRemotePackage
,0x902b3592,0x9d08,0x4dfd,0xa5,0x93,0xd0,0x7c,0x52,0x54,0x64,0x21);
540 /* handle unicode/ascii output in the Msi* API functions */
557 UINT
msi_strcpy_to_awstring( LPCWSTR str
, awstring
*awbuf
, DWORD
*sz
);
559 /* msi server interface */
560 extern ITypeLib
*get_msi_typelib( LPWSTR
*path
);
561 extern HRESULT
create_msi_custom_remote( IUnknown
*pOuter
, LPVOID
*ppObj
);
562 extern HRESULT
create_msi_remote_package( IUnknown
*pOuter
, LPVOID
*ppObj
);
563 extern IUnknown
*msi_get_remote(MSIHANDLE handle
);
565 /* handle functions */
566 extern void *msihandle2msiinfo(MSIHANDLE handle
, UINT type
);
567 extern MSIHANDLE
alloc_msihandle( MSIOBJECTHDR
* );
568 extern MSIHANDLE
alloc_msi_remote_handle( IUnknown
*unk
);
569 extern void *alloc_msiobject(UINT type
, UINT size
, msihandledestructor destroy
);
570 extern void msiobj_addref(MSIOBJECTHDR
*);
571 extern int msiobj_release(MSIOBJECTHDR
*);
572 extern void msiobj_lock(MSIOBJECTHDR
*);
573 extern void msiobj_unlock(MSIOBJECTHDR
*);
574 extern void msi_free_handle_table(void);
576 extern void free_cached_tables( MSIDATABASE
*db
);
577 extern void msi_free_transforms( MSIDATABASE
*db
);
578 extern UINT
MSI_CommitTables( MSIDATABASE
*db
);
581 /* string table functions */
582 enum StringPersistence
584 StringPersistent
= 0,
585 StringNonPersistent
= 1
588 extern BOOL
msi_addstringW( string_table
*st
, UINT string_no
, const WCHAR
*data
, int len
, UINT refcount
, enum StringPersistence persistence
);
589 extern UINT
msi_id2stringW( const string_table
*st
, UINT string_no
, LPWSTR buffer
, UINT
*sz
);
590 extern UINT
msi_id2stringA( const string_table
*st
, UINT string_no
, LPSTR buffer
, UINT
*sz
);
592 extern UINT
msi_string2idW( const string_table
*st
, LPCWSTR buffer
, UINT
*id
);
593 extern UINT
msi_string2idA( const string_table
*st
, LPCSTR str
, UINT
*id
);
594 extern VOID
msi_destroy_stringtable( string_table
*st
);
595 extern UINT
msi_strcmp( const string_table
*st
, UINT lval
, UINT rval
, UINT
*res
);
596 extern const WCHAR
*msi_string_lookup_id( const string_table
*st
, UINT id
);
597 extern HRESULT
msi_init_string_table( IStorage
*stg
);
598 extern string_table
*msi_load_string_table( IStorage
*stg
, UINT
*bytes_per_strref
);
599 extern UINT
msi_save_string_table( const string_table
*st
, IStorage
*storage
);
602 extern void msi_table_set_strref(UINT bytes_per_strref
);
603 extern BOOL
TABLE_Exists( MSIDATABASE
*db
, LPCWSTR name
);
604 extern MSICONDITION
MSI_DatabaseIsTablePersistent( MSIDATABASE
*db
, LPCWSTR table
);
606 extern UINT
read_raw_stream_data( MSIDATABASE
*db
, LPCWSTR stname
,
607 USHORT
**pdata
, UINT
*psz
);
608 extern UINT
read_stream_data( IStorage
*stg
, LPCWSTR stname
, BOOL table
,
609 BYTE
**pdata
, UINT
*psz
);
610 extern UINT
write_stream_data( IStorage
*stg
, LPCWSTR stname
,
611 LPCVOID data
, UINT sz
, BOOL bTable
);
613 /* transform functions */
614 extern UINT
msi_table_apply_transform( MSIDATABASE
*db
, IStorage
*stg
);
615 extern UINT
MSI_DatabaseApplyTransformW( MSIDATABASE
*db
,
616 LPCWSTR szTransformFile
, int iErrorCond
);
617 extern void append_storage_to_db( MSIDATABASE
*db
, IStorage
*stg
);
619 /* action internals */
620 extern UINT
MSI_InstallPackage( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
621 extern void ACTION_free_package_structures( MSIPACKAGE
* );
622 extern UINT
ACTION_DialogBox( MSIPACKAGE
*, LPCWSTR
);
623 extern UINT
ACTION_ForceReboot(MSIPACKAGE
*package
);
624 extern UINT
MSI_Sequence( MSIPACKAGE
*package
, LPCWSTR szTable
, INT iSequenceMode
);
625 extern UINT
MSI_SetFeatureStates( MSIPACKAGE
*package
);
626 extern UINT
msi_parse_command_line( MSIPACKAGE
*package
, LPCWSTR szCommandLine
);
628 /* record internals */
629 extern UINT
MSI_RecordSetIStream( MSIRECORD
*, unsigned int, IStream
*);
630 extern UINT
MSI_RecordGetIStream( MSIRECORD
*, unsigned int, IStream
**);
631 extern const WCHAR
*MSI_RecordGetString( const MSIRECORD
*, unsigned int );
632 extern MSIRECORD
*MSI_CreateRecord( unsigned int );
633 extern UINT
MSI_RecordSetInteger( MSIRECORD
*, unsigned int, int );
634 extern UINT
MSI_RecordSetStringW( MSIRECORD
*, unsigned int, LPCWSTR
);
635 extern UINT
MSI_RecordSetStringA( MSIRECORD
*, unsigned int, LPCSTR
);
636 extern BOOL
MSI_RecordIsNull( MSIRECORD
*, unsigned int );
637 extern UINT
MSI_RecordGetStringW( MSIRECORD
* , unsigned int, LPWSTR
, DWORD
*);
638 extern UINT
MSI_RecordGetStringA( MSIRECORD
*, unsigned int, LPSTR
, DWORD
*);
639 extern int MSI_RecordGetInteger( MSIRECORD
*, unsigned int );
640 extern UINT
MSI_RecordReadStream( MSIRECORD
*, unsigned int, char *, DWORD
*);
641 extern unsigned int MSI_RecordGetFieldCount( const MSIRECORD
*rec
);
642 extern UINT
MSI_RecordSetStream( MSIRECORD
*, unsigned int, IStream
* );
643 extern UINT
MSI_RecordDataSize( MSIRECORD
*, unsigned int );
644 extern UINT
MSI_RecordStreamToFile( MSIRECORD
*, unsigned int, LPCWSTR
);
645 extern UINT
MSI_RecordCopyField( MSIRECORD
*, unsigned int, MSIRECORD
*, unsigned int );
647 /* stream internals */
648 extern UINT
get_raw_stream( MSIHANDLE hdb
, LPCWSTR stname
, IStream
**stm
);
649 extern UINT
db_get_raw_stream( MSIDATABASE
*db
, LPCWSTR stname
, IStream
**stm
);
650 extern void enum_stream_names( IStorage
*stg
);
651 extern BOOL
decode_streamname(LPCWSTR in
, LPWSTR out
);
652 extern LPWSTR
encode_streamname(BOOL bTable
, LPCWSTR in
);
654 /* database internals */
655 extern UINT
MSI_OpenDatabaseW( LPCWSTR
, LPCWSTR
, MSIDATABASE
** );
656 extern UINT
MSI_DatabaseOpenViewW(MSIDATABASE
*, LPCWSTR
, MSIQUERY
** );
657 extern UINT
MSI_OpenQuery( MSIDATABASE
*, MSIQUERY
**, LPCWSTR
, ... );
658 typedef UINT (*record_func
)( MSIRECORD
*, LPVOID
);
659 extern UINT
MSI_IterateRecords( MSIQUERY
*, DWORD
*, record_func
, LPVOID
);
660 extern MSIRECORD
*MSI_QueryGetRecord( MSIDATABASE
*db
, LPCWSTR query
, ... );
661 extern UINT
MSI_DatabaseImport( MSIDATABASE
*, LPCWSTR
, LPCWSTR
);
662 extern UINT
MSI_DatabaseExport( MSIDATABASE
*, LPCWSTR
, LPCWSTR
, LPCWSTR
);
663 extern UINT
MSI_DatabaseGetPrimaryKeys( MSIDATABASE
*, LPCWSTR
, MSIRECORD
** );
666 extern UINT
MSI_ViewExecute( MSIQUERY
*, MSIRECORD
* );
667 extern UINT
MSI_ViewFetch( MSIQUERY
*, MSIRECORD
** );
668 extern UINT
MSI_ViewClose( MSIQUERY
* );
669 extern UINT
MSI_ViewGetColumnInfo(MSIQUERY
*, MSICOLINFO
, MSIRECORD
**);
670 extern UINT
MSI_ViewModify( MSIQUERY
*, MSIMODIFY
, MSIRECORD
* );
671 extern UINT
VIEW_find_column( MSIVIEW
*, LPCWSTR
, UINT
* );
674 /* install internals */
675 extern UINT
MSI_SetInstallLevel( MSIPACKAGE
*package
, int iInstallLevel
);
677 /* package internals */
678 extern MSIPACKAGE
*MSI_CreatePackage( MSIDATABASE
*, LPCWSTR
);
679 extern UINT
MSI_OpenPackageW( LPCWSTR szPackage
, MSIPACKAGE
**pPackage
);
680 extern UINT
MSI_SetTargetPathW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
681 extern UINT
MSI_SetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
682 extern INT
MSI_ProcessMessage( MSIPACKAGE
*, INSTALLMESSAGE
, MSIRECORD
* );
683 extern UINT
MSI_GetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPWSTR
, DWORD
* );
684 extern UINT
MSI_GetPropertyA(MSIPACKAGE
*, LPCSTR
, LPSTR
, DWORD
* );
685 extern MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*, LPCWSTR
);
686 extern UINT
MSI_GetComponentStateW( MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
*, INSTALLSTATE
* );
687 extern UINT
MSI_GetFeatureStateW( MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
*, INSTALLSTATE
* );
688 extern UINT WINAPI
MSI_SetFeatureStateW(MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
);
689 extern LPCWSTR
msi_download_file( LPCWSTR szUrl
, LPWSTR filename
);
690 extern UINT
msi_package_add_info(MSIPACKAGE
*, DWORD
, DWORD
, LPCWSTR
, LPWSTR
);
691 extern UINT
msi_package_add_media_disk(MSIPACKAGE
*, DWORD
, DWORD
, DWORD
, LPWSTR
, LPWSTR
);
692 extern UINT
msi_clone_properties(MSIPACKAGE
*);
694 /* for deformating */
695 extern UINT
MSI_FormatRecordW( MSIPACKAGE
*, MSIRECORD
*, LPWSTR
, DWORD
* );
697 /* registry data encoding/decoding functions */
698 extern BOOL
unsquash_guid(LPCWSTR in
, LPWSTR out
);
699 extern BOOL
squash_guid(LPCWSTR in
, LPWSTR out
);
700 extern BOOL
encode_base85_guid(GUID
*,LPWSTR
);
701 extern BOOL
decode_base85_guid(LPCWSTR
,GUID
*);
702 extern UINT
MSIREG_OpenUninstallKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
703 extern UINT
MSIREG_OpenUserProductsKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
704 extern UINT
MSIREG_OpenUserPatchesKey(LPCWSTR szPatch
, HKEY
* key
, BOOL create
);
705 extern UINT
MSIREG_OpenFeatures(HKEY
* key
);
706 extern UINT
MSIREG_OpenFeaturesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
707 extern UINT
MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct
, HKEY
*key
, BOOL create
);
708 extern UINT
MSIREG_OpenComponents(HKEY
* key
);
709 extern UINT
MSIREG_OpenUserComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
710 extern UINT
MSIREG_OpenComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
711 extern UINT
MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent
, HKEY
*key
, BOOL create
);
712 extern UINT
MSIREG_OpenProductsKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
713 extern UINT
MSIREG_OpenPatchesKey(LPCWSTR szPatch
, HKEY
* key
, BOOL create
);
714 extern UINT
MSIREG_OpenUserDataProductKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
715 extern UINT
MSIREG_OpenInstallPropertiesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
716 extern UINT
MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
717 extern UINT
MSIREG_OpenUserComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
718 extern UINT
MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
719 extern UINT
MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
720 extern UINT
MSIREG_DeleteProductKey(LPCWSTR szProduct
);
721 extern UINT
MSIREG_DeleteUserProductKey(LPCWSTR szProduct
);
722 extern UINT
MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct
);
724 extern LPWSTR
msi_reg_get_val_str( HKEY hkey
, LPCWSTR name
);
725 extern BOOL
msi_reg_get_val_dword( HKEY hkey
, LPCWSTR name
, DWORD
*val
);
727 extern DWORD
msi_version_str_to_dword(LPCWSTR p
);
728 extern LPWSTR
msi_version_dword_to_str(DWORD version
);
730 extern LONG
msi_reg_set_val_str( HKEY hkey
, LPCWSTR name
, LPCWSTR value
);
731 extern LONG
msi_reg_set_val_multi_str( HKEY hkey
, LPCWSTR name
, LPCWSTR value
);
732 extern LONG
msi_reg_set_val_dword( HKEY hkey
, LPCWSTR name
, DWORD val
);
733 extern LONG
msi_reg_set_subkey_val( HKEY hkey
, LPCWSTR path
, LPCWSTR name
, LPCWSTR val
);
735 /* msi dialog interface */
736 typedef UINT (*msi_dialog_event_handler
)( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
, msi_dialog
* );
737 extern msi_dialog
*msi_dialog_create( MSIPACKAGE
*, LPCWSTR
, msi_dialog
*, msi_dialog_event_handler
);
738 extern UINT
msi_dialog_run_message_loop( msi_dialog
* );
739 extern void msi_dialog_end_dialog( msi_dialog
* );
740 extern void msi_dialog_check_messages( HANDLE
);
741 extern void msi_dialog_do_preview( msi_dialog
* );
742 extern void msi_dialog_destroy( msi_dialog
* );
743 extern BOOL
msi_dialog_register_class( void );
744 extern void msi_dialog_unregister_class( void );
745 extern void msi_dialog_handle_event( msi_dialog
*, LPCWSTR
, LPCWSTR
, MSIRECORD
* );
746 extern UINT
msi_dialog_reset( msi_dialog
*dialog
);
747 extern UINT
msi_dialog_directorylist_up( msi_dialog
*dialog
);
748 extern msi_dialog
*msi_dialog_get_parent( msi_dialog
*dialog
);
749 extern LPWSTR
msi_dialog_get_name( msi_dialog
*dialog
);
750 extern UINT
msi_spawn_error_dialog( MSIPACKAGE
*, LPWSTR
, LPWSTR
);
753 extern MSIPREVIEW
*MSI_EnableUIPreview( MSIDATABASE
* );
754 extern UINT
MSI_PreviewDialogW( MSIPREVIEW
*, LPCWSTR
);
756 /* summary information */
757 extern MSISUMMARYINFO
*MSI_GetSummaryInformationW( IStorage
*stg
, UINT uiUpdateCount
);
758 extern LPWSTR
msi_suminfo_dup_string( MSISUMMARYINFO
*si
, UINT uiProperty
);
759 extern LPWSTR
msi_get_suminfo_product( IStorage
*stg
);
761 /* undocumented functions */
762 UINT WINAPI
MsiCreateAndVerifyInstallerDirectory( DWORD
);
763 UINT WINAPI
MsiDecomposeDescriptorW( LPCWSTR
, LPWSTR
, LPWSTR
, LPWSTR
, DWORD
* );
764 UINT WINAPI
MsiDecomposeDescriptorA( LPCSTR
, LPSTR
, LPSTR
, LPSTR
, DWORD
* );
765 LANGID WINAPI
MsiLoadStringW( MSIHANDLE
, UINT
, LPWSTR
, int, LANGID
);
766 LANGID WINAPI
MsiLoadStringA( MSIHANDLE
, UINT
, LPSTR
, int, LANGID
);
769 extern INSTALLUILEVEL gUILevel
;
771 extern INSTALLUI_HANDLERA gUIHandlerA
;
772 extern INSTALLUI_HANDLERW gUIHandlerW
;
773 extern DWORD gUIFilter
;
774 extern LPVOID gUIContext
;
775 extern WCHAR gszLogFile
[MAX_PATH
];
776 extern HINSTANCE msi_hInstance
;
778 /* action related functions */
779 extern UINT
ACTION_PerformAction(MSIPACKAGE
*package
, const WCHAR
*action
, UINT script
, BOOL force
);
780 extern UINT
ACTION_PerformUIAction(MSIPACKAGE
*package
, const WCHAR
*action
, UINT script
);
781 extern void ACTION_FinishCustomActions( const MSIPACKAGE
* package
);
782 extern UINT
ACTION_CustomAction(MSIPACKAGE
*package
,const WCHAR
*action
, UINT script
, BOOL execute
);
784 static inline void msi_feature_set_state( MSIFEATURE
*feature
, INSTALLSTATE state
)
786 feature
->ActionRequest
= state
;
787 feature
->Action
= state
;
790 static inline void msi_component_set_state( MSICOMPONENT
*comp
, INSTALLSTATE state
)
792 comp
->ActionRequest
= state
;
793 comp
->Action
= state
;
796 /* actions in other modules */
797 extern UINT
ACTION_AppSearch(MSIPACKAGE
*package
);
798 extern UINT
ACTION_FindRelatedProducts(MSIPACKAGE
*package
);
799 extern UINT
ACTION_InstallFiles(MSIPACKAGE
*package
);
800 extern UINT
ACTION_RemoveFiles(MSIPACKAGE
*package
);
801 extern UINT
ACTION_DuplicateFiles(MSIPACKAGE
*package
);
802 extern UINT
ACTION_RegisterClassInfo(MSIPACKAGE
*package
);
803 extern UINT
ACTION_RegisterProgIdInfo(MSIPACKAGE
*package
);
804 extern UINT
ACTION_RegisterExtensionInfo(MSIPACKAGE
*package
);
805 extern UINT
ACTION_RegisterMIMEInfo(MSIPACKAGE
*package
);
806 extern UINT
ACTION_RegisterFonts(MSIPACKAGE
*package
);
809 extern DWORD
deformat_string(MSIPACKAGE
*package
, LPCWSTR ptr
, WCHAR
** data
);
810 extern LPWSTR
msi_dup_record_field(MSIRECORD
*row
, INT index
);
811 extern LPWSTR
msi_dup_property(MSIPACKAGE
*package
, LPCWSTR prop
);
812 extern int msi_get_property_int( MSIPACKAGE
*package
, LPCWSTR prop
, int def
);
813 extern LPWSTR
resolve_folder(MSIPACKAGE
*package
, LPCWSTR name
, BOOL source
,
814 BOOL set_prop
, BOOL load_prop
, MSIFOLDER
**folder
);
815 extern MSICOMPONENT
*get_loaded_component( MSIPACKAGE
* package
, LPCWSTR Component
);
816 extern MSIFEATURE
*get_loaded_feature( MSIPACKAGE
* package
, LPCWSTR Feature
);
817 extern MSIFILE
*get_loaded_file( MSIPACKAGE
* package
, LPCWSTR file
);
818 extern MSIFOLDER
*get_loaded_folder( MSIPACKAGE
*package
, LPCWSTR dir
);
819 extern int track_tempfile(MSIPACKAGE
*package
, LPCWSTR path
);
820 extern UINT
schedule_action(MSIPACKAGE
*package
, UINT script
, LPCWSTR action
);
821 extern void msi_free_action_script(MSIPACKAGE
*package
, UINT script
);
822 extern LPWSTR
build_icon_path(MSIPACKAGE
*, LPCWSTR
);
823 extern LPWSTR
build_directory_name(DWORD
, ...);
824 extern BOOL
create_full_pathW(const WCHAR
*path
);
825 extern BOOL
ACTION_VerifyComponentForAction(const MSICOMPONENT
*, INSTALLSTATE
);
826 extern BOOL
ACTION_VerifyFeatureForAction(const MSIFEATURE
*, INSTALLSTATE
);
827 extern void reduce_to_longfilename(WCHAR
*);
828 extern void reduce_to_shortfilename(WCHAR
*);
829 extern LPWSTR
create_component_advertise_string(MSIPACKAGE
*, MSICOMPONENT
*, LPCWSTR
);
830 extern void ACTION_UpdateComponentStates(MSIPACKAGE
*package
, LPCWSTR szFeature
);
831 extern UINT
register_unique_action(MSIPACKAGE
*, LPCWSTR
);
832 extern BOOL
check_unique_action(const MSIPACKAGE
*, LPCWSTR
);
833 extern WCHAR
* generate_error_string(MSIPACKAGE
*, UINT
, DWORD
, ... );
834 extern UINT
msi_create_component_directories( MSIPACKAGE
*package
);
835 extern void msi_ui_error( DWORD msg_id
, DWORD type
);
837 /* control event stuff */
838 extern VOID
ControlEvent_FireSubscribedEvent(MSIPACKAGE
*package
, LPCWSTR event
,
840 extern VOID
ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE
*package
, LPWSTR dialog
);
841 extern VOID
ControlEvent_CleanupSubscriptions(MSIPACKAGE
*package
);
842 extern VOID
ControlEvent_SubscribeToEvent(MSIPACKAGE
*package
, msi_dialog
*dialog
,
843 LPCWSTR event
, LPCWSTR control
, LPCWSTR attribute
);
844 extern VOID
ControlEvent_UnSubscribeToEvent( MSIPACKAGE
*package
, LPCWSTR event
,
845 LPCWSTR control
, LPCWSTR attribute
);
848 extern HRESULT
create_msiserver(IUnknown
*pOuter
, LPVOID
*ppObj
);
849 extern HRESULT
create_session(MSIHANDLE msiHandle
, IDispatch
*pInstaller
, IDispatch
**pDispatch
);
850 extern HRESULT
load_type_info(IDispatch
*iface
, ITypeInfo
**pptinfo
, REFIID clsid
, LCID lcid
);
853 extern DWORD
call_script(MSIHANDLE hPackage
, INT type
, LPCWSTR script
, LPCWSTR function
, LPCWSTR action
);
855 /* User Interface messages from the actions */
856 extern void ui_progress(MSIPACKAGE
*, int, int, int, int);
857 extern void ui_actiondata(MSIPACKAGE
*, LPCWSTR
, MSIRECORD
*);
859 /* string consts use a number of places and defined in helpers.c*/
860 extern const WCHAR cszSourceDir
[];
861 extern const WCHAR cszSOURCEDIR
[];
862 extern const WCHAR szProductCode
[];
863 extern const WCHAR cszRootDrive
[];
864 extern const WCHAR cszbs
[];
866 /* memory allocation macro functions */
867 static inline void *msi_alloc( size_t len
)
869 return HeapAlloc( GetProcessHeap(), 0, len
);
872 static inline void *msi_alloc_zero( size_t len
)
874 return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
877 static inline void *msi_realloc( void *mem
, size_t len
)
879 return HeapReAlloc( GetProcessHeap(), 0, mem
, len
);
882 static inline void *msi_realloc_zero( void *mem
, size_t len
)
884 return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
887 static inline BOOL
msi_free( void *mem
)
889 return HeapFree( GetProcessHeap(), 0, mem
);
892 static inline char *strdupWtoA( LPCWSTR str
)
897 if (!str
) return ret
;
898 len
= WideCharToMultiByte( CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
899 ret
= msi_alloc( len
);
901 WideCharToMultiByte( CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
905 static inline LPWSTR
strdupAtoW( LPCSTR str
)
910 if (!str
) return ret
;
911 len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
912 ret
= msi_alloc( len
* sizeof(WCHAR
) );
914 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
918 static inline LPWSTR
strdupW( LPCWSTR src
)
921 if (!src
) return NULL
;
922 dest
= msi_alloc( (lstrlenW(src
)+1)*sizeof(WCHAR
) );
928 #endif /* __WINE_MSI_PRIVATE__ */