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 #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
52 typedef struct tagMSITABLE MSITABLE
;
55 typedef struct string_table string_table
;
57 struct tagMSIOBJECTHDR
;
58 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR
;
60 typedef VOID (*msihandledestructor
)( MSIOBJECTHDR
* );
62 struct tagMSIOBJECTHDR
67 msihandledestructor destructor
;
70 typedef struct tagMSIDATABASE
74 string_table
*strings
;
79 struct list transforms
;
82 typedef struct tagMSIVIEW MSIVIEW
;
84 typedef struct tagMSIQUERY
93 /* maybe we can use a Variant instead of doing it ourselves? */
94 typedef struct tagMSIFIELD
105 typedef struct tagMSIRECORD
108 UINT count
; /* as passed to MsiCreateRecord */
109 MSIFIELD fields
[1]; /* nb. array size is count+1 */
112 typedef const struct tagMSICOLUMNHASHENTRY
*MSIITERHANDLE
;
114 typedef struct tagMSIVIEWOPS
117 * fetch_int - reads one integer from {row,col} in the table
119 * This function should be called after the execute method.
120 * Data returned by the function should not change until
121 * close or delete is called.
122 * To get a string value, query the database's string table with
123 * the integer value returned from this function.
125 UINT (*fetch_int
)( struct tagMSIVIEW
*, UINT row
, UINT col
, UINT
*val
);
128 * fetch_stream - gets a stream from {row,col} in the table
130 * This function is similar to fetch_int, except fetches a
131 * stream instead of an integer.
133 UINT (*fetch_stream
)( struct tagMSIVIEW
*, UINT row
, UINT col
, IStream
**stm
);
136 * set_row - sets values in a row as specified by mask
138 * Similar semantics to fetch_int
140 UINT (*set_row
)( struct tagMSIVIEW
*, UINT row
, MSIRECORD
*rec
, UINT mask
);
143 * Inserts a new row into the database from the records contents
145 UINT (*insert_row
)( struct tagMSIVIEW
*, MSIRECORD
* );
148 * execute - loads the underlying data into memory so it can be read
150 UINT (*execute
)( struct tagMSIVIEW
*, MSIRECORD
* );
153 * close - clears the data read by execute from memory
155 UINT (*close
)( struct tagMSIVIEW
* );
158 * get_dimensions - returns the number of rows or columns in a table.
160 * The number of rows can only be queried after the execute method
161 * is called. The number of columns can be queried at any time.
163 UINT (*get_dimensions
)( struct tagMSIVIEW
*, UINT
*rows
, UINT
*cols
);
166 * get_column_info - returns the name and type of a specific column
168 * The name is HeapAlloc'ed by this function and should be freed by
170 * The column information can be queried at any time.
172 UINT (*get_column_info
)( struct tagMSIVIEW
*, UINT n
, LPWSTR
*name
, UINT
*type
);
175 * modify - not yet implemented properly
177 UINT (*modify
)( struct tagMSIVIEW
*, MSIMODIFY
, MSIRECORD
* );
180 * delete - destroys the structure completely
182 UINT (*delete)( struct tagMSIVIEW
* );
185 * find_matching_rows - iterates through rows that match a value
187 * If the column type is a string then a string ID should be passed in.
188 * If the value to be looked up is an integer then no transformation of
189 * the input value is required, except if the column is a string, in which
190 * case a string ID should be passed in.
191 * The handle is an input/output parameter that keeps track of the current
192 * position in the iteration. It must be initialised to zero before the
193 * first call and continued to be passed in to subsequent calls.
195 UINT (*find_matching_rows
)( struct tagMSIVIEW
*, UINT col
, UINT val
, UINT
*row
, MSIITERHANDLE
*handle
);
201 const MSIVIEWOPS
*ops
;
204 struct msi_dialog_tag
;
205 typedef struct msi_dialog_tag msi_dialog
;
207 #define PROPERTY_HASH_SIZE 67
209 typedef struct tagMSIPACKAGE
213 struct list components
;
214 struct list features
;
216 struct list tempfiles
;
222 struct list extensions
;
227 struct tagMSISCRIPT
*script
;
229 struct list RunningActions
;
235 UINT CurrentInstallState
;
243 struct list props
[PROPERTY_HASH_SIZE
];
245 struct list subscriptions
;
248 typedef struct tagMSIPREVIEW
255 #define MSI_MAX_PROPS 20
257 typedef struct tagMSISUMMARYINFO
262 PROPVARIANT property
[MSI_MAX_PROPS
];
265 typedef struct tagMSIFEATURE
269 LPWSTR Feature_Parent
;
276 INSTALLSTATE Installed
;
277 INSTALLSTATE ActionRequest
;
279 struct list Children
;
280 struct list Components
;
284 typedef struct tagMSICOMPONENT
294 INSTALLSTATE Installed
;
295 INSTALLSTATE ActionRequest
;
297 BOOL ForceLocalState
;
302 LPWSTR AdvertiseString
;
304 int hasAdvertiseFeature
:1;
305 int hasLocalFeature
:1;
306 int hasSourceFeature
:1;
309 typedef struct tagComponentList
312 MSICOMPONENT
*component
;
315 typedef struct tagFeatureList
321 typedef struct tagMSIFOLDER
326 LPWSTR TargetDefault
;
327 LPWSTR SourceLongPath
;
328 LPWSTR SourceShortPath
;
330 LPWSTR ResolvedTarget
;
331 LPWSTR ResolvedSource
;
332 LPWSTR Property
; /* initially set property */
334 /* 0 = uninitialized */
336 /* 2 = created remove if empty */
337 /* 3 = created persist if empty */
342 typedef enum _msi_file_state
{
351 typedef struct tagMSIFILE
355 MSICOMPONENT
*Component
;
364 msi_file_state state
;
370 typedef struct tagMSITEMPFILE
376 typedef struct tagMSIAPPID
379 LPWSTR AppID
; /* Primary key */
380 LPWSTR RemoteServerName
;
382 LPWSTR ServiceParameters
;
384 BOOL ActivateAtStorage
;
385 BOOL RunAsInteractiveUser
;
388 typedef struct tagMSIPROGID MSIPROGID
;
390 typedef struct tagMSICLASS
393 LPWSTR clsid
; /* Primary Key */
394 LPWSTR Context
; /* Primary Key */
395 MSICOMPONENT
*Component
;
402 LPWSTR DefInprocHandler
;
403 LPWSTR DefInprocHandler32
;
407 /* not in the table, set during installation */
411 typedef struct tagMSIMIME MSIMIME
;
413 typedef struct tagMSIEXTENSION
416 LPWSTR Extension
; /* Primary Key */
417 MSICOMPONENT
*Component
;
422 /* not in the table, set during installation */
430 LPWSTR ProgID
; /* Primary Key */
435 /* not in the table, set during installation */
438 MSIPROGID
*VersionInd
;
441 typedef struct tagMSIVERB
453 LPWSTR ContentType
; /* Primary Key */
454 MSIEXTENSION
*Extension
;
457 /* not in the table, set during installation */
468 #define SEQUENCE_UI 0x1
469 #define SEQUENCE_EXEC 0x2
470 #define SEQUENCE_INSTALL 0x10
472 typedef struct tagMSISCRIPT
474 LPWSTR
*Actions
[TOTAL_SCRIPTS
];
475 UINT ActionCount
[TOTAL_SCRIPTS
];
476 BOOL ExecuteSequenceRun
;
477 BOOL CurrentlyScripting
;
479 LPWSTR
*UniqueActions
;
480 UINT UniqueActionsCount
;
483 #define MSIHANDLETYPE_ANY 0
484 #define MSIHANDLETYPE_DATABASE 1
485 #define MSIHANDLETYPE_SUMMARYINFO 2
486 #define MSIHANDLETYPE_VIEW 3
487 #define MSIHANDLETYPE_RECORD 4
488 #define MSIHANDLETYPE_PACKAGE 5
489 #define MSIHANDLETYPE_PREVIEW 6
491 #define MSI_MAJORVERSION 3
492 #define MSI_MINORVERSION 1
493 #define MSI_BUILDNUMBER 4000
497 #define MSIHANDLE_MAGIC 0x4d434923
499 DEFINE_GUID(CLSID_IMsiServer
, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
500 DEFINE_GUID(CLSID_IMsiServerX1
, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
501 DEFINE_GUID(CLSID_IMsiServerX2
, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
502 DEFINE_GUID(CLSID_IMsiServerX3
, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
504 DEFINE_GUID(CLSID_IMsiServerMessage
, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
506 /* handle unicode/ascii output in the Msi* API functions */
523 UINT
msi_strcpy_to_awstring( LPCWSTR str
, awstring
*awbuf
, DWORD
*sz
);
525 /* handle functions */
526 extern void *msihandle2msiinfo(MSIHANDLE handle
, UINT type
);
527 extern MSIHANDLE
alloc_msihandle( MSIOBJECTHDR
* );
528 extern void *alloc_msiobject(UINT type
, UINT size
, msihandledestructor destroy
);
529 extern void msiobj_addref(MSIOBJECTHDR
*);
530 extern int msiobj_release(MSIOBJECTHDR
*);
531 extern void msiobj_lock(MSIOBJECTHDR
*);
532 extern void msiobj_unlock(MSIOBJECTHDR
*);
533 extern void msi_free_handle_table(void);
535 extern void free_cached_tables( MSIDATABASE
*db
);
536 extern void msi_free_transforms( MSIDATABASE
*db
);
537 extern string_table
*load_string_table( IStorage
*stg
);
538 extern UINT
MSI_CommitTables( MSIDATABASE
*db
);
539 extern HRESULT
init_string_table( IStorage
*stg
);
542 /* string table functions */
543 extern BOOL
msi_addstring( string_table
*st
, UINT string_no
, const CHAR
*data
, int len
, UINT refcount
);
544 extern BOOL
msi_addstringW( string_table
*st
, UINT string_no
, const WCHAR
*data
, int len
, UINT refcount
);
545 extern UINT
msi_id2stringW( string_table
*st
, UINT string_no
, LPWSTR buffer
, UINT
*sz
);
546 extern UINT
msi_id2stringA( string_table
*st
, UINT string_no
, LPSTR buffer
, UINT
*sz
);
548 extern UINT
msi_string2idW( string_table
*st
, LPCWSTR buffer
, UINT
*id
);
549 extern UINT
msi_string2idA( string_table
*st
, LPCSTR str
, UINT
*id
);
550 extern string_table
*msi_init_stringtable( int entries
, UINT codepage
);
551 extern VOID
msi_destroy_stringtable( string_table
*st
);
552 extern UINT
msi_string_count( string_table
*st
);
553 extern UINT
msi_id_refcount( string_table
*st
, UINT i
);
554 extern UINT
msi_string_totalsize( string_table
*st
, UINT
*datasize
, UINT
*poolsize
);
555 extern UINT
msi_strcmp( string_table
*st
, UINT lval
, UINT rval
, UINT
*res
);
556 extern const WCHAR
*msi_string_lookup_id( string_table
*st
, UINT id
);
557 extern UINT
msi_string_get_codepage( string_table
*st
);
560 extern BOOL
TABLE_Exists( MSIDATABASE
*db
, LPWSTR name
);
561 extern MSICONDITION
MSI_DatabaseIsTablePersistent( MSIDATABASE
*db
, LPCWSTR table
);
563 extern UINT
read_raw_stream_data( MSIDATABASE
*, LPCWSTR stname
,
564 USHORT
**pdata
, UINT
*psz
);
566 /* transform functions */
567 extern UINT
msi_table_apply_transform( MSIDATABASE
*db
, IStorage
*stg
);
568 extern UINT
MSI_DatabaseApplyTransformW( MSIDATABASE
*db
,
569 LPCWSTR szTransformFile
, int iErrorCond
);
570 extern void append_storage_to_db( MSIDATABASE
*db
, IStorage
*stg
);
572 /* action internals */
573 extern UINT
MSI_InstallPackage( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
574 extern void ACTION_free_package_structures( MSIPACKAGE
* );
575 extern UINT
ACTION_DialogBox( MSIPACKAGE
*, LPCWSTR
);
576 extern UINT
MSI_Sequence( MSIPACKAGE
*package
, LPCWSTR szTable
, INT iSequenceMode
);
577 extern UINT
MSI_SetFeatureStates( MSIPACKAGE
*package
);
579 /* record internals */
580 extern UINT
MSI_RecordSetIStream( MSIRECORD
*, unsigned int, IStream
*);
581 extern UINT
MSI_RecordGetIStream( MSIRECORD
*, unsigned int, IStream
**);
582 extern const WCHAR
*MSI_RecordGetString( MSIRECORD
*, unsigned int );
583 extern MSIRECORD
*MSI_CreateRecord( unsigned int );
584 extern UINT
MSI_RecordSetInteger( MSIRECORD
*, unsigned int, int );
585 extern UINT
MSI_RecordSetStringW( MSIRECORD
*, unsigned int, LPCWSTR
);
586 extern UINT
MSI_RecordSetStringA( MSIRECORD
*, unsigned int, LPCSTR
);
587 extern BOOL
MSI_RecordIsNull( MSIRECORD
*, unsigned int );
588 extern UINT
MSI_RecordGetStringW( MSIRECORD
* , unsigned int, LPWSTR
, DWORD
*);
589 extern UINT
MSI_RecordGetStringA( MSIRECORD
*, unsigned int, LPSTR
, DWORD
*);
590 extern int MSI_RecordGetInteger( MSIRECORD
*, unsigned int );
591 extern UINT
MSI_RecordReadStream( MSIRECORD
*, unsigned int, char *, DWORD
*);
592 extern unsigned int MSI_RecordGetFieldCount( MSIRECORD
*rec
);
593 extern UINT
MSI_RecordSetStreamW( MSIRECORD
*, unsigned int, LPCWSTR
);
594 extern UINT
MSI_RecordSetStreamA( MSIRECORD
*, unsigned int, LPCSTR
);
595 extern UINT
MSI_RecordDataSize( MSIRECORD
*, unsigned int );
596 extern UINT
MSI_RecordStreamToFile( MSIRECORD
*, unsigned int, LPCWSTR
);
597 extern UINT
MSI_RecordCopyField( MSIRECORD
*, unsigned int, MSIRECORD
*, unsigned int );
599 /* stream internals */
600 extern UINT
get_raw_stream( MSIHANDLE hdb
, LPCWSTR stname
, IStream
**stm
);
601 extern UINT
db_get_raw_stream( MSIDATABASE
*db
, LPCWSTR stname
, IStream
**stm
);
602 extern void enum_stream_names( IStorage
*stg
);
604 /* database internals */
605 extern UINT
MSI_OpenDatabaseW( LPCWSTR
, LPCWSTR
, MSIDATABASE
** );
606 extern UINT
MSI_DatabaseOpenViewW(MSIDATABASE
*, LPCWSTR
, MSIQUERY
** );
607 extern UINT
MSI_OpenQuery( MSIDATABASE
*, MSIQUERY
**, LPCWSTR
, ... );
608 typedef UINT (*record_func
)( MSIRECORD
*, LPVOID
);
609 extern UINT
MSI_IterateRecords( MSIQUERY
*, DWORD
*, record_func
, LPVOID
);
610 extern MSIRECORD
*MSI_QueryGetRecord( MSIDATABASE
*db
, LPCWSTR query
, ... );
611 extern UINT
MSI_DatabaseImport( MSIDATABASE
*, LPCWSTR
, LPCWSTR
);
612 extern UINT
MSI_DatabaseExport( MSIDATABASE
*, LPCWSTR
, LPCWSTR
, LPCWSTR
);
613 extern UINT
MSI_DatabaseGetPrimaryKeys( MSIDATABASE
*, LPCWSTR
, MSIRECORD
** );
616 extern UINT
MSI_ViewExecute( MSIQUERY
*, MSIRECORD
* );
617 extern UINT
MSI_ViewFetch( MSIQUERY
*, MSIRECORD
** );
618 extern UINT
MSI_ViewClose( MSIQUERY
* );
619 extern UINT
MSI_ViewGetColumnInfo(MSIQUERY
*, MSICOLINFO
, MSIRECORD
**);
620 extern UINT
VIEW_find_column( MSIVIEW
*, LPCWSTR
, UINT
* );
623 /* install internals */
624 extern UINT
MSI_SetInstallLevel( MSIPACKAGE
*package
, int iInstallLevel
);
626 /* package internals */
627 extern MSIPACKAGE
*MSI_CreatePackage( MSIDATABASE
*, LPWSTR
);
628 extern UINT
MSI_OpenPackageW( LPCWSTR szPackage
, MSIPACKAGE
** );
629 extern UINT
MSI_SetTargetPathW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
630 extern UINT
MSI_SetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
);
631 extern INT
MSI_ProcessMessage( MSIPACKAGE
*, INSTALLMESSAGE
, MSIRECORD
* );
632 extern UINT
MSI_GetPropertyW( MSIPACKAGE
*, LPCWSTR
, LPWSTR
, DWORD
* );
633 extern UINT
MSI_GetPropertyA(MSIPACKAGE
*, LPCSTR
, LPSTR
, DWORD
* );
634 extern MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*, LPCWSTR
);
635 extern UINT
MSI_GetComponentStateW( MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
*, INSTALLSTATE
* );
636 extern UINT
MSI_GetFeatureStateW( MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
*, INSTALLSTATE
* );
637 extern UINT WINAPI
MSI_SetFeatureStateW(MSIPACKAGE
*, LPCWSTR
, INSTALLSTATE
);
638 extern LPCWSTR
msi_download_file( LPCWSTR szUrl
, LPWSTR filename
);
640 /* for deformating */
641 extern UINT
MSI_FormatRecordW( MSIPACKAGE
*, MSIRECORD
*, LPWSTR
, DWORD
* );
642 extern UINT
MSI_FormatRecordA( MSIPACKAGE
*, MSIRECORD
*, LPSTR
, DWORD
* );
644 /* registry data encoding/decoding functions */
645 extern BOOL
unsquash_guid(LPCWSTR in
, LPWSTR out
);
646 extern BOOL
squash_guid(LPCWSTR in
, LPWSTR out
);
647 extern BOOL
encode_base85_guid(GUID
*,LPWSTR
);
648 extern BOOL
decode_base85_guid(LPCWSTR
,GUID
*);
649 extern UINT
MSIREG_OpenUninstallKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
650 extern UINT
MSIREG_OpenUserProductsKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
651 extern UINT
MSIREG_OpenFeatures(HKEY
* key
);
652 extern UINT
MSIREG_OpenFeaturesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
653 extern UINT
MSIREG_OpenComponents(HKEY
* key
);
654 extern UINT
MSIREG_OpenUserComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
655 extern UINT
MSIREG_OpenComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
656 extern UINT
MSIREG_OpenProductsKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
657 extern UINT
MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
658 extern UINT
MSIREG_OpenUserComponentsKey(LPCWSTR szComponent
, HKEY
* key
, BOOL create
);
659 extern UINT
MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
660 extern UINT
MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct
, HKEY
* key
, BOOL create
);
662 extern LPWSTR
msi_reg_get_val_str( HKEY hkey
, LPCWSTR name
);
663 extern BOOL
msi_reg_get_val_dword( HKEY hkey
, LPCWSTR name
, DWORD
*val
);
665 extern DWORD
msi_version_str_to_dword(LPCWSTR p
);
666 extern LPWSTR
msi_version_dword_to_str(DWORD version
);
668 extern LONG
msi_reg_set_val_str( HKEY hkey
, LPCWSTR name
, LPCWSTR value
);
669 extern LONG
msi_reg_set_val_multi_str( HKEY hkey
, LPCWSTR name
, LPCWSTR value
);
670 extern LONG
msi_reg_set_val_dword( HKEY hkey
, LPCWSTR name
, DWORD val
);
671 extern LONG
msi_reg_set_subkey_val( HKEY hkey
, LPCWSTR path
, LPCWSTR name
, LPCWSTR val
);
673 /* msi dialog interface */
674 typedef UINT (*msi_dialog_event_handler
)( MSIPACKAGE
*, LPCWSTR
, LPCWSTR
, msi_dialog
* );
675 extern msi_dialog
*msi_dialog_create( MSIPACKAGE
*, LPCWSTR
, msi_dialog
*, msi_dialog_event_handler
);
676 extern UINT
msi_dialog_run_message_loop( msi_dialog
* );
677 extern void msi_dialog_end_dialog( msi_dialog
* );
678 extern void msi_dialog_check_messages( HANDLE
);
679 extern void msi_dialog_do_preview( msi_dialog
* );
680 extern void msi_dialog_destroy( msi_dialog
* );
681 extern BOOL
msi_dialog_register_class( void );
682 extern void msi_dialog_unregister_class( void );
683 extern void msi_dialog_handle_event( msi_dialog
*, LPCWSTR
, LPCWSTR
, MSIRECORD
* );
684 extern UINT
msi_dialog_reset( msi_dialog
*dialog
);
685 extern UINT
msi_dialog_directorylist_up( msi_dialog
*dialog
);
686 extern msi_dialog
*msi_dialog_get_parent( msi_dialog
*dialog
);
687 extern LPWSTR
msi_dialog_get_name( msi_dialog
*dialog
);
688 extern UINT
msi_spawn_error_dialog( MSIPACKAGE
*, LPWSTR
, LPWSTR
);
691 extern MSIPREVIEW
*MSI_EnableUIPreview( MSIDATABASE
* );
692 extern UINT
MSI_PreviewDialogW( MSIPREVIEW
*, LPCWSTR
);
694 /* summary information */
695 extern MSISUMMARYINFO
*MSI_GetSummaryInformationW( IStorage
*stg
, UINT uiUpdateCount
);
696 extern LPWSTR
msi_suminfo_dup_string( MSISUMMARYINFO
*si
, UINT uiProperty
);
697 extern LPWSTR
msi_get_suminfo_product( IStorage
*stg
);
699 /* undocumented functions */
700 UINT WINAPI
MsiCreateAndVerifyInstallerDirectory( DWORD
);
701 UINT WINAPI
MsiDecomposeDescriptorW( LPCWSTR
, LPWSTR
, LPWSTR
, LPWSTR
, DWORD
* );
702 UINT WINAPI
MsiDecomposeDescriptorA( LPCSTR
, LPSTR
, LPSTR
, LPSTR
, DWORD
* );
703 LANGID WINAPI
MsiLoadStringW( MSIHANDLE
, UINT
, LPWSTR
, int, LANGID
);
704 LANGID WINAPI
MsiLoadStringA( MSIHANDLE
, UINT
, LPSTR
, int, LANGID
);
707 extern INSTALLUILEVEL gUILevel
;
709 extern INSTALLUI_HANDLERA gUIHandlerA
;
710 extern INSTALLUI_HANDLERW gUIHandlerW
;
711 extern DWORD gUIFilter
;
712 extern LPVOID gUIContext
;
713 extern WCHAR gszLogFile
[MAX_PATH
];
714 extern HINSTANCE msi_hInstance
;
716 /* action related functions */
717 extern UINT
ACTION_PerformAction(MSIPACKAGE
*package
, const WCHAR
*action
, BOOL force
);
718 extern UINT
ACTION_PerformUIAction(MSIPACKAGE
*package
, const WCHAR
*action
);
719 extern void ACTION_FinishCustomActions( MSIPACKAGE
* package
);
720 extern UINT
ACTION_CustomAction(MSIPACKAGE
*package
,const WCHAR
*action
, BOOL execute
);
722 static inline void msi_feature_set_state( MSIFEATURE
*feature
, INSTALLSTATE state
)
724 feature
->ActionRequest
= state
;
725 feature
->Action
= state
;
728 static inline void msi_component_set_state( MSICOMPONENT
*comp
, INSTALLSTATE state
)
730 comp
->ActionRequest
= state
;
731 comp
->Action
= state
;
734 /* actions in other modules */
735 extern UINT
ACTION_AppSearch(MSIPACKAGE
*package
);
736 extern UINT
ACTION_FindRelatedProducts(MSIPACKAGE
*package
);
737 extern UINT
ACTION_InstallFiles(MSIPACKAGE
*package
);
738 extern UINT
ACTION_RemoveFiles(MSIPACKAGE
*package
);
739 extern UINT
ACTION_DuplicateFiles(MSIPACKAGE
*package
);
740 extern UINT
ACTION_RegisterClassInfo(MSIPACKAGE
*package
);
741 extern UINT
ACTION_RegisterProgIdInfo(MSIPACKAGE
*package
);
742 extern UINT
ACTION_RegisterExtensionInfo(MSIPACKAGE
*package
);
743 extern UINT
ACTION_RegisterMIMEInfo(MSIPACKAGE
*package
);
744 extern UINT
ACTION_RegisterFonts(MSIPACKAGE
*package
);
747 extern DWORD
deformat_string(MSIPACKAGE
*package
, LPCWSTR ptr
, WCHAR
** data
);
748 extern LPWSTR
msi_dup_record_field(MSIRECORD
*row
, INT index
);
749 extern LPWSTR
msi_dup_property(MSIPACKAGE
*package
, LPCWSTR prop
);
750 extern int msi_get_property_int( MSIPACKAGE
*package
, LPCWSTR prop
, int def
);
751 extern LPWSTR
resolve_folder(MSIPACKAGE
*package
, LPCWSTR name
, BOOL source
,
752 BOOL set_prop
, MSIFOLDER
**folder
);
753 extern MSICOMPONENT
*get_loaded_component( MSIPACKAGE
* package
, LPCWSTR Component
);
754 extern MSIFEATURE
*get_loaded_feature( MSIPACKAGE
* package
, LPCWSTR Feature
);
755 extern MSIFILE
*get_loaded_file( MSIPACKAGE
* package
, LPCWSTR file
);
756 extern MSIFOLDER
*get_loaded_folder( MSIPACKAGE
*package
, LPCWSTR dir
);
757 extern int track_tempfile(MSIPACKAGE
*package
, LPCWSTR path
);
758 extern UINT
schedule_action(MSIPACKAGE
*package
, UINT script
, LPCWSTR action
);
759 extern void msi_free_action_script(MSIPACKAGE
*package
, UINT script
);
760 extern LPWSTR
build_icon_path(MSIPACKAGE
*, LPCWSTR
);
761 extern LPWSTR
build_directory_name(DWORD
, ...);
762 extern BOOL
create_full_pathW(const WCHAR
*path
);
763 extern BOOL
ACTION_VerifyComponentForAction(MSICOMPONENT
*, INSTALLSTATE
);
764 extern BOOL
ACTION_VerifyFeatureForAction(MSIFEATURE
*, INSTALLSTATE
);
765 extern void reduce_to_longfilename(WCHAR
*);
766 extern void reduce_to_shortfilename(WCHAR
*);
767 extern LPWSTR
create_component_advertise_string(MSIPACKAGE
*, MSICOMPONENT
*, LPCWSTR
);
768 extern void ACTION_UpdateComponentStates(MSIPACKAGE
*package
, LPCWSTR szFeature
);
769 extern UINT
register_unique_action(MSIPACKAGE
*, LPCWSTR
);
770 extern BOOL
check_unique_action(MSIPACKAGE
*, LPCWSTR
);
771 extern WCHAR
* generate_error_string(MSIPACKAGE
*, UINT
, DWORD
, ... );
772 extern UINT
msi_create_component_directories( MSIPACKAGE
*package
);
773 extern void msi_ui_error( DWORD msg_id
, DWORD type
);
775 /* control event stuff */
776 extern VOID
ControlEvent_FireSubscribedEvent(MSIPACKAGE
*package
, LPCWSTR event
,
778 extern VOID
ControlEvent_CleanupSubscriptions(MSIPACKAGE
*package
);
779 extern VOID
ControlEvent_SubscribeToEvent(MSIPACKAGE
*package
, msi_dialog
*dialog
,
780 LPCWSTR event
, LPCWSTR control
, LPCWSTR attribute
);
781 extern VOID
ControlEvent_UnSubscribeToEvent( MSIPACKAGE
*package
, LPCWSTR event
,
782 LPCWSTR control
, LPCWSTR attribute
);
784 /* User Interface messages from the actions */
785 extern void ui_progress(MSIPACKAGE
*, int, int, int, int);
786 extern void ui_actiondata(MSIPACKAGE
*, LPCWSTR
, MSIRECORD
*);
788 /* string consts use a number of places and defined in helpers.c*/
789 extern const WCHAR cszSourceDir
[];
790 extern const WCHAR cszSOURCEDIR
[];
791 extern const WCHAR szProductCode
[];
792 extern const WCHAR cszRootDrive
[];
793 extern const WCHAR cszbs
[];
795 /* memory allocation macro functions */
796 static inline void *msi_alloc( size_t len
)
798 return HeapAlloc( GetProcessHeap(), 0, len
);
801 static inline void *msi_alloc_zero( size_t len
)
803 return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
806 static inline void *msi_realloc( void *mem
, size_t len
)
808 return HeapReAlloc( GetProcessHeap(), 0, mem
, len
);
811 static inline void *msi_realloc_zero( void *mem
, size_t len
)
813 return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
816 static inline BOOL
msi_free( void *mem
)
818 return HeapFree( GetProcessHeap(), 0, mem
);
821 inline static char *strdupWtoA( LPCWSTR str
)
826 if (!str
) return ret
;
827 len
= WideCharToMultiByte( CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
828 ret
= msi_alloc( len
);
830 WideCharToMultiByte( CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
834 inline static LPWSTR
strdupAtoW( LPCSTR str
)
839 if (!str
) return ret
;
840 len
= MultiByteToWideChar( CP_ACP
, 0, str
, -1, NULL
, 0 );
841 ret
= msi_alloc( len
* sizeof(WCHAR
) );
843 MultiByteToWideChar( CP_ACP
, 0, str
, -1, ret
, len
);
847 inline static LPWSTR
strdupW( LPCWSTR src
)
850 if (!src
) return NULL
;
851 dest
= msi_alloc( (lstrlenW(src
)+1)*sizeof(WCHAR
) );
857 #endif /* __WINE_MSI_PRIVATE__ */