Commit fd91013b authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Add more dialog controls, do something when they're clicked on.

parent ac643d31
......@@ -182,6 +182,9 @@ struct tagMSIVIEW
MSIVIEWOPS *ops;
};
struct msi_dialog_tag;
typedef struct msi_dialog_tag msi_dialog;
typedef struct tagMSIPACKAGE
{
MSIOBJECTHDR hdr;
......@@ -209,16 +212,15 @@ typedef struct tagMSIPACKAGE
LPWSTR PackagePath;
UINT CurrentInstallState;
msi_dialog *dialog;
LPWSTR next_dialog;
} MSIPACKAGE;
struct tag_dialog_info;
typedef struct tag_dialog_info dialog_info;
typedef struct tagMSIPREVIEW
{
MSIOBJECTHDR hdr;
MSIPACKAGE *package;
dialog_info *dialog;
msi_dialog *dialog;
} MSIPREVIEW;
#define MSIHANDLETYPE_ANY 0
......@@ -299,6 +301,7 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
/* action internals */
extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern void ACTION_free_package_structures( MSIPACKAGE* );
extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR);
/* record internals */
extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);
......@@ -322,6 +325,8 @@ extern void enum_stream_names( IStorage *stg );
extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** );
extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... );
typedef UINT (*record_func)( MSIRECORD *rec, LPVOID param );
extern UINT MSI_IterateRecords( MSIQUERY *, DWORD *, record_func, LPVOID );
/* view internals */
extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * );
......@@ -359,9 +364,13 @@ extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
/* msi dialog interface */
typedef VOID (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, HWND );
extern dialog_info *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );
extern void msi_dialog_destroy( dialog_info* );
typedef VOID (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );
extern UINT msi_dialog_run_message_loop( msi_dialog* );
extern void msi_dialog_end_dialog( msi_dialog* );
extern void msi_dialog_check_messages( msi_dialog* );
extern void msi_dialog_do_preview( msi_dialog* );
extern void msi_dialog_destroy( msi_dialog* );
extern void msi_dialog_register_class( void );
extern void msi_dialog_unregister_class( void );
......
......@@ -182,6 +182,40 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
return rc;
}
UINT MSI_IterateRecords( MSIQUERY *view, DWORD *count,
record_func func, LPVOID param )
{
MSIRECORD *rec = NULL;
UINT r, n = 0, max = 0;
r = MSI_ViewExecute( view, NULL );
if( r != ERROR_SUCCESS )
return r;
if( count )
max = *count;
/* iterate a query */
for( n = 0; (max == 0) || (n < max); n++ )
{
r = MSI_ViewFetch( view, &rec );
if( r != ERROR_SUCCESS )
break;
r = func( rec, param );
msiobj_release( &rec->hdr );
if( r != ERROR_SUCCESS )
break;
n++;
}
MSI_ViewClose( view );
if( count )
*count = n;
return r;
}
UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
LPCWSTR szQuery, MSIHANDLE *phView)
{
......
......@@ -53,6 +53,8 @@ void MSI_FreePackage( MSIOBJECTHDR *arg)
{
MSIPACKAGE *package= (MSIPACKAGE*) arg;
if( package->dialog )
msi_dialog_destroy( package->dialog );
ACTION_free_package_structures(package);
msiobj_release( &package->db->hdr );
......@@ -378,6 +380,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
package->loaded_files = 0;
package->ActionFormat = NULL;
package->LastAction = NULL;
package->dialog = NULL;
package->next_dialog = NULL;
/* OK, here is where we do a slew of things to the database to
* prep for all that is to come as a package */
......
......@@ -82,7 +82,7 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview )
}
static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
LPCWSTR argument, HWND dialog )
LPCWSTR argument, msi_dialog *dialog )
{
MESSAGE("Preview dialog event '%s' (arg='%s')\n",
debugstr_w( event ), debugstr_w( argument ));
......@@ -90,7 +90,7 @@ static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
{
dialog_info *dialog = NULL;
msi_dialog *dialog = NULL;
UINT r = ERROR_SUCCESS;
if( preview->dialog )
......@@ -101,7 +101,9 @@ UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
{
dialog = msi_dialog_create( preview->package, szDialogName,
preview_event_handler );
if( !dialog )
if( dialog )
msi_dialog_do_preview( dialog );
else
r = ERROR_FUNCTION_FAILED;
}
preview->dialog = dialog;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment