Loop through graphics output protocol handles and check each one
This commit is contained in:
parent
617f4de515
commit
1e7cd64f0f
33
main.c
33
main.c
@ -22,6 +22,29 @@ static void write_uint(uint32_t n)
|
||||
write_string(&s[11u - i]);
|
||||
}
|
||||
|
||||
static void check_handle(EFI_HANDLE handle)
|
||||
{
|
||||
EFI_HANDLE interface = NULL;
|
||||
EFI_STATUS status = g_system_table->BootServices->HandleProtocol(handle,
|
||||
&(EFI_GUID)EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID,
|
||||
&interface);
|
||||
if (EFI_ERROR(status))
|
||||
{
|
||||
write_string(L"Error ");
|
||||
write_uint(status);
|
||||
write_string(L" from HandleProtocol\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (interface == NULL)
|
||||
{
|
||||
write_string(L"NULL interface from HandleProtocol\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop = (EFI_GRAPHICS_OUTPUT_PROTOCOL *)interface;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
||||
{
|
||||
@ -31,8 +54,6 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
||||
g_system_table = system_table;
|
||||
|
||||
write_string(L"My first EFI loader\r\n");
|
||||
if (EFI_ERROR(status))
|
||||
return status;
|
||||
|
||||
status = system_table->ConIn->Reset(system_table->ConIn, FALSE);
|
||||
if (EFI_ERROR(status))
|
||||
@ -45,12 +66,18 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
||||
NULL,
|
||||
&buffer_size,
|
||||
buffer);
|
||||
buffer_size /= sizeof(EFI_HANDLE);
|
||||
write_string(L"status = ");
|
||||
write_uint(status);
|
||||
write_string(L", num entries = ");
|
||||
write_uint(buffer_size / sizeof(EFI_HANDLE));
|
||||
write_uint(buffer_size);
|
||||
write_string(L"\r\n");
|
||||
|
||||
for (size_t i = 0u; i < buffer_size; i++)
|
||||
{
|
||||
check_handle(buffer[i]);
|
||||
}
|
||||
|
||||
write_string(L"Press any key...\r\n");
|
||||
while ((status = system_table->ConIn->ReadKeyStroke(system_table->ConIn, &key)) == EFI_NOT_READY)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user