mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 21:22:24 +00:00
[CMD]
Fix the default input & output console modes. Now, you can use the command interpreter via serial port redirection, by: 1- Enabling a serial port on the machine on which ReactOS runs. 2- Launching: cmd > AUX at a command prompt. svn path=/trunk/; revision=59405
This commit is contained in:
parent
ce910f7e5f
commit
f4f73b4848
2 changed files with 45 additions and 38 deletions
|
@ -414,9 +414,9 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
|||
stui.dwFlags = STARTF_USESHOWWINDOW;
|
||||
stui.wShowWindow = SW_SHOWDEFAULT;
|
||||
|
||||
// return console to standard mode
|
||||
/* Set the console to standard mode */
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
||||
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT);
|
||||
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||
|
||||
if (CreateProcess(szFullName,
|
||||
szFullCmdLine,
|
||||
|
@ -428,7 +428,6 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
|||
NULL,
|
||||
&stui,
|
||||
&prci))
|
||||
|
||||
{
|
||||
CloseHandle(prci.hThread);
|
||||
}
|
||||
|
@ -465,13 +464,14 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
|||
dwExitCode = 1;
|
||||
}
|
||||
|
||||
// restore console mode
|
||||
SetConsoleMode (
|
||||
GetStdHandle( STD_INPUT_HANDLE ),
|
||||
ENABLE_PROCESSED_INPUT );
|
||||
/* Restore our default console mode */
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
||||
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||
}
|
||||
|
||||
/* Get code page if it has been change */
|
||||
/* Get code page if it has been changed */
|
||||
InputCodePage= GetConsoleCP();
|
||||
OutputCodePage = GetConsoleOutputCP();
|
||||
SetConsoleTitle(szWindowTitle);
|
||||
|
@ -1667,10 +1667,13 @@ Initialize()
|
|||
SetEnvironmentVariable (_T("COMSPEC"), ModuleName);
|
||||
}
|
||||
|
||||
/* add ctrl break handler */
|
||||
/* Add ctrl break handler */
|
||||
AddBreakHandler();
|
||||
|
||||
SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT);
|
||||
/* Set our default console mode */
|
||||
SetConsoleMode(hOut, 0); // Reinitialize the console output mode
|
||||
SetConsoleMode(hOut, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||
SetConsoleMode(hIn , ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||
|
||||
cmdLine = GetCommandLine();
|
||||
TRACE ("[command args: %s]\n", debugstr_aw(cmdLine));
|
||||
|
@ -1800,10 +1803,15 @@ static VOID Cleanup()
|
|||
/* free GetEnvVar's buffer */
|
||||
GetEnvVar(NULL);
|
||||
|
||||
/* remove ctrl break handler */
|
||||
/* Remove ctrl break handler */
|
||||
RemoveBreakHandler();
|
||||
|
||||
/* Restore the default console mode */
|
||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
||||
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT);
|
||||
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
|
||||
|
||||
DeleteCriticalSection(&ChildProcessRunningLock);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ PerformRedirection(REDIRECTION *RedirList)
|
|||
static SECURITY_ATTRIBUTES SecAttr = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
||||
|
||||
/* Some parameters used for read, write, and append, respectively */
|
||||
static
|
||||
struct REDIR_PARAMS
|
||||
static struct REDIR_PARAMS
|
||||
{
|
||||
DWORD dwDesiredAccess;
|
||||
DWORD dwShareMode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue