Author: aandrejevic
Date: Sun Nov 3 21:52:58 2013
New Revision: 60855
URL:
http://svn.reactos.org/svn/reactos?rev=60855&view=rev
Log:
[NTVDM]
Use BiosConsoleInput instead of calling GetStdHandle in the keyboard input thread.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.c
branches/ntvdm/subsystems/ntvdm/ntvdm.c
branches/ntvdm/subsystems/ntvdm/ps2.c
Modified: branches/ntvdm/subsystems/ntvdm/bios.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Sun Nov 3 21:52:58 2013
@@ -26,6 +26,7 @@
static HANDLE BiosConsoleInput = INVALID_HANDLE_VALUE;
static HANDLE BiosConsoleOutput = INVALID_HANDLE_VALUE;
static CONSOLE_SCREEN_BUFFER_INFO BiosSavedBufferInfo;
+static HANDLE InputThread = NULL;
/*
* VGA Register Configurations for BIOS Video Modes
@@ -555,6 +556,9 @@
/* Set the console input mode */
SetConsoleMode(BiosConsoleInput, ENABLE_MOUSE_INPUT | ENABLE_PROCESSED_INPUT);
+ /* Start the input thread */
+ InputThread = CreateThread(NULL, 0, &InputThreadProc, BiosConsoleInput, 0,
NULL);
+
/* Initialize the PIC */
PicWriteCommand(PIC_MASTER_CMD, PIC_ICW1 | PIC_ICW1_ICW4);
PicWriteCommand(PIC_SLAVE_CMD , PIC_ICW1 | PIC_ICW1_ICW4);
@@ -593,6 +597,9 @@
/* Close the console handles */
if (BiosConsoleOutput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleOutput);
if (BiosConsoleInput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleInput);
+
+ /* Close the input thread handle */
+ if (InputThread != NULL) CloseHandle(InputThread);
}
WORD BiosPeekCharacter(VOID)
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sun Nov 3 21:52:58 2013
@@ -76,7 +76,6 @@
DWORD LastClockUpdate = GetTickCount();
LARGE_INTEGER Frequency, LastTimerTick, LastRtcTick, Counter;
LONGLONG TimerTicks;
- HANDLE InputThread = NULL;
LARGE_INTEGER StartPerfCount;
DWORD StartTickCount;
@@ -138,9 +137,6 @@
DisplayMessage(L"Could not start program: %S", CommandLine);
return -1;
}
-
- /* Start the input thread */
- InputThread = CreateThread(NULL, 0, &InputThreadProc, NULL, 0, NULL);
/* Find the starting performance and tick count */
StartTickCount = GetTickCount();
@@ -226,7 +222,6 @@
VgaRefreshDisplay();
Cleanup:
- if (InputThread != NULL) CloseHandle(InputThread);
SpeakerCleanup();
BiosCleanup();
EmulatorCleanup();
Modified: branches/ntvdm/subsystems/ntvdm/ps2.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] Sun Nov 3 21:52:58 2013
@@ -268,7 +268,7 @@
DWORD WINAPI InputThreadProc(LPVOID Parameter)
{
INT i;
- HANDLE ConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
+ HANDLE ConsoleInput = (HANDLE)Parameter;
INPUT_RECORD InputRecord;
DWORD Count;