diff --git a/BOOT/ENVIRON/LIB/EFI/eficon.c b/BOOT/ENVIRON/LIB/EFI/eficon.c new file mode 100644 index 0000000..1ee5415 --- /dev/null +++ b/BOOT/ENVIRON/LIB/EFI/eficon.c @@ -0,0 +1,82 @@ +/*++ + +Copyright (c) 2024, Quinn Stephens. +Provided under the BSD 3-Clause license. + +Module Name: + + eficon.c + +Abstract: + + Provides EFI console utilities. + +--*/ + +#include +#include +#include "bootmgr.h" + +extern SIMPLE_TEXT_OUTPUT_INTERFACE *EfiConOut; + +VOID +ConsolePrint ( + IN PWSTR String + ) + +/*++ + +Routine Description: + + Prints a string to the console. + +Arguments: + + String - string to print. + +Return Value: + + None. + +--*/ + +{ + EfiConOut->OutputString(EfiConOut, String); +} + +VOID +ConsolePrintf ( + IN PWSTR Format, + ... + ) + +/*++ + +Routine Description: + + Prints a formatted string to the console. + +Arguments: + + Format - format string handled by vswprintf(). + + ... - arguments. + +Return Value: + + None. + +--*/ + +{ + int Status; + va_list Args; + WCHAR Buffer[256]; + + va_start(Args, Format); + Status = vswprintf(Buffer, sizeof(Buffer) / sizeof(WCHAR) - 1, Format, Args); + va_end(Args); + if (Status > 0) { + ConsolePrint(Buffer); + } +}