From 129d62ff7563b6d162531da14bf4a5281e890719 Mon Sep 17 00:00:00 2001 From: paravoid Date: Sat, 2 Jul 2022 07:15:20 +0300 Subject: [PATCH] screenshot: Use a proper GOP instance for blt --- efigop/screenshot/efiboot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/efigop/screenshot/efiboot.c b/efigop/screenshot/efiboot.c index 08bd119..04a584b 100644 --- a/efigop/screenshot/efiboot.c +++ b/efigop/screenshot/efiboot.c @@ -1071,6 +1071,7 @@ Xscreenshot_efi() { void *pixels; UINTN picsize; EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi; + EFI_GRAPHICS_OUTPUT *second_gop = NULL; EFI_GUID fs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL; EFI_FILE_IO_INTERFACE *IOVolume; EFI_FILE_HANDLE Volume; @@ -1079,12 +1080,13 @@ Xscreenshot_efi() { UINTN nhandles; EFI_HANDLE *handles = NULL; - BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); - gopi = gop->Mode->Info; + BS->LocateHandleBuffer(ByProtocol, &gop_guid, NULL, &nhandles, &handles); + BS->HandleProtocol(handles[1], &gop_guid, (void **)&second_gop); + gopi = second_gop->Mode->Info; picsize = gopi->VerticalResolution * gopi->PixelsPerScanLine * 4; BS->AllocatePool(EfiLoaderData, picsize, &pixels); /* This, Buffer, Operation, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta (not needed here) */ - gop->Blt(gop, pixels, EfiBltVideoToBltBuffer, 0, 0, 0, 0, gopi->HorizontalResolution, gopi->VerticalResolution, 0); + second_gop->Blt(second_gop, pixels, EfiBltVideoToBltBuffer, 0, 0, 0, 0, gopi->HorizontalResolution, gopi->VerticalResolution, 0); BS->LocateHandleBuffer(ByProtocol, &fs_guid, NULL, &nhandles, &handles); BS->HandleProtocol(handles[0], &fs_guid, (void **)&IOVolume); -- 2.45.2