mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 00:20:34 +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;
|
dwExitCode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore our default console mode */
|
/* Restore the default console mode */
|
||||||
SetConsoleMode(ConStreamGetOSHandle(StdIn),
|
SetConsoleMode(ConStreamGetOSHandle(StdIn),
|
||||||
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||||
SetConsoleMode(ConStreamGetOSHandle(StdOut),
|
SetConsoleMode(ConStreamGetOSHandle(StdOut),
|
||||||
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update our local codepage cache */
|
/* Update the local code page cache */
|
||||||
{
|
{
|
||||||
UINT uNewInputCodePage = GetConsoleCP();
|
UINT uNewInputCodePage = GetConsoleCP();
|
||||||
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
||||||
|
@ -521,15 +521,21 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
||||||
if ((InputCodePage != uNewInputCodePage) ||
|
if ((InputCodePage != uNewInputCodePage) ||
|
||||||
(OutputCodePage != uNewOutputCodePage))
|
(OutputCodePage != uNewOutputCodePage))
|
||||||
{
|
{
|
||||||
|
InputCodePage = uNewInputCodePage;
|
||||||
|
OutputCodePage = uNewOutputCodePage;
|
||||||
|
|
||||||
|
/* 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 */
|
/* Update the locale as well */
|
||||||
InitLocale();
|
InitLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
InputCodePage = uNewInputCodePage;
|
|
||||||
OutputCodePage = uNewOutputCodePage;
|
|
||||||
|
|
||||||
/* Update the streams codepage cache as well */
|
|
||||||
ConStdStreamsSetCacheCodePage(InputCodePage, OutputCodePage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the original console title */
|
/* Restore the original console title */
|
||||||
|
@ -2178,7 +2184,7 @@ Initialize(VOID)
|
||||||
/* Add ctrl break handler */
|
/* Add ctrl break handler */
|
||||||
AddBreakHandler();
|
AddBreakHandler();
|
||||||
|
|
||||||
/* Set our default console mode */
|
/* Set the default console mode */
|
||||||
hOut = ConStreamGetOSHandle(StdOut);
|
hOut = ConStreamGetOSHandle(StdOut);
|
||||||
hIn = ConStreamGetOSHandle(StdIn);
|
hIn = ConStreamGetOSHandle(StdIn);
|
||||||
SetConsoleMode(hOut, 0); // Reinitialize the console output mode
|
SetConsoleMode(hOut, 0); // Reinitialize the console output mode
|
||||||
|
@ -2287,7 +2293,7 @@ Initialize(VOID)
|
||||||
ConSetScreenColor(ConStreamGetOSHandle(StdOut), wDefColor, TRUE);
|
ConSetScreenColor(ConStreamGetOSHandle(StdOut), wDefColor, TRUE);
|
||||||
#endif
|
#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(StdIn , OutputStreamMode, InputCodePage );
|
||||||
ConStreamSetMode(StdOut, OutputStreamMode, OutputCodePage);
|
ConStreamSetMode(StdOut, OutputStreamMode, OutputCodePage);
|
||||||
ConStreamSetMode(StdErr, 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(StdIn , GetStdHandle(STD_INPUT_HANDLE) , /*OutputStreamMode*/ AnsiText, InputCodePage);
|
||||||
ConStreamInit(StdOut, GetStdHandle(STD_OUTPUT_HANDLE), OutputStreamMode, OutputCodePage);
|
ConStreamInit(StdOut, GetStdHandle(STD_OUTPUT_HANDLE), OutputStreamMode, OutputCodePage);
|
||||||
ConStreamInit(StdErr, GetStdHandle(STD_ERROR_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);
|
CMD_ModuleHandle = GetModuleHandle(NULL);
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ INT cmd_start (LPTSTR Rest)
|
||||||
}
|
}
|
||||||
CloseHandle (prci.hProcess);
|
CloseHandle (prci.hProcess);
|
||||||
|
|
||||||
/* Update our local codepage cache */
|
/* Update the local code page cache */
|
||||||
{
|
{
|
||||||
UINT uNewInputCodePage = GetConsoleCP();
|
UINT uNewInputCodePage = GetConsoleCP();
|
||||||
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
UINT uNewOutputCodePage = GetConsoleOutputCP();
|
||||||
|
@ -313,15 +313,21 @@ INT cmd_start (LPTSTR Rest)
|
||||||
if ((InputCodePage != uNewInputCodePage) ||
|
if ((InputCodePage != uNewInputCodePage) ||
|
||||||
(OutputCodePage != uNewOutputCodePage))
|
(OutputCodePage != uNewOutputCodePage))
|
||||||
{
|
{
|
||||||
|
InputCodePage = uNewInputCodePage;
|
||||||
|
OutputCodePage = uNewOutputCodePage;
|
||||||
|
|
||||||
|
/* 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 */
|
/* Update the locale as well */
|
||||||
InitLocale();
|
InitLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
InputCodePage = uNewInputCodePage;
|
|
||||||
OutputCodePage = uNewOutputCodePage;
|
|
||||||
|
|
||||||
/* Update the streams codepage cache as well */
|
|
||||||
ConStdStreamsSetCacheCodePage(InputCodePage, OutputCodePage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue