[BOOT:LIB] Implement ConsolePrintf()

This commit is contained in:
Quinn Stephens 2024-08-24 16:34:59 -04:00
parent b870d5a015
commit 77d2f84e97

View File

@ -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 <stdarg.h>
#include <wchar.h>
#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);
}
}