mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
- 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:
parent
a1ad43c2ee
commit
045e38927e
|
@ -64,6 +64,9 @@ ChkdskPartition(
|
||||||
yScreen - 14,
|
yScreen - 14,
|
||||||
xScreen - 7,
|
xScreen - 7,
|
||||||
yScreen - 10,
|
yScreen - 10,
|
||||||
|
10,
|
||||||
|
24,
|
||||||
|
TRUE,
|
||||||
"Setup is checking your disk");
|
"Setup is checking your disk");
|
||||||
|
|
||||||
ProgressSetStepCount(ChkdskProgressBar, 100);
|
ProgressSetStepCount(ChkdskProgressBar, 100);
|
||||||
|
|
|
@ -65,6 +65,7 @@ typedef struct _COPYCONTEXT
|
||||||
ULONG TotalOperations;
|
ULONG TotalOperations;
|
||||||
ULONG CompletedOperations;
|
ULONG CompletedOperations;
|
||||||
PPROGRESSBAR ProgressBar;
|
PPROGRESSBAR ProgressBar;
|
||||||
|
PPROGRESSBAR MemoryBars[4];
|
||||||
} COPYCONTEXT, *PCOPYCONTEXT;
|
} COPYCONTEXT, *PCOPYCONTEXT;
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
|
@ -96,6 +96,9 @@ FormatPartition(
|
||||||
yScreen - 14,
|
yScreen - 14,
|
||||||
xScreen - 7,
|
xScreen - 7,
|
||||||
yScreen - 10,
|
yScreen - 10,
|
||||||
|
10,
|
||||||
|
24,
|
||||||
|
TRUE,
|
||||||
"Setup is formatting your disk");
|
"Setup is formatting your disk");
|
||||||
|
|
||||||
ProgressSetStepCount(FormatProgressBar, 100);
|
ProgressSetStepCount(FormatProgressBar, 100);
|
||||||
|
|
|
@ -2885,6 +2885,42 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
||||||
return FILE_COPY_PAGE;
|
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
|
static UINT CALLBACK
|
||||||
FileCopyCallback(PVOID Context,
|
FileCopyCallback(PVOID Context,
|
||||||
|
@ -2902,57 +2938,102 @@ FileCopyCallback(PVOID Context,
|
||||||
CopyContext->TotalOperations = (ULONG)Param2;
|
CopyContext->TotalOperations = (ULONG)Param2;
|
||||||
ProgressSetStepCount(CopyContext->ProgressBar,
|
ProgressSetStepCount(CopyContext->ProgressBar,
|
||||||
CopyContext->TotalOperations);
|
CopyContext->TotalOperations);
|
||||||
|
SetupUpdateMemoryInfo(CopyContext, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPFILENOTIFY_STARTCOPY:
|
case SPFILENOTIFY_STARTCOPY:
|
||||||
/* Display copy message */
|
/* Display copy message */
|
||||||
CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR)Param1);
|
CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR)Param1);
|
||||||
|
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPFILENOTIFY_ENDCOPY:
|
case SPFILENOTIFY_ENDCOPY:
|
||||||
CopyContext->CompletedOperations++;
|
CopyContext->CompletedOperations++;
|
||||||
ProgressNextStep(CopyContext->ProgressBar);
|
ProgressNextStep(CopyContext->ProgressBar);
|
||||||
|
SetupUpdateMemoryInfo(CopyContext, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
static PAGE_NUMBER
|
PAGE_NUMBER
|
||||||
FileCopyPage(PINPUT_RECORD Ir)
|
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");
|
/* Displey information text */
|
||||||
CONSOLE_SetTextXY(30, 13, "installation folder.");
|
CONSOLE_SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS");
|
||||||
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
|
CONSOLE_SetTextXY(30, 13, "installation folder.");
|
||||||
|
CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete.");
|
||||||
|
|
||||||
CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
|
/* Create context for the copy process */
|
||||||
CopyContext.InstallPath = InstallPath.Buffer;
|
CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
|
||||||
CopyContext.TotalOperations = 0;
|
CopyContext.InstallPath = InstallPath.Buffer;
|
||||||
CopyContext.CompletedOperations = 0;
|
CopyContext.TotalOperations = 0;
|
||||||
CopyContext.ProgressBar = CreateProgressBar(13,
|
CopyContext.CompletedOperations = 0;
|
||||||
26,
|
|
||||||
xScreen - 13,
|
|
||||||
yScreen - 20,
|
|
||||||
"Setup is copying files...");
|
|
||||||
|
|
||||||
SetupCommitFileQueueW(NULL,
|
/* Create the progress bar as well */
|
||||||
SetupFileQueue,
|
CopyContext.ProgressBar = CreateProgressBar(13,
|
||||||
FileCopyCallback,
|
26,
|
||||||
&CopyContext);
|
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
|
static PAGE_NUMBER
|
||||||
RegistryPage(PINPUT_RECORD Ir)
|
RegistryPage(PINPUT_RECORD Ir)
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,14 +194,17 @@ DrawProgressBar(PPROGRESSBAR Bar)
|
||||||
DrawBorder(Bar);
|
DrawBorder(Bar);
|
||||||
|
|
||||||
/* Write Text Associated with 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 */
|
/* Draw the progress bar "border" border */
|
||||||
BarBorder.Top -= 5;
|
if (Bar->Double)
|
||||||
BarBorder.Bottom += 2;
|
{
|
||||||
BarBorder.Right += 5;
|
BarBorder.Top -= 5;
|
||||||
BarBorder.Left -= 5;
|
BarBorder.Bottom += 2;
|
||||||
DrawThickBorder(&BarBorder);
|
BarBorder.Right += 5;
|
||||||
|
BarBorder.Left -= 5;
|
||||||
|
DrawThickBorder(&BarBorder);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draw the bar */
|
/* Draw the bar */
|
||||||
coPos.X = Bar->Left + 1;
|
coPos.X = Bar->Left + 1;
|
||||||
|
@ -229,6 +232,9 @@ CreateProgressBar(SHORT Left,
|
||||||
SHORT Top,
|
SHORT Top,
|
||||||
SHORT Right,
|
SHORT Right,
|
||||||
SHORT Bottom,
|
SHORT Bottom,
|
||||||
|
SHORT TextTop,
|
||||||
|
SHORT TextRight,
|
||||||
|
IN BOOLEAN DoubleEdge,
|
||||||
char* Text)
|
char* Text)
|
||||||
{
|
{
|
||||||
PPROGRESSBAR Bar;
|
PPROGRESSBAR Bar;
|
||||||
|
@ -243,6 +249,9 @@ CreateProgressBar(SHORT Left,
|
||||||
Bar->Top = Top;
|
Bar->Top = Top;
|
||||||
Bar->Right = Right;
|
Bar->Right = Right;
|
||||||
Bar->Bottom = Bottom;
|
Bar->Bottom = Bottom;
|
||||||
|
Bar->TextTop = TextTop;
|
||||||
|
Bar->TextRight = TextRight;
|
||||||
|
Bar->Double = DoubleEdge;
|
||||||
Bar->Text = Text;
|
Bar->Text = Text;
|
||||||
|
|
||||||
Bar->Width = Bar->Right - Bar->Left + 1;
|
Bar->Width = Bar->Right - Bar->Left + 1;
|
||||||
|
|
|
@ -34,6 +34,8 @@ typedef struct _PROGRESS
|
||||||
SHORT Top;
|
SHORT Top;
|
||||||
SHORT Right;
|
SHORT Right;
|
||||||
SHORT Bottom;
|
SHORT Bottom;
|
||||||
|
SHORT TextTop;
|
||||||
|
SHORT TextRight;
|
||||||
|
|
||||||
SHORT Width;
|
SHORT Width;
|
||||||
|
|
||||||
|
@ -43,6 +45,7 @@ typedef struct _PROGRESS
|
||||||
ULONG StepCount;
|
ULONG StepCount;
|
||||||
ULONG CurrentStep;
|
ULONG CurrentStep;
|
||||||
|
|
||||||
|
BOOLEAN Double;
|
||||||
CHAR *Text;
|
CHAR *Text;
|
||||||
} PROGRESSBAR, *PPROGRESSBAR;
|
} PROGRESSBAR, *PPROGRESSBAR;
|
||||||
|
|
||||||
|
@ -53,6 +56,9 @@ CreateProgressBar(SHORT Left,
|
||||||
SHORT Top,
|
SHORT Top,
|
||||||
SHORT Right,
|
SHORT Right,
|
||||||
SHORT Bottom,
|
SHORT Bottom,
|
||||||
|
SHORT TextTop,
|
||||||
|
SHORT TextRight,
|
||||||
|
BOOLEAN DoubleEdge,
|
||||||
char* Text);
|
char* Text);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Reference in a new issue