https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e5c0bfacf1374abf34abb…
commit e5c0bfacf1374abf34abbaf75047149a6252ca5e
Author: Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Wed Aug 22 11:10:18 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Sep 9 17:17:16 2018 +0200
[USETUP] Implement the shutdown timeout progress bar. (#833)
- Add the MUI ID resource.
- Implement the shutdown timeout progress bar function and the TimeOut string
handler.
- Add the resource string to other resource languages.
---
base/setup/usetup/lang/bg-BG.h | 2 +
base/setup/usetup/lang/bn-BD.h | 2 +
base/setup/usetup/lang/cs-CZ.h | 2 +
base/setup/usetup/lang/da-DK.h | 2 +
base/setup/usetup/lang/de-DE.h | 2 +
base/setup/usetup/lang/el-GR.h | 2 +
base/setup/usetup/lang/en-US.h | 2 +
base/setup/usetup/lang/es-ES.h | 2 +
base/setup/usetup/lang/et-EE.h | 2 +
base/setup/usetup/lang/fr-FR.h | 2 +
base/setup/usetup/lang/he-IL.h | 2 +
base/setup/usetup/lang/it-IT.h | 2 +
base/setup/usetup/lang/ja-JP.h | 2 +
base/setup/usetup/lang/lt-LT.h | 2 +
base/setup/usetup/lang/ms-MY.h | 2 +
base/setup/usetup/lang/nl-NL.h | 2 +
base/setup/usetup/lang/pl-PL.h | 2 +
base/setup/usetup/lang/pt-BR.h | 2 +
base/setup/usetup/lang/ro-RO.h | 2 +
base/setup/usetup/lang/ru-RU.h | 2 +
base/setup/usetup/lang/sk-SK.h | 2 +
base/setup/usetup/lang/sq-AL.h | 2 +
base/setup/usetup/lang/sv-SE.h | 2 +
base/setup/usetup/lang/tr-TR.h | 2 +
base/setup/usetup/lang/uk-UA.h | 2 +
base/setup/usetup/mui.h | 1 +
base/setup/usetup/usetup.c | 215 +++++++++++++++++++++++++++++++++++++----
27 files changed, 246 insertions(+), 20 deletions(-)
diff --git a/base/setup/usetup/lang/bg-BG.h b/base/setup/usetup/lang/bg-BG.h
index c85d48cc86..b6366eac4e 100644
--- a/base/setup/usetup/lang/bg-BG.h
+++ b/base/setup/usetup/lang/bg-BG.h
@@ -1792,6 +1792,8 @@ MUI_STRING bgBGStrings[] =
" ��⮢�..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = �१���᪠�� �� ��������"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"�⢠�ﭥ� �� �������� � ���ꧬ����\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/bn-BD.h b/base/setup/usetup/lang/bn-BD.h
index fcc483b7d3..5a4d7786e1 100644
--- a/base/setup/usetup/lang/bn-BD.h
+++ b/base/setup/usetup/lang/bn-BD.h
@@ -1777,6 +1777,8 @@ MUI_STRING bnBDStrings[] =
" Done..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Reboot computer"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Unable to open the console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/cs-CZ.h b/base/setup/usetup/lang/cs-CZ.h
index 790fbfc6e6..4359652d37 100644
--- a/base/setup/usetup/lang/cs-CZ.h
+++ b/base/setup/usetup/lang/cs-CZ.h
@@ -1785,6 +1785,8 @@ MUI_STRING csCZStrings[] =
" Hotovo..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Restartovat po��ta�"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Nelze otev��t konzoli\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/da-DK.h b/base/setup/usetup/lang/da-DK.h
index f6029f6613..febfb2b68d 100644
--- a/base/setup/usetup/lang/da-DK.h
+++ b/base/setup/usetup/lang/da-DK.h
@@ -1791,6 +1791,8 @@ MUI_STRING daDKStrings[] =
" Udf�rt..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Genstart"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Kunne ikke �bne konsollen\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/de-DE.h b/base/setup/usetup/lang/de-DE.h
index 9ddac46c7f..fda98fbce0 100644
--- a/base/setup/usetup/lang/de-DE.h
+++ b/base/setup/usetup/lang/de-DE.h
@@ -1781,6 +1781,8 @@ MUI_STRING deDEStrings[] =
" Fertig..."},
{STRING_REBOOTCOMPUTER2,
" EINGABETASTE = Computer neu starten"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Konsole konnte nicht ge�ffnet werden\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/el-GR.h b/base/setup/usetup/lang/el-GR.h
index 034b895f90..58e624f0c3 100644
--- a/base/setup/usetup/lang/el-GR.h
+++ b/base/setup/usetup/lang/el-GR.h
@@ -1796,6 +1796,8 @@ MUI_STRING elGRStrings[] =
" �������韞��..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = �������夞�� ����������"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"��礘�� �� �������� � ����梘\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/en-US.h b/base/setup/usetup/lang/en-US.h
index 216df8fc3b..9f3a6334e5 100644
--- a/base/setup/usetup/lang/en-US.h
+++ b/base/setup/usetup/lang/en-US.h
@@ -1777,6 +1777,8 @@ MUI_STRING enUSStrings[] =
" Done..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Reboot computer"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Unable to open the console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/es-ES.h b/base/setup/usetup/lang/es-ES.h
index 2bf3418b58..e52c7a56ad 100644
--- a/base/setup/usetup/lang/es-ES.h
+++ b/base/setup/usetup/lang/es-ES.h
@@ -1781,6 +1781,8 @@ MUI_STRING esESStrings[] =
" Terminado..."},
{STRING_REBOOTCOMPUTER2,
" INTRO = Reiniciar el equipo"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"No se pudo abrir la consola\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/et-EE.h b/base/setup/usetup/lang/et-EE.h
index b21105d6c2..ee47d0ec84 100644
--- a/base/setup/usetup/lang/et-EE.h
+++ b/base/setup/usetup/lang/et-EE.h
@@ -1777,6 +1777,8 @@ MUI_STRING etEEStrings[] =
" Valmis..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Taask�ivita arvuti"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Konsooli ei �nnestunud avada\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/fr-FR.h b/base/setup/usetup/lang/fr-FR.h
index 7f11d9ba68..fc2780e433 100644
--- a/base/setup/usetup/lang/fr-FR.h
+++ b/base/setup/usetup/lang/fr-FR.h
@@ -1796,6 +1796,8 @@ MUI_STRING frFRStrings[] =
" Termin�..."},
{STRING_REBOOTCOMPUTER2,
" ENTR�E = Red�marrer l'ordinateur"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Impossible d'ouvrir la console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/he-IL.h b/base/setup/usetup/lang/he-IL.h
index e48da925d2..686ed20ed8 100644
--- a/base/setup/usetup/lang/he-IL.h
+++ b/base/setup/usetup/lang/he-IL.h
@@ -1779,6 +1779,8 @@ MUI_STRING heILStrings[] =
" ����..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = ���� ���� �� ����"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Unable to open the console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/it-IT.h b/base/setup/usetup/lang/it-IT.h
index ad3c98b991..9fcaf4c6af 100644
--- a/base/setup/usetup/lang/it-IT.h
+++ b/base/setup/usetup/lang/it-IT.h
@@ -1784,6 +1784,8 @@ MUI_STRING itITStrings[] =
" Fatto..."},
{STRING_REBOOTCOMPUTER2,
" INVIO = Riavvia il computer"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Impossibile aprire la console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/ja-JP.h b/base/setup/usetup/lang/ja-JP.h
index 1000261c0d..d30be1487d 100644
--- a/base/setup/usetup/lang/ja-JP.h
+++ b/base/setup/usetup/lang/ja-JP.h
@@ -1781,6 +1781,8 @@ MUI_STRING jaJPStrings[] =
" ��خ�..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = ���߭��� ����"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"�ݿ�٦ ����� �Ͼ�\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/lt-LT.h b/base/setup/usetup/lang/lt-LT.h
index 9a90a8dbab..697b19ff67 100644
--- a/base/setup/usetup/lang/lt-LT.h
+++ b/base/setup/usetup/lang/lt-LT.h
@@ -1787,6 +1787,8 @@ MUI_STRING ltLTStrings[] =
" Done..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Reboot computer"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Unable to open the console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/ms-MY.h b/base/setup/usetup/lang/ms-MY.h
index b4eceeb2f2..2da4e91f0f 100644
--- a/base/setup/usetup/lang/ms-MY.h
+++ b/base/setup/usetup/lang/ms-MY.h
@@ -1666,6 +1666,8 @@ MUI_STRING msMYStrings[] =
" Siap..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Memulakan semuala komputer"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Tidak dapat membuka konsol\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/nl-NL.h b/base/setup/usetup/lang/nl-NL.h
index c25d939dad..9f080ce4c2 100644
--- a/base/setup/usetup/lang/nl-NL.h
+++ b/base/setup/usetup/lang/nl-NL.h
@@ -1807,6 +1807,8 @@ MUI_STRING nlNLStrings[] =
" Voltooid..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Computer opnieuw opstarten"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Kan console niet openen.\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/pl-PL.h b/base/setup/usetup/lang/pl-PL.h
index 384da7a97a..b1381bcac1 100644
--- a/base/setup/usetup/lang/pl-PL.h
+++ b/base/setup/usetup/lang/pl-PL.h
@@ -1788,6 +1788,8 @@ MUI_STRING plPLStrings[] =
" Uko�czone..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Restart komputera"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Otwarcie konsoli nieudane\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/pt-BR.h b/base/setup/usetup/lang/pt-BR.h
index e1cd55e159..4372dc3761 100644
--- a/base/setup/usetup/lang/pt-BR.h
+++ b/base/setup/usetup/lang/pt-BR.h
@@ -1811,6 +1811,8 @@ MUI_STRING ptBRStrings[] =
" Pronto..."},
{STRING_REBOOTCOMPUTER2,
" ENTER=Reiniciar"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"N�o foi poss�vel abrir o console\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/ro-RO.h b/base/setup/usetup/lang/ro-RO.h
index 67a8b312b7..ea86f5a9cd 100644
--- a/base/setup/usetup/lang/ro-RO.h
+++ b/base/setup/usetup/lang/ro-RO.h
@@ -1831,6 +1831,8 @@ MUI_STRING roROStrings[] =
" Terminat!"},
{STRING_REBOOTCOMPUTER2,
" ENTER = Repornire calculator"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"E�ec la deschiderea consolei\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/ru-RU.h b/base/setup/usetup/lang/ru-RU.h
index 6d087dfafd..32b7821193 100644
--- a/base/setup/usetup/lang/ru-RU.h
+++ b/base/setup/usetup/lang/ru-RU.h
@@ -1778,6 +1778,8 @@ MUI_STRING ruRUStrings[] =
" �����襭�..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = ��१���㧪�"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"�� 㤠���� ������ ���᮫�\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/sk-SK.h b/base/setup/usetup/lang/sk-SK.h
index 35682911ce..be99ea5586 100644
--- a/base/setup/usetup/lang/sk-SK.h
+++ b/base/setup/usetup/lang/sk-SK.h
@@ -1791,6 +1791,8 @@ MUI_STRING skSKStrings[] =
" Hotovo..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Re�tart po��ta�a"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Nemo�no otvori� konzolu\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/sq-AL.h b/base/setup/usetup/lang/sq-AL.h
index 021f11ad8c..bf157a9bda 100644
--- a/base/setup/usetup/lang/sq-AL.h
+++ b/base/setup/usetup/lang/sq-AL.h
@@ -1784,6 +1784,8 @@ MUI_STRING sqALStrings[] =
" Mbaruam..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Ristarto kompjuterin"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"N� pamundesi p�r t� hapur konsollin\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/sv-SE.h b/base/setup/usetup/lang/sv-SE.h
index 2dafaf3602..38e766f447 100644
--- a/base/setup/usetup/lang/sv-SE.h
+++ b/base/setup/usetup/lang/sv-SE.h
@@ -1787,6 +1787,8 @@ MUI_STRING svSEStrings[] =
" F�rdigt..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = Starta om datorn"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Det g�r inte �ppna Konsollen\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/tr-TR.h b/base/setup/usetup/lang/tr-TR.h
index 59b9d13b2f..be2ce60cf5 100644
--- a/base/setup/usetup/lang/tr-TR.h
+++ b/base/setup/usetup/lang/tr-TR.h
@@ -1758,6 +1758,8 @@ MUI_STRING trTRStrings[] =
" Bitti..."},
{STRING_REBOOTCOMPUTER2,
" Giri� = Bilgisayar� Yeniden Ba�lat"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"Konsol a��lam�yor.\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/lang/uk-UA.h b/base/setup/usetup/lang/uk-UA.h
index b0b6d53e97..7f693079b8 100644
--- a/base/setup/usetup/lang/uk-UA.h
+++ b/base/setup/usetup/lang/uk-UA.h
@@ -1787,6 +1787,8 @@ MUI_STRING ukUAStrings[] =
" ��⮢�..."},
{STRING_REBOOTCOMPUTER2,
" ENTER = ��१����⠦�� ����'���"},
+ {STRING_REBOOTPROGRESSBAR,
+ " Your computer will reboot in %li second(s)... "},
{STRING_CONSOLEFAIL1,
"�� ������� �i���� ���᮫�\r\n\r\n"},
{STRING_CONSOLEFAIL2,
diff --git a/base/setup/usetup/mui.h b/base/setup/usetup/mui.h
index 0219cde43a..707bb80076 100644
--- a/base/setup/usetup/mui.h
+++ b/base/setup/usetup/mui.h
@@ -159,3 +159,4 @@ MUIGetString(
#define STRING_MB 54
#define STRING_GB 55
#define STRING_ADDKBLAYOUTS 56
+#define STRING_REBOOTPROGRESSBAR 64
diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c
index 1a7940c6e3..102db35f6d 100644
--- a/base/setup/usetup/usetup.c
+++ b/base/setup/usetup/usetup.c
@@ -4502,6 +4502,195 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
}
+/**
+ * @name ProgressTimeOutStringHandler
+ *
+ * Handles the generation (displaying) of the timeout
+ * countdown to the screen dynamically.
+ *
+ * @param Bar
+ * A pointer to a progress bar.
+ *
+ * @param AlwaysUpdate
+ * Constantly update the progress bar (boolean type).
+ *
+ * @param Buffer
+ * A pointer to a string buffer.
+ *
+ * @param cchBufferSize
+ * The buffer's size in number of characters.
+ *
+ * @return
+ * TRUE or FALSE on function termination.
+ *
+ */
+static
+BOOLEAN NTAPI
+ProgressTimeOutStringHandler(
+ IN PPROGRESSBAR Bar,
+ IN BOOLEAN AlwaysUpdate,
+ OUT PSTR Buffer,
+ IN SIZE_T cchBufferSize)
+{
+ ULONG OldProgress = Bar->Progress;
+
+ if (Bar->StepCount == 0)
+ {
+ Bar->Progress = 0;
+ }
+ else
+ {
+ Bar->Progress = Bar->StepCount - Bar->CurrentStep;
+ }
+
+ /* Build the progress string if it has changed */
+ if (Bar->ProgressFormatText &&
+ (AlwaysUpdate || (Bar->Progress != OldProgress)))
+ {
+ RtlStringCchPrintfA(Buffer, cchBufferSize,
+ Bar->ProgressFormatText, Bar->Progress);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ * @name ProgressCountdown
+ *
+ * Displays and draws a red-coloured progress bar with a countdown.
+ * When the timeout is reached, the flush page is displayed for reboot.
+ *
+ * @param Ir
+ * A pointer to an input keyboard record.
+ *
+ * @param TimeOut
+ * Initial countdown value in seconds.
+ *
+ * @return
+ * Nothing.
+ *
+ */
+static VOID
+ProgressCountdown(
+ IN PINPUT_RECORD Ir,
+ IN LONG TimeOut)
+{
+ NTSTATUS Status;
+ ULONG StartTime;
+ LONG TimeElapsed;
+ LONG TimerValue = TimeOut, OldTimerValue;
+ LARGE_INTEGER Timeout;
+ PPROGRESSBAR ProgressBar;
+ BOOLEAN RefreshProgress = TRUE;
+
+ /* Bail out if the timeout is already zero */
+ if (TimeOut <= 0)
+ return;
+
+ /* Create the timeout progress bar and set it up */
+ ProgressBar = CreateProgressBarEx(13,
+ 26,
+ xScreen - 13,
+ yScreen - 20,
+ 10,
+ 24,
+ TRUE,
+ FOREGROUND_RED | BACKGROUND_BLUE,
+ TimerValue,
+ NULL,
+ MUIGetString(STRING_REBOOTPROGRESSBAR),
+ ProgressTimeOutStringHandler);
+
+ StartTime = NtGetTickCount();
+ CONSOLE_Flush();
+
+ OldTimerValue = TimerValue;
+ while (TRUE)
+ {
+ /* Decrease the timer */
+
+ /*
+ * Compute how much time the previous operations took.
+ * This allows us in particular to take account for any time
+ * elapsed if something slowed down.
+ */
+ TimeElapsed = NtGetTickCount() - StartTime;
+ if (TimeElapsed >= 1000)
+ {
+ /* Increase StartTime by steps of 1 second */
+ TimeElapsed /= 1000;
+ StartTime += (1000 * TimeElapsed);
+
+ if (TimeElapsed <= TimerValue)
+ TimerValue -= TimeElapsed;
+ else
+ TimerValue = 0;
+
+ RefreshProgress = TRUE;
+ }
+
+ if (RefreshProgress)
+ {
+ ProgressSetStep(ProgressBar, OldTimerValue - TimerValue);
+ RefreshProgress = FALSE;
+ }
+
+ /* Stop when the timer reaches zero */
+ if (TimerValue <= 0)
+ break;
+
+ /* Check for user key presses */
+
+ /*
+ * If the timer is used, use a passive wait of maximum 1 second
+ * while monitoring for incoming console input events, so that
+ * we are still able to display the timing count.
+ */
+
+ /* Wait a maximum of 1 second for input events */
+ TimeElapsed = NtGetTickCount() - StartTime;
+ if (TimeElapsed < 1000)
+ {
+ /* Convert the time to NT Format */
+ Timeout.QuadPart = (1000 - TimeElapsed) * -10000LL;
+ Status = NtWaitForSingleObject(StdInput, FALSE, &Timeout);
+ }
+ else
+ {
+ Status = STATUS_TIMEOUT;
+ }
+
+ /* Check whether the input event has been signaled, or a timeout happened */
+ if (Status == STATUS_TIMEOUT)
+ {
+ continue;
+ }
+ if (Status != STATUS_WAIT_0)
+ {
+ /* An error happened, bail out */
+ DPRINT1("NtWaitForSingleObject() failed, Status 0x%08lx\n",
Status);
+ break;
+ }
+
+ /* Check for an ENTER key press */
+ while (CONSOLE_ConInKeyPeek(Ir))
+ {
+ if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
+ {
+ /* Found it, stop waiting */
+ goto Exit;
+ }
+ }
+ }
+
+Exit:
+ /* Destroy the progress bar and quit */
+ DestroyProgressBar(ProgressBar);
+}
+
+
/*
* Displays the QuitPage.
*
@@ -4572,15 +4761,9 @@ QuitPage(PINPUT_RECORD Ir)
CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2));
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return FLUSH_PAGE;
- }
- }
+ /* Wait for maximum 15 seconds or an ENTER key before quitting */
+ ProgressCountdown(Ir, 15);
+ return FLUSH_PAGE;
}
@@ -4602,19 +4785,11 @@ SuccessPage(PINPUT_RECORD Ir)
MUIDisplayPage(SUCCESS_PAGE);
if (IsUnattendedSetup)
- {
return FLUSH_PAGE;
- }
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return FLUSH_PAGE;
- }
- }
+ /* Wait for maximum 15 seconds or an ENTER key before quitting */
+ ProgressCountdown(Ir, 15);
+ return FLUSH_PAGE;
}