Author: ion
Date: Wed Feb 28 23:43:13 2007
New Revision: 25929
URL:
http://svn.reactos.org/svn/reactos?rev=25929&view=rev
Log:
- 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.
Modified:
trunk/reactos/base/setup/usetup/chkdsk.c
trunk/reactos/base/setup/usetup/filequeue.h
trunk/reactos/base/setup/usetup/format.c
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/progress.c
trunk/reactos/base/setup/usetup/progress.h
Modified: trunk/reactos/base/setup/usetup/chkdsk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/chkdsk.c…
==============================================================================
--- trunk/reactos/base/setup/usetup/chkdsk.c (original)
+++ trunk/reactos/base/setup/usetup/chkdsk.c Wed Feb 28 23:43:13 2007
@@ -64,6 +64,9 @@
yScreen - 14,
xScreen - 7,
yScreen - 10,
+ 10,
+ 24,
+ TRUE,
"Setup is checking your disk");
ProgressSetStepCount(ChkdskProgressBar, 100);
Modified: trunk/reactos/base/setup/usetup/filequeue.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/filequeu…
==============================================================================
--- trunk/reactos/base/setup/usetup/filequeue.h (original)
+++ trunk/reactos/base/setup/usetup/filequeue.h Wed Feb 28 23:43:13 2007
@@ -65,6 +65,7 @@
ULONG TotalOperations;
ULONG CompletedOperations;
PPROGRESSBAR ProgressBar;
+ PPROGRESSBAR MemoryBars[4];
} COPYCONTEXT, *PCOPYCONTEXT;
/* FUNCTIONS ****************************************************************/
Modified: trunk/reactos/base/setup/usetup/format.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/format.c…
==============================================================================
--- trunk/reactos/base/setup/usetup/format.c (original)
+++ trunk/reactos/base/setup/usetup/format.c Wed Feb 28 23:43:13 2007
@@ -96,6 +96,9 @@
yScreen - 14,
xScreen - 7,
yScreen - 10,
+ 10,
+ 24,
+ TRUE,
"Setup is formatting your disk");
ProgressSetStepCount(FormatProgressBar, 100);
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c Wed Feb 28 23:43:13 2007
@@ -2885,6 +2885,42 @@
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,56 +2938,101 @@
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;
-
- 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.");
-
- 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...");
-
- SetupCommitFileQueueW(NULL,
- SetupFileQueue,
- FileCopyCallback,
- &CopyContext);
-
- SetupCloseFileQueue(SetupFileQueue);
-
- DestroyProgressBar(CopyContext.ProgressBar);
-
- return REGISTRY_PAGE;
-}
-
+ COPYCONTEXT CopyContext;
+
+ /* Display status text */
+ CONSOLE_SetStatusText("
\xB3 Please wait... ");
+
+ /* 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.");
+
+ /* Create context for the copy process */
+ CopyContext.DestinationRootPath = DestinationRootPath.Buffer;
+ CopyContext.InstallPath = InstallPath.Buffer;
+ CopyContext.TotalOperations = 0;
+ CopyContext.CompletedOperations = 0;
+
+ /* Create the progress bar as well */
+ CopyContext.ProgressBar = CreateProgressBar(13,
+ 26,
+ xScreen - 13,
+ yScreen - 20,
+ 10,
+ 24,
+ TRUE,
+ "Setup is copying files...");
+
+ /* Create the paged pool progress bar */
+ CopyContext.MemoryBars[0] = CreateProgressBar(13,
+ 40,
+ 18,
+ 43,
+ 10,
+ 44,
+ FALSE,
+ "Paged Memory");
+
+ /* Create the non paged pool progress bar */
+ CopyContext.MemoryBars[1] = CreateProgressBar(28,
+ 40,
+ 33,
+ 43,
+ 24,
+ 44,
+ FALSE,
+ "Nonpaged Memory");
+
+ /* 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)
Modified: trunk/reactos/base/setup/usetup/progress.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/progress…
==============================================================================
--- trunk/reactos/base/setup/usetup/progress.c (original)
+++ trunk/reactos/base/setup/usetup/progress.c Wed Feb 28 23:43:13 2007
@@ -194,14 +194,17 @@
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 @@
SHORT Top,
SHORT Right,
SHORT Bottom,
+ SHORT TextTop,
+ SHORT TextRight,
+ IN BOOLEAN DoubleEdge,
char* Text)
{
PPROGRESSBAR Bar;
@@ -243,6 +249,9 @@
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;
Modified: trunk/reactos/base/setup/usetup/progress.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/progress…
==============================================================================
--- trunk/reactos/base/setup/usetup/progress.h (original)
+++ trunk/reactos/base/setup/usetup/progress.h Wed Feb 28 23:43:13 2007
@@ -34,6 +34,8 @@
SHORT Top;
SHORT Right;
SHORT Bottom;
+ SHORT TextTop;
+ SHORT TextRight;
SHORT Width;
@@ -43,6 +45,7 @@
ULONG StepCount;
ULONG CurrentStep;
+ BOOLEAN Double;
CHAR *Text;
} PROGRESSBAR, *PPROGRESSBAR;
@@ -53,6 +56,9 @@
SHORT Top,
SHORT Right,
SHORT Bottom,
+ SHORT TextTop,
+ SHORT TextRight,
+ BOOLEAN DoubleEdge,
char* Text);
VOID