Author: hbelusca
Date: Tue Jul 26 19:57:40 2016
New Revision: 72007
URL:
http://svn.reactos.org/svn/reactos?rev=72007&view=rev
Log:
[NTVDM]: Don't attempt to deinitialize the video console if it wasn't previously
initialized.
CORE-10182 #resolve
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/console/video.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/console/video.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/cons…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/console/video.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/console/video.c [iso-8859-1] Tue Jul 26 19:57:40
2016
@@ -806,7 +806,10 @@
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 @@
if (!GetConsoleCursorInfo(TextConsoleBuffer, &OrgConsoleCursorInfo) ||
!GetConsoleScreenBufferInfo(TextConsoleBuffer, &OrgConsoleBufferInfo))
{
+ TextConsoleBuffer = NULL;
return FALSE;
}
ConsoleInfo = OrgConsoleBufferInfo;
@@ -826,8 +830,13 @@
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);