[ros-diffs] [jmorlan] 40311: - Fix cmd's cgetchar() function so it only returns on a key being pressed, not released. - Remove ConInDummy function that was called after a line is input. Presumably its purpose was to consume the event of Enter being released, so that that event wouldn't affect the command, but that didn't help when other keys were pressed as well. Anyway, it shouldn't be necessary any more. - Use correct codepage for reading batch files.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Wed Apr 1 05:54:47 CEST 2009


Author: jmorlan
Date: Wed Apr  1 07:54:45 2009
New Revision: 40311

URL: http://svn.reactos.org/svn/reactos?rev=40311&view=rev
Log:
- Fix cmd's cgetchar() function so it only returns on a key being pressed, not released.
- Remove ConInDummy function that was called after a line is input. Presumably its purpose was to consume the event of Enter being released, so that that event wouldn't affect the command, but that didn't help when other keys were pressed as well. Anyway, it shouldn't be necessary any more.
- Use correct codepage for reading batch files.

Modified:
    trunk/reactos/base/shell/cmd/cmdinput.c
    trunk/reactos/base/shell/cmd/console.c
    trunk/reactos/base/shell/cmd/misc.c

Modified: trunk/reactos/base/shell/cmd/cmdinput.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmdinput.c?rev=40311&r1=40310&r2=40311&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmdinput.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmdinput.c [iso-8859-1] Wed Apr  1 07:54:45 2009
@@ -449,7 +449,6 @@
 #endif
 				str[charcount++] = _T('\n');
 				str[charcount] = _T('\0');
-				ConInDummy ();
 				ConOutChar (_T('\n'));
 			bReturn = TRUE;
 				break;

Modified: trunk/reactos/base/shell/cmd/console.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/console.c?rev=40311&r1=40310&r2=40311&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/console.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/console.c [iso-8859-1] Wed Apr  1 07:54:45 2009
@@ -48,17 +48,6 @@
 	SetConsoleMode (hInput, dwMode);
 }
 
-
-VOID ConInDummy (VOID)
-{
-	HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
-	INPUT_RECORD dummy;
-	DWORD  dwRead;
-
-	if (hInput == INVALID_HANDLE_VALUE)
-		WARN ("Invalid input handle!!!\n");
-	ReadConsoleInput (hInput, &dummy, 1, &dwRead);
-}
 
 VOID ConInFlush (VOID)
 {

Modified: trunk/reactos/base/shell/cmd/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/misc.c?rev=40311&r1=40310&r2=40311&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/misc.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/misc.c [iso-8859-1] Wed Apr  1 07:54:45 2009
@@ -43,39 +43,20 @@
 	HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
 	INPUT_RECORD irBuffer;
 	DWORD  dwRead;
-/*
+
 	do
 	{
 		ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
 		if ((irBuffer.EventType == KEY_EVENT) &&
 			(irBuffer.Event.KeyEvent.bKeyDown == TRUE))
 		{
-			if ((irBuffer.Event.KeyEvent.dwControlKeyState &
-				 (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) &
-				(irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C'))
-				bCtrlBreak = TRUE;
-
-			break;
-		}
-	}
-	while (TRUE);
-*/
-	do
- 	{
- 		ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
-
-		if (irBuffer.EventType == KEY_EVENT)
- 		{
 			if (irBuffer.Event.KeyEvent.dwControlKeyState &
 				 (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))
 			{
 				if (irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C')
 				{
-//					if (irBuffer.Event.KeyEvent.bKeyDown == TRUE)
-//					{
-						bCtrlBreak = TRUE;
-						break;
-//					}
+					bCtrlBreak = TRUE;
+					break;
 				}
 			}
 			else if ((irBuffer.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
@@ -538,7 +519,7 @@
 
 	lpString[len++] = '\0';
 #ifdef _UNICODE
-	MultiByteToWideChar(CP_ACP, 0, lpString, -1, lpBuffer, len);
+	MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len);
 	cmd_free(lpString);
 #endif
 	return TRUE;



More information about the Ros-diffs mailing list