mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-07-29 21:57:14 +00:00
Add menu header
Add a basic header to the menu to make it clearer what's going on. Define SHIM_VENDOR in order to override the default.
This commit is contained in:
parent
f031aeca57
commit
c48993f8b0
21
MokManager.c
21
MokManager.c
@ -7,6 +7,10 @@
|
|||||||
#define PASSWORD_MAX 16
|
#define PASSWORD_MAX 16
|
||||||
#define PASSWORD_MIN 8
|
#define PASSWORD_MIN 8
|
||||||
|
|
||||||
|
#ifndef SHIM_VENDOR
|
||||||
|
#define SHIM_VENDOR L"Shim"
|
||||||
|
#endif
|
||||||
|
|
||||||
struct menu_item {
|
struct menu_item {
|
||||||
CHAR16 *text;
|
CHAR16 *text;
|
||||||
INTN (* callback)(void *data, void *data2);
|
INTN (* callback)(void *data, void *data2);
|
||||||
@ -604,11 +608,16 @@ static INTN mok_deletion_prompt (void *MokNew, void *data2) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_menu (struct menu_item *items, UINTN count) {
|
static UINTN draw_menu (struct menu_item *items, UINTN count) {
|
||||||
UINTN i;
|
UINTN i;
|
||||||
|
|
||||||
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
|
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
|
||||||
|
|
||||||
|
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut,
|
||||||
|
EFI_WHITE | EFI_BACKGROUND_BLACK);
|
||||||
|
|
||||||
|
Print(L"%s UEFI key management\n\n", SHIM_VENDOR);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut,
|
uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut,
|
||||||
items[i].colour | EFI_BACKGROUND_BLACK);
|
items[i].colour | EFI_BACKGROUND_BLACK);
|
||||||
@ -617,6 +626,8 @@ static void draw_menu (struct menu_item *items, UINTN count) {
|
|||||||
|
|
||||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, 0);
|
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, 0);
|
||||||
uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE);
|
uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE);
|
||||||
|
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_menu (struct menu_item *items, UINTN count) {
|
static void free_menu (struct menu_item *items, UINTN count) {
|
||||||
@ -633,7 +644,7 @@ static void free_menu (struct menu_item *items, UINTN count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) {
|
static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) {
|
||||||
UINTN index, pos = 0, wait = 0;
|
UINTN index, pos = 0, wait = 0, offset;
|
||||||
EFI_INPUT_KEY key;
|
EFI_INPUT_KEY key;
|
||||||
EFI_STATUS status;
|
EFI_STATUS status;
|
||||||
|
|
||||||
@ -643,7 +654,7 @@ static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
|
uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);
|
||||||
|
|
||||||
draw_menu (items, count);
|
offset = draw_menu (items, count);
|
||||||
|
|
||||||
uefi_call_wrapper(ST->ConOut->SetAttribute, 2,
|
uefi_call_wrapper(ST->ConOut->SetAttribute, 2,
|
||||||
ST->ConOut,
|
ST->ConOut,
|
||||||
@ -651,7 +662,7 @@ static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) {
|
|||||||
|
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3,
|
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3,
|
||||||
ST->ConOut, 0, count + 1);
|
ST->ConOut, 0, count + 1 + offset);
|
||||||
if (timeout > 1)
|
if (timeout > 1)
|
||||||
Print(L"Booting in %d seconds\n", timeout);
|
Print(L"Booting in %d seconds\n", timeout);
|
||||||
else
|
else
|
||||||
@ -659,7 +670,7 @@ static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut,
|
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut,
|
||||||
0, pos);
|
0, pos + offset);
|
||||||
status = WaitForSingleEvent(ST->ConIn->WaitForKey, wait);
|
status = WaitForSingleEvent(ST->ConIn->WaitForKey, wait);
|
||||||
|
|
||||||
if (status == EFI_TIMEOUT) {
|
if (status == EFI_TIMEOUT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user