MSI: improve progress bar tracking

Mike McCormack mike at codeweavers.com
Tue Dec 28 00:56:36 CST 2004


ChangeLog:
<aric at codeweavers.com>
* improve progress bar tracking
-------------- next part --------------
--- dlls/msi/action.c.old	2004-12-28 15:54:34.000000000 +0900
+++ dlls/msi/action.c	2004-12-28 15:55:17.000000000 +0900
@@ -50,6 +50,8 @@
 #include "ver.h"
 
 #define CUSTOM_ACTION_TYPE_MASK 0x3F
+#define REG_PROGRESS_VALUE 13200
+#define COMPONENT_PROGRESS_VALUE 24000
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
@@ -1194,7 +1196,6 @@
     TRACE("Performing action (%s)\n",debugstr_w(action));
     ui_actioninfo(package, action, TRUE, 0);
     ui_actionstart(package, action);
-    ui_progress(package,2,1,0,0);
 
     /* pre install, setup and configuration block */
     if (strcmpW(action,szLaunchConditions)==0)
@@ -3129,7 +3130,7 @@
         return ERROR_INVALID_HANDLE;
 
     /* increment progress bar each time action data is sent */
-    ui_progress(package,1,1,1,0);
+    ui_progress(package,1,1,0,0);
 
     for (index = 0; index < package->loaded_files; index++)
     {
@@ -3144,6 +3145,7 @@
         if (package->components[file->ComponentIndex].ActionRequest != 
              INSTALLSTATE_LOCAL)
         {
+            ui_progress(package,2,file->FileSize,0,0);
             TRACE("File %s is not scheduled for install\n",
                    debugstr_w(file->File));
 
@@ -3184,6 +3186,7 @@
             MSI_RecordSetInteger(uirow,6,file->FileSize);
             ui_actiondata(package,szInstallFiles,uirow);
             msiobj_release( &uirow->hdr );
+            ui_progress(package,2,file->FileSize,0,0);
 
             if (!MoveFileW(file->SourcePath,file->TargetPath))
             {
@@ -3210,8 +3213,6 @@
             }
             else
                 file->State = 4;
-
-            ui_progress(package,2,0,0,0);
         }
     }
 
@@ -3487,7 +3488,7 @@
     }
 
     /* increment progress bar each time action data is sent */
-    ui_progress(package,1,1,1,0);
+    ui_progress(package,1,REG_PROGRESS_VALUE,1,0);
 
     while (1)
     {
@@ -3517,6 +3518,7 @@
             rc = ERROR_SUCCESS;
             break;
         }
+        ui_progress(package,2,0,0,0);
 
         value = NULL;
         key = NULL;
@@ -3603,7 +3605,6 @@
                 MSI_RecordSetStringW(uirow,3,value);
 
             ui_actiondata(package,szWriteRegistryValues,uirow);
-            ui_progress(package,2,0,0,0);
             msiobj_release( &uirow->hdr );
 
             HeapFree(GetProcessHeap(),0,value_data);
@@ -3729,12 +3730,14 @@
 static UINT ACTION_InstallValidate(MSIPACKAGE *package)
 {
     DWORD progress = 0;
+    DWORD total = 0;
     static const WCHAR q1[]={
         'S','E','L','E','C','T',' ','*',' ',
         'F','R','O','M',' ','R','e','g','i','s','t','r','y',0};
     UINT rc;
     MSIQUERY * view;
     MSIRECORD * row = 0;
+    int i;
 
     TRACE(" InstallValidate \n");
 
@@ -3764,7 +3767,11 @@
     MSI_ViewClose(view);
     msiobj_release(&view->hdr);
 
-    ui_progress(package,0,progress+package->loaded_files,0,0);
+    total = total + progress * REG_PROGRESS_VALUE;
+    total = total + package->loaded_components * COMPONENT_PROGRESS_VALUE;
+    for (i=0; i < package->loaded_files; i++)
+        total += package->files[i].FileSize;
+    ui_progress(package,0,total,0,0);
 
     return ERROR_SUCCESS;
 }
@@ -3939,9 +3946,11 @@
     rc = RegCreateKeyW(hkey,szComponents,&hkey2);
     if (rc != ERROR_SUCCESS)
         goto end;
-  
+      
+    ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0);
     for (i = 0; i < package->loaded_components; i++)
     {
+        ui_progress(package,2,0,0,0);
         if (package->components[i].ComponentId[0]!=0)
         {
             WCHAR *keypath = NULL;


More information about the wine-patches mailing list