Commit 0b2bd0c9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Count progress in units of 512 bytes.

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