Skip to content

Commit

Permalink
Discard load-options that start with WINDOWS
Browse files Browse the repository at this point in the history
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ä <[email protected]>
  • Loading branch information
Metabolix authored and vathpela committed Dec 17, 2024
1 parent fd7e16f commit 314aecf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions load-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 314aecf

Please sign in to comment.