mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[CONSRV] Introduce a CON_SET_OUTPUT_CP() macro to simplify setting the console's output CP + associated changes. Simplify ConDrvSetConsoleCP() as well.
This commit is contained in:
parent
f80de47c85
commit
f79c02bd8a
3 changed files with 19 additions and 15 deletions
|
@ -116,9 +116,10 @@ ConDrvInitConsole(
|
||||||
|
|
||||||
/* Set-up the code page */
|
/* Set-up the code page */
|
||||||
if (IsValidCodePage(ConsoleInfo->CodePage))
|
if (IsValidCodePage(ConsoleInfo->CodePage))
|
||||||
Console->InputCodePage = Console->OutputCodePage = ConsoleInfo->CodePage;
|
{
|
||||||
|
CON_SET_OUTPUT_CP(Console, ConsoleInfo->CodePage);
|
||||||
Console->IsCJK = IsCJKCodePage(Console->OutputCodePage);
|
Console->InputCodePage = ConsoleInfo->CodePage;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize a new text-mode screen buffer with default settings */
|
/* Initialize a new text-mode screen buffer with default settings */
|
||||||
ScreenBufferInfo.ScreenBufferSize = ConsoleInfo->ScreenBufferSize;
|
ScreenBufferInfo.ScreenBufferSize = ConsoleInfo->ScreenBufferSize;
|
||||||
|
@ -424,27 +425,24 @@ ConDrvSetConsoleCP(IN PCONSOLE Console,
|
||||||
IN UINT CodePage,
|
IN UINT CodePage,
|
||||||
IN BOOLEAN OutputCP)
|
IN BOOLEAN OutputCP)
|
||||||
{
|
{
|
||||||
BOOL Success = TRUE;
|
|
||||||
|
|
||||||
if (Console == NULL || !IsValidCodePage(CodePage))
|
if (Console == NULL || !IsValidCodePage(CodePage))
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (OutputCP)
|
if (OutputCP)
|
||||||
{
|
{
|
||||||
/* Request the terminal to change its code page support */
|
/* Request the terminal to change its code page support */
|
||||||
Success = TermSetCodePage(Console, CodePage);
|
if (!TermSetCodePage(Console, CodePage))
|
||||||
if (Success)
|
return STATUS_UNSUCCESSFUL;
|
||||||
{
|
|
||||||
Console->OutputCodePage = CodePage;
|
/* All is fine, actually set the output code page */
|
||||||
Console->IsCJK = IsCJKCodePage(CodePage);
|
CON_SET_OUTPUT_CP(Console, CodePage);
|
||||||
}
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console->InputCodePage = CodePage;
|
Console->InputCodePage = CodePage;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -320,6 +320,12 @@ ConDrvUnpause(PCONSOLE Console);
|
||||||
#define GetConsoleInputBufferMode(Console) \
|
#define GetConsoleInputBufferMode(Console) \
|
||||||
(Console)->InputBuffer.Mode
|
(Console)->InputBuffer.Mode
|
||||||
|
|
||||||
|
#define CON_SET_OUTPUT_CP(Console, CodePage)\
|
||||||
|
do { \
|
||||||
|
(Console)->OutputCodePage = (CodePage); \
|
||||||
|
(Console)->IsCJK = IsCJKCodePage((Console)->OutputCodePage); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
/* conoutput.c */
|
/* conoutput.c */
|
||||||
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
||||||
|
|
|
@ -68,8 +68,8 @@ ConSrvApplyUserSettings(
|
||||||
// ConDrvSetConsoleCP(Console, ConsoleInfo->CodePage, FALSE); // Input
|
// ConDrvSetConsoleCP(Console, ConsoleInfo->CodePage, FALSE); // Input
|
||||||
if (TermSetCodePage(Console, ConsoleInfo->CodePage))
|
if (TermSetCodePage(Console, ConsoleInfo->CodePage))
|
||||||
{
|
{
|
||||||
Console->InputCodePage = Console->OutputCodePage = ConsoleInfo->CodePage;
|
CON_SET_OUTPUT_CP(Console, ConsoleInfo->CodePage);
|
||||||
Console->IsCJK = IsCJKCodePage(Console->OutputCodePage);
|
Console->InputCodePage = ConsoleInfo->CodePage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue