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;
if (!GetConsoleCursorInfo(TextConsoleBuffer, &OrgConsoleCursorInfo) ||
!GetConsoleScreenBufferInfo(TextConsoleBuffer, &OrgConsoleBufferInfo))
{
+ TextConsoleBuffer = NULL;
return FALSE;
}
ConsoleInfo = OrgConsoleBufferInfo;
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);