Use BiosConsoleInput instead of calling GetStdHandle in the keyboard input thread.


svn path=/branches/ntvdm/; revision=60855
This commit is contained in:
Aleksandar Andrejevic 2013-11-03 21:52:58 +00:00
parent 36afa0ea12
commit 3fbe4cb107
3 changed files with 8 additions and 6 deletions

View file

@ -26,6 +26,7 @@ static BYTE BiosKeyboardMap[256];
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 @@ BOOLEAN BiosInitialize(VOID)
/* 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 @@ VOID BiosCleanup(VOID)
/* 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)

View file

@ -76,7 +76,6 @@ INT wmain(INT argc, WCHAR *argv[])
DWORD LastClockUpdate = GetTickCount();
LARGE_INTEGER Frequency, LastTimerTick, LastRtcTick, Counter;
LONGLONG TimerTicks;
HANDLE InputThread = NULL;
LARGE_INTEGER StartPerfCount;
DWORD StartTickCount;
@ -139,9 +138,6 @@ INT wmain(INT argc, WCHAR *argv[])
return -1;
}
/* Start the input thread */
InputThread = CreateThread(NULL, 0, &InputThreadProc, NULL, 0, NULL);
/* Find the starting performance and tick count */
StartTickCount = GetTickCount();
QueryPerformanceCounter(&StartPerfCount);
@ -226,7 +222,6 @@ INT wmain(INT argc, WCHAR *argv[])
VgaRefreshDisplay();
Cleanup:
if (InputThread != NULL) CloseHandle(InputThread);
SpeakerCleanup();
BiosCleanup();
EmulatorCleanup();

View file

@ -268,7 +268,7 @@ VOID KeyboardWriteData(BYTE Data)
DWORD WINAPI InputThreadProc(LPVOID Parameter)
{
INT i;
HANDLE ConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
HANDLE ConsoleInput = (HANDLE)Parameter;
INPUT_RECORD InputRecord;
DWORD Count;