Hans Leidekker : msi: Make sure reported progress adds up to projected progress.

Alexandre Julliard julliard at winehq.org
Thu Jun 23 04:10:10 CDT 2011


Module: wine
Branch: master
Commit: ac994860afe2e695254e1a9531f6678c81551667
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ac994860afe2e695254e1a9531f6678c81551667

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Jun 23 09:08:21 2011 +0200

msi: Make sure reported progress adds up to projected progress.

---

 dlls/msi/action.c |   26 ++++++--------------------
 dlls/msi/files.c  |   18 ++++--------------
 2 files changed, 10 insertions(+), 34 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 437c8d9..260fbd6 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -2565,7 +2565,7 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
     BOOL check_first = FALSE;
     UINT rc;
 
-    msi_ui_progress( package, 2, 0, 0, 0 );
+    msi_ui_progress( package, 2, REG_PROGRESS_VALUE, 0, 0 );
 
     component = MSI_RecordGetString(row, 6);
     comp = msi_get_loaded_component(package,component);
@@ -2679,9 +2679,6 @@ static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
     if (rc != ERROR_SUCCESS)
         return ERROR_SUCCESS;
 
-    /* increment progress bar each time action data is sent */
-    msi_ui_progress( package, 1, REG_PROGRESS_VALUE, 1, 0 );
-
     rc = MSI_IterateRecords(view, NULL, ITERATE_WriteRegistryValues, package);
     msiobj_release(&view->hdr);
     return rc;
@@ -2734,7 +2731,7 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para
     UINT size;
     INT root;
 
-    msi_ui_progress( package, 2, 0, 0, 0 );
+    msi_ui_progress( package, 2, REG_PROGRESS_VALUE, 0, 0 );
 
     component = MSI_RecordGetString( row, 6 );
     comp = msi_get_loaded_component( package, component );
@@ -2783,7 +2780,6 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para
     uirow = MSI_CreateRecord( 2 );
     MSI_RecordSetStringW( uirow, 1, ui_key_str );
     MSI_RecordSetStringW( uirow, 2, deformated_name );
-
     msi_ui_actiondata( package, szRemoveRegistryValues, uirow );
     msiobj_release( &uirow->hdr );
 
@@ -2804,8 +2800,6 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param
     UINT size;
     INT root;
 
-    msi_ui_progress( package, 2, 0, 0, 0 );
-
     component = MSI_RecordGetString( row, 5 );
     comp = msi_get_loaded_component( package, component );
     if (!comp)
@@ -2850,7 +2844,6 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param
     uirow = MSI_CreateRecord( 2 );
     MSI_RecordSetStringW( uirow, 1, ui_key_str );
     MSI_RecordSetStringW( uirow, 2, deformated_name );
-
     msi_ui_actiondata( package, szRemoveRegistryValues, uirow );
     msiobj_release( &uirow->hdr );
 
@@ -2870,9 +2863,6 @@ static UINT ACTION_RemoveRegistryValues( MSIPACKAGE *package )
         {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
          '`','R','e','m','o','v','e','R','e','g','i','s','t','r','y','`',0 };
 
-    /* increment progress bar each time action data is sent */
-    msi_ui_progress( package, 1, REG_PROGRESS_VALUE, 1, 0 );
-
     rc = MSI_DatabaseOpenViewW( package->db, registry_query, &view );
     if (rc == ERROR_SUCCESS)
     {
@@ -2905,8 +2895,7 @@ static UINT ACTION_InstallInitialize(MSIPACKAGE *package)
 static UINT ACTION_InstallValidate(MSIPACKAGE *package)
 {
     MSICOMPONENT *comp;
-    DWORD progress = 0;
-    DWORD total = 0;
+    DWORD total = 0, count = 0;
     static const WCHAR q1[]=
         {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
          '`','R','e','g','i','s','t','r','y','`',0};
@@ -2920,11 +2909,10 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
     rc = MSI_DatabaseOpenViewW(package->db, q1, &view);
     if (rc == ERROR_SUCCESS)
     {
-        MSI_IterateRecords( view, &progress, NULL, package );
+        MSI_IterateRecords( view, &count, NULL, package );
         msiobj_release( &view->hdr );
-        total += progress * REG_PROGRESS_VALUE;
+        total += count * REG_PROGRESS_VALUE;
     }
-
     LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
         total += COMPONENT_PROGRESS_VALUE;
 
@@ -3200,8 +3188,6 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
     TRACE("\n");
 
     squash_guid(package->ProductCode,squished_pc);
-    msi_ui_progress( package, 1, COMPONENT_PROGRESS_VALUE, 1, 0 );
-
     msi_set_sourcedir_props(package, FALSE);
 
     LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
@@ -3209,7 +3195,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         MSIRECORD *uirow;
         INSTALLSTATE action;
 
-        msi_ui_progress( package, 2, 0, 0, 0 );
+        msi_ui_progress( package, 2, COMPONENT_PROGRESS_VALUE, 0, 0 );
         if (!comp->ComponentId)
             continue;
 
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 7ff84cf..d1bd615 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -261,11 +261,9 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
             TRACE("unknown file in cabinet (%s)\n", debugstr_w(file));
             return FALSE;
         }
-
         if (f->disk_id != disk_id || (f->state != msifs_missing && f->state != msifs_overwrite))
             return FALSE;
 
-        msi_file_update_ui(package, f, szInstallFiles);
         if (!f->Component->assembly || f->Component->assembly->application)
         {
             msi_create_directory(package, f->Component->Directory);
@@ -317,14 +315,13 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
     UINT rc = ERROR_SUCCESS;
     MSIFILE *file;
 
-    /* increment progress bar each time action data is sent */
-    msi_ui_progress( package, 1, 1, 0, 0 );
-
     schedule_install_files(package);
     mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) );
 
     LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
     {
+        msi_file_update_ui( package, file, szInstallFiles );
+
         rc = msi_load_media_info( package, file->Sequence, mi );
         if (rc != ERROR_SUCCESS)
         {
@@ -368,7 +365,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
 
             TRACE("copying %s to %s\n", debugstr_w(source), debugstr_w(file->TargetPath));
 
-            msi_file_update_ui(package, file, szInstallFiles);
             if (!file->Component->assembly || file->Component->assembly->application)
             {
                 msi_create_directory(package, file->Component->Directory);
@@ -455,9 +451,6 @@ static BOOL patchfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
             TRACE("unknown file in cabinet (%s)\n", debugstr_w(file));
             return FALSE;
         }
-
-        msi_file_update_ui(package, p->File, szPatchFiles);
-
         GetTempFileNameW(temp_folder, NULL, 0, patch_path);
 
         *path = strdupW(patch_path);
@@ -499,9 +492,6 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package )
 
     TRACE("%p\n", package);
 
-    /* increment progress bar each time action data is sent */
-    msi_ui_progress( package, 1, 1, 0, 0 );
-
     mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) );
 
     LIST_FOR_EACH_ENTRY( patch, &package->filepatches, MSIFILEPATCH, entry )
@@ -1273,6 +1263,8 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
         VS_FIXEDFILEINFO *ver;
         MSICOMPONENT *comp = file->Component;
 
+        msi_file_update_ui( package, file, szRemoveFiles );
+
         comp->Action = msi_get_component_action( package, comp );
         if (comp->Action != INSTALLSTATE_ABSENT || comp->Installed == INSTALLSTATE_SOURCE)
             continue;
@@ -1324,8 +1316,6 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package )
         MSI_RecordSetStringW( uirow, 9, comp->Directory );
         msi_ui_actiondata( package, szRemoveFiles, uirow );
         msiobj_release( &uirow->hdr );
-        /* FIXME: call msi_ui_progress here? */
     }
-
     return ERROR_SUCCESS;
 }




More information about the wine-cvs mailing list