diff options
| author | Matthew Garrett <mjg@redhat.com> | 2012-10-11 09:55:14 -0400 |
|---|---|---|
| committer | Matthew Garrett <mjg@redhat.com> | 2012-10-11 09:55:14 -0400 |
| commit | e204505d2dbd0fba8107c18f4eb8bdafc089fbd4 (patch) | |
| tree | 6a51ddf5f82a7d8da07791f351e1a50377b8c052 | |
| parent | 5f292f8f91e3bff20534677a30efb82d3dc9016f (diff) | |
| download | efi-boot-shim-e204505d2dbd0fba8107c18f4eb8bdafc089fbd4.tar.gz efi-boot-shim-e204505d2dbd0fba8107c18f4eb8bdafc089fbd4.zip | |
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.
| -rw-r--r-- | MokManager.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/MokManager.c b/MokManager.c index bc954d53..4b3b0a5a 100644 --- a/MokManager.c +++ b/MokManager.c @@ -7,6 +7,10 @@ #define PASSWORD_MAX 16 #define PASSWORD_MIN 8 +#ifndef SHIM_VENDOR +#define SHIM_VENDOR L"Shim" +#endif + struct menu_item { CHAR16 *text; INTN (* callback)(void *data, void *data2); @@ -604,11 +608,16 @@ static INTN mok_deletion_prompt (void *MokNew, void *data2) { return 0; } -static void draw_menu (struct menu_item *items, UINTN count) { +static UINTN draw_menu (struct menu_item *items, UINTN count) { UINTN i; 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++) { uefi_call_wrapper(ST->ConOut->SetAttribute, 2, ST->ConOut, 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->EnableCursor, 2, ST->ConOut, TRUE); + + return 2; } 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) { - UINTN index, pos = 0, wait = 0; + UINTN index, pos = 0, wait = 0, offset; EFI_INPUT_KEY key; EFI_STATUS status; @@ -643,7 +654,7 @@ static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) { while (1) { 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, ST->ConOut, @@ -651,7 +662,7 @@ static void run_menu (struct menu_item *items, UINTN count, UINTN timeout) { if (timeout) { uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, - ST->ConOut, 0, count + 1); + ST->ConOut, 0, count + 1 + offset); if (timeout > 1) Print(L"Booting in %d seconds\n", timeout); 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, - 0, pos); + 0, pos + offset); status = WaitForSingleEvent(ST->ConIn->WaitForKey, wait); if (status == EFI_TIMEOUT) { |
