mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 01:11:23 +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.dwFlags = STARTF_USESHOWWINDOW;
|
||||||
stui.wShowWindow = SW_SHOWDEFAULT;
|
stui.wShowWindow = SW_SHOWDEFAULT;
|
||||||
|
|
||||||
// return console to standard mode
|
/* Set the console to standard mode */
|
||||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
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,
|
if (CreateProcess(szFullName,
|
||||||
szFullCmdLine,
|
szFullCmdLine,
|
||||||
|
@ -428,7 +428,6 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
||||||
NULL,
|
NULL,
|
||||||
&stui,
|
&stui,
|
||||||
&prci))
|
&prci))
|
||||||
|
|
||||||
{
|
{
|
||||||
CloseHandle(prci.hThread);
|
CloseHandle(prci.hThread);
|
||||||
}
|
}
|
||||||
|
@ -465,13 +464,14 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
|
||||||
dwExitCode = 1;
|
dwExitCode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore console mode
|
/* Restore our default console mode */
|
||||||
SetConsoleMode (
|
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
||||||
GetStdHandle( STD_INPUT_HANDLE ),
|
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
|
||||||
ENABLE_PROCESSED_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();
|
InputCodePage= GetConsoleCP();
|
||||||
OutputCodePage = GetConsoleOutputCP();
|
OutputCodePage = GetConsoleOutputCP();
|
||||||
SetConsoleTitle(szWindowTitle);
|
SetConsoleTitle(szWindowTitle);
|
||||||
|
@ -1667,10 +1667,13 @@ Initialize()
|
||||||
SetEnvironmentVariable (_T("COMSPEC"), ModuleName);
|
SetEnvironmentVariable (_T("COMSPEC"), ModuleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add ctrl break handler */
|
/* Add ctrl break handler */
|
||||||
AddBreakHandler();
|
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();
|
cmdLine = GetCommandLine();
|
||||||
TRACE ("[command args: %s]\n", debugstr_aw(cmdLine));
|
TRACE ("[command args: %s]\n", debugstr_aw(cmdLine));
|
||||||
|
@ -1800,10 +1803,15 @@ static VOID Cleanup()
|
||||||
/* free GetEnvVar's buffer */
|
/* free GetEnvVar's buffer */
|
||||||
GetEnvVar(NULL);
|
GetEnvVar(NULL);
|
||||||
|
|
||||||
/* remove ctrl break handler */
|
/* Remove ctrl break handler */
|
||||||
RemoveBreakHandler();
|
RemoveBreakHandler();
|
||||||
|
|
||||||
|
/* Restore the default console mode */
|
||||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
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);
|
DeleteCriticalSection(&ChildProcessRunningLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ PerformRedirection(REDIRECTION *RedirList)
|
||||||
static SECURITY_ATTRIBUTES SecAttr = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
static SECURITY_ATTRIBUTES SecAttr = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
||||||
|
|
||||||
/* Some parameters used for read, write, and append, respectively */
|
/* Some parameters used for read, write, and append, respectively */
|
||||||
static
|
static struct REDIR_PARAMS
|
||||||
struct REDIR_PARAMS
|
|
||||||
{
|
{
|
||||||
DWORD dwDesiredAccess;
|
DWORD dwDesiredAccess;
|
||||||
DWORD dwShareMode;
|
DWORD dwShareMode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue