mirror of
https://github.com/reactos/reactos.git
synced 2024-09-08 19:59:49 +00:00
[NTVDM]
Save console in/out modes and cursor shape, and restore them at cleanup. svn path=/branches/ntvdm/; revision=61543
This commit is contained in:
parent
425717c483
commit
98e367f291
|
@ -37,6 +37,8 @@ PBIOS_DATA_AREA Bda;
|
||||||
static BYTE BiosKeyboardMap[256];
|
static BYTE BiosKeyboardMap[256];
|
||||||
static HANDLE BiosConsoleInput = INVALID_HANDLE_VALUE;
|
static HANDLE BiosConsoleInput = INVALID_HANDLE_VALUE;
|
||||||
static HANDLE BiosConsoleOutput = INVALID_HANDLE_VALUE;
|
static HANDLE BiosConsoleOutput = INVALID_HANDLE_VALUE;
|
||||||
|
static DWORD BiosSavedConInMode, BiosSavedConOutMode;
|
||||||
|
static CONSOLE_CURSOR_INFO BiosSavedCursorInfo;
|
||||||
static CONSOLE_SCREEN_BUFFER_INFO BiosSavedBufferInfo;
|
static CONSOLE_SCREEN_BUFFER_INFO BiosSavedBufferInfo;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1879,8 +1881,18 @@ BOOLEAN BiosInitialize(VOID)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the original console screen buffer information */
|
/* Save the original input and output console modes */
|
||||||
if (!GetConsoleScreenBufferInfo(BiosConsoleOutput, &BiosSavedBufferInfo))
|
if (!GetConsoleMode(BiosConsoleInput , &BiosSavedConInMode ) ||
|
||||||
|
!GetConsoleMode(BiosConsoleOutput, &BiosSavedConOutMode))
|
||||||
|
{
|
||||||
|
CloseHandle(BiosConsoleOutput);
|
||||||
|
CloseHandle(BiosConsoleInput);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save the original cursor and console screen buffer information */
|
||||||
|
if (!GetConsoleCursorInfo(BiosConsoleOutput, &BiosSavedCursorInfo) ||
|
||||||
|
!GetConsoleScreenBufferInfo(BiosConsoleOutput, &BiosSavedBufferInfo))
|
||||||
{
|
{
|
||||||
CloseHandle(BiosConsoleOutput);
|
CloseHandle(BiosConsoleOutput);
|
||||||
CloseHandle(BiosConsoleInput);
|
CloseHandle(BiosConsoleInput);
|
||||||
|
@ -1901,7 +1913,7 @@ BOOLEAN BiosInitialize(VOID)
|
||||||
/* Copy console data into VGA memory */
|
/* Copy console data into VGA memory */
|
||||||
BiosCopyTextConsoleToVgaMemory();
|
BiosCopyTextConsoleToVgaMemory();
|
||||||
|
|
||||||
/* Update the cursor position for the current page (page 0) */
|
/* Update the cursor position for the current page */
|
||||||
GetConsoleScreenBufferInfo(BiosConsoleOutput, &ConsoleInfo);
|
GetConsoleScreenBufferInfo(BiosConsoleOutput, &ConsoleInfo);
|
||||||
BiosSetCursorPosition(ConsoleInfo.dwCursorPosition.Y,
|
BiosSetCursorPosition(ConsoleInfo.dwCursorPosition.Y,
|
||||||
ConsoleInfo.dwCursorPosition.X,
|
ConsoleInfo.dwCursorPosition.X,
|
||||||
|
@ -1964,6 +1976,13 @@ VOID BiosCleanup(VOID)
|
||||||
// SetConsoleWindowInfo(BiosConsoleOutput, TRUE, &BiosSavedBufferInfo.srWindow);
|
// SetConsoleWindowInfo(BiosConsoleOutput, TRUE, &BiosSavedBufferInfo.srWindow);
|
||||||
SetConsoleScreenBufferSize(BiosConsoleOutput, BiosSavedBufferInfo.dwSize);
|
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 */
|
/* Close the console handles */
|
||||||
if (BiosConsoleOutput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleOutput);
|
if (BiosConsoleOutput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleOutput);
|
||||||
if (BiosConsoleInput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleInput);
|
if (BiosConsoleInput != INVALID_HANDLE_VALUE) CloseHandle(BiosConsoleInput);
|
||||||
|
|
Loading…
Reference in a new issue