Author: hbelusca
Date: Sun Jan 5 22:21:57 2014
New Revision: 61543
URL:
http://svn.reactos.org/svn/reactos?rev=61543&view=rev
Log:
[NTVDM]
Save console in/out modes and cursor shape, and restore them at cleanup.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.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 Jan 5 22:21:57 2014
@@ -37,6 +37,8 @@
static BYTE BiosKeyboardMap[256];
static HANDLE BiosConsoleInput = INVALID_HANDLE_VALUE;
static HANDLE BiosConsoleOutput = INVALID_HANDLE_VALUE;
+static DWORD BiosSavedConInMode, BiosSavedConOutMode;
+static CONSOLE_CURSOR_INFO BiosSavedCursorInfo;
static CONSOLE_SCREEN_BUFFER_INFO BiosSavedBufferInfo;
/*
@@ -1879,29 +1881,39 @@
return FALSE;
}
- /* Save the original console screen buffer information */
- if (!GetConsoleScreenBufferInfo(BiosConsoleOutput, &BiosSavedBufferInfo))
+ /* Save the original input and output console modes */
+ if (!GetConsoleMode(BiosConsoleInput , &BiosSavedConInMode ) ||
+ !GetConsoleMode(BiosConsoleOutput, &BiosSavedConOutMode))
{
CloseHandle(BiosConsoleOutput);
CloseHandle(BiosConsoleInput);
return FALSE;
}
- /* Initialize VGA */
- if (!VgaInitialize(BiosConsoleOutput))
+ /* Save the original cursor and console screen buffer information */
+ if (!GetConsoleCursorInfo(BiosConsoleOutput, &BiosSavedCursorInfo) ||
+ !GetConsoleScreenBufferInfo(BiosConsoleOutput, &BiosSavedBufferInfo))
{
CloseHandle(BiosConsoleOutput);
CloseHandle(BiosConsoleInput);
return FALSE;
}
+ /* Initialize VGA */
+ if (!VgaInitialize(BiosConsoleOutput))
+ {
+ CloseHandle(BiosConsoleOutput);
+ CloseHandle(BiosConsoleInput);
+ return FALSE;
+ }
+
/* Set the default video mode */
BiosSetVideoMode(BIOS_DEFAULT_VIDEO_MODE);
/* Copy console data into VGA memory */
BiosCopyTextConsoleToVgaMemory();
- /* Update the cursor position for the current page (page 0) */
+ /* Update the cursor position for the current page */
GetConsoleScreenBufferInfo(BiosConsoleOutput, &ConsoleInfo);
BiosSetCursorPosition(ConsoleInfo.dwCursorPosition.Y,
ConsoleInfo.dwCursorPosition.X,
@@ -1963,6 +1975,13 @@
SetConsoleWindowInfo(BiosConsoleOutput, TRUE, &ConRect);
// SetConsoleWindowInfo(BiosConsoleOutput, TRUE, &BiosSavedBufferInfo.srWindow);
SetConsoleScreenBufferSize(BiosConsoleOutput, BiosSavedBufferInfo.dwSize);
+
+ /* Restore the original cursor shape */
+ SetConsoleCursorInfo(BiosConsoleOutput, &BiosSavedCursorInfo);
+
+ /* Restore the original input and output console modes */
+ SetConsoleMode(BiosConsoleOutput, BiosSavedConOutMode);
+ SetConsoleMode(BiosConsoleInput , BiosSavedConInMode );
/* Close the console handles */
if (BiosConsoleOutput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleOutput);