Hans Leidekker : msi: Count progress in units of 512 bytes.

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


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

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

msi: Count progress in units of 512 bytes.

---

 dlls/msi/dialog.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index a6e33e2..2eb7983 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -637,7 +637,7 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
     }
     else if( !strcmpW( attribute, szProgress ) )
     {
-        DWORD func, val1, val2;
+        DWORD func, val1, val2, units;
 
         func = MSI_RecordGetInteger( rec, 1 );
         val1 = MSI_RecordGetInteger( rec, 2 );
@@ -649,16 +649,17 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
         {
         case 0: /* init */
             SendMessageW( ctrl->hwnd, PBM_SETRANGE, 0, MAKELPARAM(0,100) );
+            units = val1 / 512;
             if (val2)
             {
-                ctrl->progress_max = val1 ? val1 : 100;
-                ctrl->progress_current = val1;
+                ctrl->progress_max = units ? units : 100;
+                ctrl->progress_current = units;
                 ctrl->progress_backwards = TRUE;
                 SendMessageW( ctrl->hwnd, PBM_SETPOS, 100, 0 );
             }
             else
             {
-                ctrl->progress_max = val1 ? val1 : 100;
+                ctrl->progress_max = units ? units : 100;
                 ctrl->progress_current = 0;
                 ctrl->progress_backwards = FALSE;
                 SendMessageW( ctrl->hwnd, PBM_SETPOS, 0, 0 );
@@ -667,14 +668,15 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
         case 1: /* FIXME: not sure what this is supposed to do */
             break;
         case 2: /* move */
+            units = val1 / 512;
             if (ctrl->progress_backwards)
             {
-                if (val1 >= ctrl->progress_current) ctrl->progress_current -= val1;
+                if (units >= ctrl->progress_current) ctrl->progress_current -= units;
                 else ctrl->progress_current = 0;
             }
             else
             {
-                if (ctrl->progress_current + val1 < ctrl->progress_max) ctrl->progress_current += val1;
+                if (ctrl->progress_current + units < ctrl->progress_max) ctrl->progress_current += units;
                 else ctrl->progress_current = ctrl->progress_max;
             }
             SendMessageW( ctrl->hwnd, PBM_SETPOS, MulDiv(100, ctrl->progress_current, ctrl->progress_max), 0 );




More information about the wine-cvs mailing list