--- truecrypt/boot/windows/bootconsoleio.cpp 2018/04/24 16:55:22 1.1.1.5 +++ truecrypt/boot/windows/bootconsoleio.cpp 2018/04/24 17:09:44 1.1.1.10 @@ -1,15 +1,16 @@ /* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. - Governed by the TrueCrypt License 2.5 the full text of which is contained - in the file License.txt included in TrueCrypt binary and source code - distribution packages. + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. */ #include "Platform.h" #include "Bios.h" #include "BootConsoleIo.h" #include "BootDebug.h" +#include "BootStrings.h" static int ScreenOutputDisabled = 0; @@ -45,8 +46,11 @@ void PrintChar (char c) } -void PrintCharAtCusor (char c) +void PrintCharAtCursor (char c) { + if (ScreenOutputDisabled) + return; + __asm { mov bx, 7 @@ -72,10 +76,10 @@ void Print (uint32 number) int pos = 0; while (number >= 10) { - str[pos++] = (number % 10) + '0'; + str[pos++] = (char) (number % 10) + '0'; number /= 10; } - str[pos] = (number % 10) + '0'; + str[pos] = (char) (number % 10) + '0'; while (pos >= 0) PrintChar (str[pos--]); @@ -146,6 +150,9 @@ void Beep () void InitVideoMode () { + if (ScreenOutputDisabled) + return; + __asm { // Text mode 80x25 @@ -161,6 +168,9 @@ void InitVideoMode () void ClearScreen () { + if (ScreenOutputDisabled) + return; + __asm { // White text on black @@ -182,20 +192,24 @@ void ClearScreen () void PrintBackspace () { PrintChar (TC_BIOS_CHAR_BACKSPACE); - PrintCharAtCusor (' '); + PrintCharAtCursor (' '); } -void PrintError (const char *message, bool beep, bool newLine) +void PrintError (const char *message) { - Print ("Error: "); + Print (TC_BOOT_STR_ERROR); Print (message); - - if (newLine) - PrintEndl(); + PrintEndl(); + Beep(); +} + - if (beep) - Beep(); +void PrintErrorNoEndl (const char *message) +{ + Print (TC_BOOT_STR_ERROR); + Print (message); + Beep(); } @@ -213,9 +227,15 @@ byte GetShiftFlags () } +byte GetKeyboardChar () +{ + return GetKeyboardChar (nullptr); +} + + byte GetKeyboardChar (byte *scanCode) { - // Work around a bug in the Apple BIOS + // Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer) while (!IsKeyboardCharAvailable()); byte asciiCode;