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 ...@@ -182,6 +182,9 @@ struct tagMSIVIEW
MSIVIEWOPS *ops; MSIVIEWOPS *ops;
}; };
struct msi_dialog_tag;
typedef struct msi_dialog_tag msi_dialog;
typedef struct tagMSIPACKAGE typedef struct tagMSIPACKAGE
{ {
MSIOBJECTHDR hdr; MSIOBJECTHDR hdr;
...@@ -209,16 +212,15 @@ typedef struct tagMSIPACKAGE ...@@ -209,16 +212,15 @@ typedef struct tagMSIPACKAGE
LPWSTR PackagePath; LPWSTR PackagePath;
UINT CurrentInstallState; UINT CurrentInstallState;
msi_dialog *dialog;
LPWSTR next_dialog;
} MSIPACKAGE; } MSIPACKAGE;
struct tag_dialog_info;
typedef struct tag_dialog_info dialog_info;
typedef struct tagMSIPREVIEW typedef struct tagMSIPREVIEW
{ {
MSIOBJECTHDR hdr; MSIOBJECTHDR hdr;
MSIPACKAGE *package; MSIPACKAGE *package;
dialog_info *dialog; msi_dialog *dialog;
} MSIPREVIEW; } MSIPREVIEW;
#define MSIHANDLETYPE_ANY 0 #define MSIHANDLETYPE_ANY 0
...@@ -299,6 +301,7 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname, ...@@ -299,6 +301,7 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
/* action internals */ /* action internals */
extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR ); extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern void ACTION_free_package_structures( MSIPACKAGE* ); extern void ACTION_free_package_structures( MSIPACKAGE* );
extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR);
/* record internals */ /* record internals */
extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *); extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);
...@@ -322,6 +325,8 @@ extern void enum_stream_names( IStorage *stg ); ...@@ -322,6 +325,8 @@ extern void enum_stream_names( IStorage *stg );
extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** ); extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** );
extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** ); extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ); 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 */ /* view internals */
extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * ); extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * );
...@@ -359,9 +364,13 @@ extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create); ...@@ -359,9 +364,13 @@ extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
/* msi dialog interface */ /* msi dialog interface */
typedef VOID (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, HWND ); typedef VOID (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
extern dialog_info *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler ); extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );
extern void msi_dialog_destroy( dialog_info* ); 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_register_class( void );
extern void msi_dialog_unregister_class( void ); extern void msi_dialog_unregister_class( void );
......
...@@ -182,6 +182,40 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) ...@@ -182,6 +182,40 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
return rc; 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, UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
LPCWSTR szQuery, MSIHANDLE *phView) LPCWSTR szQuery, MSIHANDLE *phView)
{ {
......
...@@ -53,6 +53,8 @@ void MSI_FreePackage( MSIOBJECTHDR *arg) ...@@ -53,6 +53,8 @@ void MSI_FreePackage( MSIOBJECTHDR *arg)
{ {
MSIPACKAGE *package= (MSIPACKAGE*) arg; MSIPACKAGE *package= (MSIPACKAGE*) arg;
if( package->dialog )
msi_dialog_destroy( package->dialog );
ACTION_free_package_structures(package); ACTION_free_package_structures(package);
msiobj_release( &package->db->hdr ); msiobj_release( &package->db->hdr );
...@@ -378,6 +380,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) ...@@ -378,6 +380,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
package->loaded_files = 0; package->loaded_files = 0;
package->ActionFormat = NULL; package->ActionFormat = NULL;
package->LastAction = 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 /* OK, here is where we do a slew of things to the database to
* prep for all that is to come as a package */ * prep for all that is to come as a package */
......
...@@ -82,7 +82,7 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview ) ...@@ -82,7 +82,7 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview )
} }
static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event, 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", MESSAGE("Preview dialog event '%s' (arg='%s')\n",
debugstr_w( event ), debugstr_w( argument )); debugstr_w( event ), debugstr_w( argument ));
...@@ -90,7 +90,7 @@ static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event, ...@@ -90,7 +90,7 @@ static VOID preview_event_handler( MSIPACKAGE *package, LPCWSTR event,
UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName ) UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
{ {
dialog_info *dialog = NULL; msi_dialog *dialog = NULL;
UINT r = ERROR_SUCCESS; UINT r = ERROR_SUCCESS;
if( preview->dialog ) if( preview->dialog )
...@@ -101,7 +101,9 @@ UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName ) ...@@ -101,7 +101,9 @@ UINT MSI_PreviewDialogW( MSIPREVIEW *preview, LPCWSTR szDialogName )
{ {
dialog = msi_dialog_create( preview->package, szDialogName, dialog = msi_dialog_create( preview->package, szDialogName,
preview_event_handler ); preview_event_handler );
if( !dialog ) if( dialog )
msi_dialog_do_preview( dialog );
else
r = ERROR_FUNCTION_FAILED; r = ERROR_FUNCTION_FAILED;
} }
preview->dialog = dialog; 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