[BOOT:LIB] Implement ConsolePrintf()
This commit is contained in:
parent
b870d5a015
commit
77d2f84e97
82
BOOT/ENVIRON/LIB/EFI/eficon.c
Normal file
82
BOOT/ENVIRON/LIB/EFI/eficon.c
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user