@@ 1068,8 1068,8 @@ Xscreenshot_efi() {
return (0);
}
- void *FrameBufferBase;
- UINTN FrameBufferSize;
+ void *pixels;
+ UINTN picsize;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *gopi;
EFI_GUID fs_guid = SIMPLE_FILE_SYSTEM_PROTOCOL;
EFI_FILE_IO_INTERFACE *IOVolume;
@@ 1081,14 1081,17 @@ Xscreenshot_efi() {
BS->LocateProtocol(&gop_guid, NULL, (void **)&gop);
gopi = gop->Mode->Info;
- FrameBufferBase = (void *)gop->Mode->FrameBufferBase;
- FrameBufferSize = gopi->VerticalResolution * gopi->PixelsPerScanLine * 4;
+ 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);
BS->LocateHandleBuffer(ByProtocol, &fs_guid, NULL, &nhandles, &handles);
BS->HandleProtocol(handles[0], &fs_guid, (void **)&IOVolume);
IOVolume->OpenVolume(IOVolume, &Volume);
Volume->Open(Volume, &FileHandle, FileName, EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
- FileHandle->Write(FileHandle, &FrameBufferSize, FrameBufferBase);
+ FileHandle->Write(FileHandle, &picsize, pixels);
FileHandle->Close(FileHandle);
+ BS->FreePool(pixels);
return (0);
}