[NTVDM]: Don't attempt to deinitialize the video console if it wasn't previously initialized.

CORE-10182 #resolve

svn path=/trunk/; revision=72007
This commit is contained in:
Hermès Bélusca-Maïto 2016-07-26 19:57:40 +00:00
parent ad81a85370
commit 79ce70c1dd

View file

@ -806,7 +806,10 @@ VOID VgaConsoleRepaintScreen(PSMALL_RECT Rect)
BOOLEAN VgaConsoleInitialize(HANDLE TextHandle)
{
/* Save the default text-mode console output handle */
/*
* Initialize the console video by saving the default
* text-mode console output handle, if it is valid.
*/
if (!IsConsoleHandle(TextHandle)) return FALSE;
TextConsoleBuffer = TextHandle;
@ -814,6 +817,7 @@ BOOLEAN VgaConsoleInitialize(HANDLE TextHandle)
if (!GetConsoleCursorInfo(TextConsoleBuffer, &OrgConsoleCursorInfo) ||
!GetConsoleScreenBufferInfo(TextConsoleBuffer, &OrgConsoleBufferInfo))
{
TextConsoleBuffer = NULL;
return FALSE;
}
ConsoleInfo = OrgConsoleBufferInfo;
@ -826,8 +830,13 @@ BOOLEAN VgaConsoleInitialize(HANDLE TextHandle)
VOID VgaConsoleCleanup(VOID)
{
/* If the console video was not initialized, just return */
if (!TextConsoleBuffer)
return;
VgaDetachFromConsole();
// TODO: We need to initialize those events before using them!
CloseHandle(AnotherEvent);
CloseHandle(EndEvent);
CloseHandle(StartEvent);