https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0d51c71ed7051bc65a976…
commit 0d51c71ed7051bc65a976665e8a5040557ac5686
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Mon May 13 23:22:20 2019 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Sun Apr 26 14:57:38 2020 +0200
[USETUP] Optimize font loading
Reload a new font only if codepage changed.
---
base/setup/usetup/console.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/base/setup/usetup/console.c b/base/setup/usetup/console.c
index 6e647d8bfde..8b56bbe2ef7 100644
--- a/base/setup/usetup/console.c
+++ b/base/setup/usetup/console.c
@@ -40,6 +40,7 @@ static BOOLEAN InputQueueEmpty;
static BOOLEAN WaitForInput;
static KEYBOARD_INPUT_DATA InputDataQueue; // Only one element!
static IO_STATUS_BLOCK InputIosb;
+static UINT LastLoadedCodepage;
/* FUNCTIONS *****************************************************************/
@@ -670,6 +671,9 @@ SetConsoleOutputCP(
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
+ if (wCodepage == LastLoadedCodepage)
+ return TRUE;
+
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
Status = NtDeviceIoControlFile(hConsoleOutput,
@@ -682,7 +686,11 @@ SetConsoleOutputCP(
sizeof(ULONG),
NULL,
0);
- return NT_SUCCESS(Status);
+ if (!NT_SUCCESS(Status))
+ return FALSE;
+
+ LastLoadedCodepage = wCodepage;
+ return TRUE;
}