mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
[CMD] Reset the current thread UI language at startup, and when updating the local code page cache.
CORE-17601
This commit is contained in:
parent
0483063b69
commit
53bd132cec
2 changed files with 35 additions and 17 deletions
|
@ -506,14 +506,14 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
|||
dwExitCode = 1;
|
||||
}
|
||||
|
||||
/* Restore our default console mode */
|
||||
/* Restore the default console mode */
|
||||
SetConsoleMode(ConStreamGetOSHandle(StdIn),
|
||||
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||
SetConsoleMode(ConStreamGetOSHandle(StdOut),
|
||||
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||
}
|
||||
|
||||
/* Update our local codepage cache */
|
||||
/* Update the local code page cache */
|
||||
{
|
||||
UINT uNewInputCodePage = GetConsoleCP();
|
||||
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
||||
|
@ -521,15 +521,21 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
|||
if ((InputCodePage != uNewInputCodePage) ||
|
||||
(OutputCodePage != uNewOutputCodePage))
|
||||
{
|
||||
/* Update the locale as well */
|
||||
InitLocale();
|
||||
}
|
||||
|
||||
InputCodePage = uNewInputCodePage;
|
||||
OutputCodePage = uNewOutputCodePage;
|
||||
|
||||
/* Update the streams codepage cache as well */
|
||||
/* Reset the current thread UI language */
|
||||
if (IsConsoleHandle(ConStreamGetOSHandle(StdOut)) ||
|
||||
IsConsoleHandle(ConStreamGetOSHandle(StdErr)))
|
||||
{
|
||||
ConSetThreadUILanguage(0);
|
||||
}
|
||||
/* Update the streams cached code page */
|
||||
ConStdStreamsSetCacheCodePage(InputCodePage, OutputCodePage);
|
||||
|
||||
/* Update the locale as well */
|
||||
InitLocale();
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore the original console title */
|
||||
|
@ -2178,7 +2184,7 @@ Initialize(VOID)
|
|||
/* Add ctrl break handler */
|
||||
AddBreakHandler();
|
||||
|
||||
/* Set our default console mode */
|
||||
/* Set the default console mode */
|
||||
hOut = ConStreamGetOSHandle(StdOut);
|
||||
hIn = ConStreamGetOSHandle(StdIn);
|
||||
SetConsoleMode(hOut, 0); // Reinitialize the console output mode
|
||||
|
@ -2287,7 +2293,7 @@ Initialize(VOID)
|
|||
ConSetScreenColor(ConStreamGetOSHandle(StdOut), wDefColor, TRUE);
|
||||
#endif
|
||||
|
||||
/* Reset the output Standard Streams translation modes and codepage caches */
|
||||
/* Reset the output Standard Streams translation modes and code page caches */
|
||||
// ConStreamSetMode(StdIn , OutputStreamMode, InputCodePage );
|
||||
ConStreamSetMode(StdOut, OutputStreamMode, OutputCodePage);
|
||||
ConStreamSetMode(StdErr, OutputStreamMode, OutputCodePage);
|
||||
|
@ -2374,6 +2380,12 @@ int _tmain(int argc, const TCHAR *argv[])
|
|||
ConStreamInit(StdIn , GetStdHandle(STD_INPUT_HANDLE) , /*OutputStreamMode*/ AnsiText, InputCodePage);
|
||||
ConStreamInit(StdOut, GetStdHandle(STD_OUTPUT_HANDLE), OutputStreamMode, OutputCodePage);
|
||||
ConStreamInit(StdErr, GetStdHandle(STD_ERROR_HANDLE) , OutputStreamMode, OutputCodePage);
|
||||
/* Reset the current thread UI language */
|
||||
if (IsConsoleHandle(ConStreamGetOSHandle(StdOut)) ||
|
||||
IsConsoleHandle(ConStreamGetOSHandle(StdErr)))
|
||||
{
|
||||
ConSetThreadUILanguage(0);
|
||||
}
|
||||
|
||||
CMD_ModuleHandle = GetModuleHandle(NULL);
|
||||
|
||||
|
|
|
@ -305,7 +305,7 @@ INT cmd_start (LPTSTR Rest)
|
|||
}
|
||||
CloseHandle (prci.hProcess);
|
||||
|
||||
/* Update our local codepage cache */
|
||||
/* Update the local code page cache */
|
||||
{
|
||||
UINT uNewInputCodePage = GetConsoleCP();
|
||||
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
||||
|
@ -313,15 +313,21 @@ INT cmd_start (LPTSTR Rest)
|
|||
if ((InputCodePage != uNewInputCodePage) ||
|
||||
(OutputCodePage != uNewOutputCodePage))
|
||||
{
|
||||
/* Update the locale as well */
|
||||
InitLocale();
|
||||
}
|
||||
|
||||
InputCodePage = uNewInputCodePage;
|
||||
OutputCodePage = uNewOutputCodePage;
|
||||
|
||||
/* Update the streams codepage cache as well */
|
||||
/* Reset the current thread UI language */
|
||||
if (IsConsoleHandle(ConStreamGetOSHandle(StdOut)) ||
|
||||
IsConsoleHandle(ConStreamGetOSHandle(StdErr)))
|
||||
{
|
||||
ConSetThreadUILanguage(0);
|
||||
}
|
||||
/* Update the streams cached code page */
|
||||
ConStdStreamsSetCacheCodePage(InputCodePage, OutputCodePage);
|
||||
|
||||
/* Update the locale as well */
|
||||
InitLocale();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue