|
From: Jason F. <ja...@gl...> - 2002-05-01 18:49:12
|
Technically gets is not at fault... the problem is downstream as =
everyone knows. I have what appears to me to be a fix. Before I submit =
it, please would those that know console code better than I do make sure =
I'm not just fixing a symptom. Thanks!
FILE: reactos\lib\msvcrt\stdio\stdhnd.c:
// stdin
{
NULL, 0, NULL,
_IOREAD | _IOLBF | _IONBF,
0, 0,0, NULL
},
NOTE: For the definition of stdin I added the _IONBF flag, which seems =
to be required to make pressing Enter work right.
FILE: reactos\lib\kernel32\file\rw.c: (At about line 103, function =
ReadFile)
Add two new variables:
DWORD oldStdinMode;
WINBOOL consoleResult;
Then replace the first few lines of code with:
if (IsConsoleHandle(hFile))
{
GetConsoleMode(hFile, &oldStdinMode);
SetConsoleMode(hFile, ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
consoleResult =3D ReadConsoleA(hFile,
lpBuffer,
nNumberOfBytesToRead,
lpNumberOfBytesRead,
NULL);
SetConsoleMode(hFile, oldStdinMode);
return consoleResult;
}
NOTE: What it does is set the stdin to echo all input (that was missing =
if it's not specified). Also save and load the previous stdin settings, =
otherwise when you go back to the command line it's broken.
Comments please
Thanks!
- Jason
|