- Make usetup ""work"" on systems with ~28MB+ RAM. Due to an unknown bug (in usetup or Mm, file copies during setup don't get flushed until memory reaches about 42-47% remaining. At this point, if enough memory is available, no more memory will be allocated, even though more files are being copied. On systems with < 48MB, the system will not usually flush pages fast enough to keep the memory at ~42-47%. We ""fix"" this by adding a delay to each file copy as long as free memory is below 40%.

- Also added 3 progress bars during memory transfers to show the status of the memory.

svn path=/trunk/; revision=25929
This commit is contained in:
Alex Ionescu 2007-02-28 20:43:13 +00:00
parent a1ad43c2ee
commit 045e38927e
6 changed files with 133 additions and 30 deletions

View file

@ -64,6 +64,9 @@ ChkdskPartition(
yScreen - 14,
xScreen - 7,
yScreen - 10,
10,
24,
TRUE,
"Setup is checking your disk");
ProgressSetStepCount(ChkdskProgressBar, 100);

View file

@ -65,6 +65,7 @@ typedef struct _COPYCONTEXT
ULONG TotalOperations;
ULONG CompletedOperations;
PPROGRESSBAR ProgressBar;
PPROGRESSBAR MemoryBars[4];
} COPYCONTEXT, *PCOPYCONTEXT;
/* FUNCTIONS ****************************************************************/

View file

@ -96,6 +96,9 @@ FormatPartition(
yScreen - 14,
xScreen - 7,
yScreen - 10,
10,
24,
TRUE,
"Setup is formatting your disk");
ProgressSetStepCount(FormatProgressBar, 100);

View file

@ -2885,6 +2885,42 @@ PrepareCopyPage(PINPUT_RECORD Ir)
return FILE_COPY_PAGE;
}
VOID
NTAPI
SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext,
IN BOOLEAN First)
{
SYSTEM_PERFORMANCE_INFORMATION PerfInfo;
/* Get the memory information from the system */
NtQuerySystemInformation(SystemPerformanceInformation,
&PerfInfo,
sizeof(PerfInfo),
NULL);
/* Check if this is initial setup */
if (First)
{
/* Set maximum limits to be total RAM pages */
ProgressSetStepCount(CopyContext->MemoryBars[0], PerfInfo.CommitLimit);
ProgressSetStepCount(CopyContext->MemoryBars[1], PerfInfo.CommitLimit);
ProgressSetStepCount(CopyContext->MemoryBars[2], PerfInfo.CommitLimit);
}
/* Set current values */
ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages);
ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.NonPagedPoolPages);
ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages);
/* Check if memory dropped below 40%! */
if (CopyContext->MemoryBars[2]->Percent <= 40)
{
/* Wait a while until Mm does its thing */
LARGE_INTEGER Interval;
Interval.QuadPart = -1 * 15 * 1000 * 100;
NtDelayExecution(FALSE, &Interval);
}
}
static UINT CALLBACK
FileCopyCallback(PVOID Context,
@ -2902,57 +2938,102 @@ FileCopyCallback(PVOID Context,
CopyContext->TotalOperations = (ULONG)Param2;
ProgressSetStepCount(CopyContext->ProgressBar,
CopyContext->TotalOperations);
SetupUpdateMemoryInfo(CopyContext, TRUE);
break;
case SPFILENOTIFY_STARTCOPY:
/* Display copy message */
CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR)Param1);
SetupUpdateMemoryInfo(CopyContext, FALSE);
break;
case SPFILENOTIFY_ENDCOPY:
CopyContext->CompletedOperations++;
ProgressNextStep(CopyContext->ProgressBar);
SetupUpdateMemoryInfo(CopyContext, FALSE);
break;
}
return 0;
}
static PAGE_NUMBER
static
PAGE_NUMBER
FileCopyPage(PINPUT_RECORD Ir)
{
COPYCONTEXT CopyContext;
COPYCONTEXT CopyContext;
CONSOLE_SetStatusText(" \xB3 Please wait... ");
/* Display status text */
CONSOLE_SetStatusText(" \xB3 Please wait... ");
CONSOLE_SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
CONSOLE_SetTextXY(30, 13, "installation folder.");
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
/* Displey information text */
CONSOLE_SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
CONSOLE_SetTextXY(30, 13, "installation folder.");
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
CopyContext.InstallPath = InstallPath.Buffer;
CopyContext.TotalOperations = 0;
CopyContext.CompletedOperations = 0;
CopyContext.ProgressBar = CreateProgressBar(13,
26,
xScreen - 13,
yScreen - 20,
"Setup is copying files...");
/* Create context for the copy process */
CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
CopyContext.InstallPath = InstallPath.Buffer;
CopyContext.TotalOperations = 0;
CopyContext.CompletedOperations = 0;
SetupCommitFileQueueW(NULL,
SetupFileQueue,
FileCopyCallback,
&CopyContext);
/* Create the progress bar as well */
CopyContext.ProgressBar = CreateProgressBar(13,
26,
xScreen - 13,
yScreen - 20,
10,
24,
TRUE,
"Setup is copying files...");
SetupCloseFileQueue(SetupFileQueue);
/* Create the paged pool progress bar */
CopyContext.MemoryBars[0] = CreateProgressBar(13,
40,
18,
43,
10,
44,
FALSE,
"Paged Memory");
DestroyProgressBar(CopyContext.ProgressBar);
/* Create the non paged pool progress bar */
CopyContext.MemoryBars[1] = CreateProgressBar(28,
40,
33,
43,
24,
44,
FALSE,
"Nonpaged Memory");
return REGISTRY_PAGE;
/* Create the global memory progress bar */
CopyContext.MemoryBars[2] = CreateProgressBar(43,
40,
48,
43,
40,
44,
FALSE,
"Free Memory");
/* Do the file copying */
SetupCommitFileQueueW(NULL,
SetupFileQueue,
FileCopyCallback,
&CopyContext);
/* If we get here, we're done, so cleanup the queue and progress bar */
SetupCloseFileQueue(SetupFileQueue);
DestroyProgressBar(CopyContext.ProgressBar);
DestroyProgressBar(CopyContext.MemoryBars[0]);
DestroyProgressBar(CopyContext.MemoryBars[1]);
DestroyProgressBar(CopyContext.MemoryBars[2]);
/* Go display the next page */
return REGISTRY_PAGE;
}
static PAGE_NUMBER
RegistryPage(PINPUT_RECORD Ir)
{

View file

@ -194,14 +194,17 @@ DrawProgressBar(PPROGRESSBAR Bar)
DrawBorder(Bar);
/* Write Text Associated with Bar */
CONSOLE_SetTextXY(10, 24, Bar->Text);
CONSOLE_SetTextXY(Bar->TextTop, Bar->TextRight, Bar->Text);
/* Draw the progress bar "border" border */
BarBorder.Top -= 5;
BarBorder.Bottom += 2;
BarBorder.Right += 5;
BarBorder.Left -= 5;
DrawThickBorder(&BarBorder);
if (Bar->Double)
{
BarBorder.Top -= 5;
BarBorder.Bottom += 2;
BarBorder.Right += 5;
BarBorder.Left -= 5;
DrawThickBorder(&BarBorder);
}
/* Draw the bar */
coPos.X = Bar->Left + 1;
@ -229,6 +232,9 @@ CreateProgressBar(SHORT Left,
SHORT Top,
SHORT Right,
SHORT Bottom,
SHORT TextTop,
SHORT TextRight,
IN BOOLEAN DoubleEdge,
char* Text)
{
PPROGRESSBAR Bar;
@ -243,6 +249,9 @@ CreateProgressBar(SHORT Left,
Bar->Top = Top;
Bar->Right = Right;
Bar->Bottom = Bottom;
Bar->TextTop = TextTop;
Bar->TextRight = TextRight;
Bar->Double = DoubleEdge;
Bar->Text = Text;
Bar->Width = Bar->Right - Bar->Left + 1;

View file

@ -34,6 +34,8 @@ typedef struct _PROGRESS
SHORT Top;
SHORT Right;
SHORT Bottom;
SHORT TextTop;
SHORT TextRight;
SHORT Width;
@ -43,6 +45,7 @@ typedef struct _PROGRESS
ULONG StepCount;
ULONG CurrentStep;
BOOLEAN Double;
CHAR *Text;
} PROGRESSBAR, *PPROGRESSBAR;
@ -53,6 +56,9 @@ CreateProgressBar(SHORT Left,
SHORT Top,
SHORT Right,
SHORT Bottom,
SHORT TextTop,
SHORT TextRight,
BOOLEAN DoubleEdge,
char* Text);
VOID