From 314aecf89318d31697a3fabf14cf49a0dc359331 Mon Sep 17 00:00:00 2001 From: Lauri Kenttä Date: Sat, 2 Dec 2023 20:27:07 +0200 Subject: Discard load-options that start with WINDOWS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows bcdedit.exe creates boot entries where load options begin with "WINDOWS\0" (in 8-bit chars), followed by some Windows-specific data which is useless for shim. This data causes shim error "Failed to open \EFI\mypath\䥗䑎坏S". Resolves: #370 Signed-off-by: Lauri Kenttä --- load-options.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/load-options.c b/load-options.c index 8b92e37f..84fcfb7e 100644 --- a/load-options.c +++ b/load-options.c @@ -442,6 +442,14 @@ parse_load_options(EFI_LOADED_IMAGE *li) } } + /* + * Windows bcdedit.exe puts "WINDOWS\0" (in 8-bit) in the beginning of + * the options, so if we see that, we know it's not useful to us. + */ + if (li->LoadOptionsSize >= 8) + if (CompareMem(li->LoadOptions, "WINDOWS", 8) == 0) + return EFI_SUCCESS; + loader_str = split_load_options(li->LoadOptions, li->LoadOptionsSize, &remaining, &remaining_size); -- cgit v1.2.3