diff --git a/Changelog.md b/Changelog.md index d12c7cab..9202d9c8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -41,6 +41,7 @@ OpenCore Changelog - Added `TscSyncTimeout` quirk to workaround debug kernel assertions - Added first-class Windows support to bless model - Fixed `LapicKernelPanic` kernel quirk on 10.9 +- Added prebuilt version of `CrScreenshotDxe` driver #### v0.5.8 - Fixed invalid CPU object reference in SSDT-PLUG diff --git a/Include/Acidanthera/Protocol/OcBootstrap.h b/Include/Acidanthera/Protocol/OcBootstrap.h index 522980bd..48a0123a 100644 --- a/Include/Acidanthera/Protocol/OcBootstrap.h +++ b/Include/Acidanthera/Protocol/OcBootstrap.h @@ -30,7 +30,7 @@ /// /// OC_BOOTSTRAP_PROTOCOL revision /// -#define OC_BOOTSTRAP_PROTOCOL_REVISION 5 +#define OC_BOOTSTRAP_PROTOCOL_REVISION 6 /// /// Forward declaration of OC_BOOTSTRAP_PROTOCOL structure. @@ -55,6 +55,20 @@ EFI_STATUS IN EFI_DEVICE_PATH_PROTOCOL *LoadPath OPTIONAL ); +/** + Obtain OpenCore load handle. + + @param[in] This This protocol. + + @retval load handle on success. + @retval NULL on failure. +**/ +typedef +EFI_HANDLE +(EFIAPI *OC_GET_LOAD_HANDLE) ( + IN OC_BOOTSTRAP_PROTOCOL *This + ); + /// /// The structure exposed by the OC_BOOTSTRAP_PROTOCOL. /// @@ -63,6 +77,7 @@ struct OC_BOOTSTRAP_PROTOCOL_ { UINTN NestedCount; OC_RSA_PUBLIC_KEY *VaultKey; OC_BOOTSTRAP_RERUN ReRun; + OC_GET_LOAD_HANDLE GetLoadHandle; }; extern EFI_GUID gOcBootstrapProtocolGuid; diff --git a/OpenCorePkg.dsc b/OpenCorePkg.dsc index 4448ed87..4d8d89c9 100755 --- a/OpenCorePkg.dsc +++ b/OpenCorePkg.dsc @@ -215,6 +215,7 @@ OpenCorePkg/Library/OcUnicodeCollationEngLib/OcUnicodeCollationEngLocalLib.inf OpenCorePkg/Library/OcVirtualFsLib/OcVirtualFsLib.inf OpenCorePkg/Library/OcXmlLib/OcXmlLib.inf + OpenCorePkg/Platform/CrScreenshotDxe/CrScreenshotDxe.inf OpenCorePkg/Platform/OpenCanopy/OpenCanopy.inf OpenCorePkg/Platform/OpenCore/OpenCore.inf OpenCorePkg/Platform/OpenRuntime/OpenRuntime.inf diff --git a/Platform/CrScreenshotDxe/CrScreenshotDxe.c b/Platform/CrScreenshotDxe/CrScreenshotDxe.c new file mode 100644 index 00000000..55d99713 --- /dev/null +++ b/Platform/CrScreenshotDxe/CrScreenshotDxe.c @@ -0,0 +1,519 @@ +/* CrScreenshotDxe.c + +Copyright (c) 2016, Nikolaj Schlej, All rights reserved. + +Redistribution and use in source and binary forms, +with or without modification, are permitted provided that the following conditions are met: +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +STATIC +EFI_STATUS +EFIAPI +ShowStatus ( + IN UINT8 Red, + IN UINT8 Green, + IN UINT8 Blue + ) +{ + // + // Determines the size of status square. + // + #define STATUS_SQUARE_SIDE 5 + + EFI_STATUS Status; + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Square[STATUS_SQUARE_SIDE * STATUS_SQUARE_SIDE]; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Backup[STATUS_SQUARE_SIDE * STATUS_SQUARE_SIDE]; + UINTN Index; + + Status = OcHandleProtocolFallback ( + gST->ConsoleOutHandle, + &gEfiGraphicsOutputProtocolGuid, + (VOID **) &GraphicsOutput + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "OCSCR: Graphics output protocol not found for status - %r\n", Status)); + return EFI_UNSUPPORTED; + } + + // + // Set square color. + // + for (Index = 0; Index < STATUS_SQUARE_SIDE * STATUS_SQUARE_SIDE; ++Index) { + Square[Index].Blue = Blue; + Square[Index].Green = Green; + Square[Index].Red = Red; + Square[Index].Reserved = 0x00; + } + + // + // Backup current image. + // + GraphicsOutput->Blt ( + GraphicsOutput, + Backup, + EfiBltVideoToBltBuffer, + 0, + 0, + 0, + 0, + STATUS_SQUARE_SIDE, + STATUS_SQUARE_SIDE, + 0 + ); + + // + // Draw the status square. + // + GraphicsOutput->Blt ( + GraphicsOutput, + Square, + EfiBltBufferToVideo, + 0, + 0, + 0, + 0, + STATUS_SQUARE_SIDE, + STATUS_SQUARE_SIDE, + 0 + ); + + // + // Wait 500 ms. + // + gBS->Stall (500*1000); + + // + // Restore the backup. + // + GraphicsOutput->Blt ( + GraphicsOutput, + Backup, + EfiBltBufferToVideo, + 0, + 0, + 0, + 0, + STATUS_SQUARE_SIDE, + STATUS_SQUARE_SIDE, + 0 + ); + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +FindWritableFs ( + OUT EFI_FILE_PROTOCOL **FsPtr + ) +{ + EFI_STATUS Status; + OC_BOOTSTRAP_PROTOCOL *Bootstrap; + EFI_HANDLE PreferedHandle; + + PreferedHandle = NULL; + + Status = gBS->LocateProtocol ( + &gOcBootstrapProtocolGuid, + NULL, + (VOID **) &Bootstrap + ); + if (!EFI_ERROR (Status) && Bootstrap->Revision == OC_BOOTSTRAP_PROTOCOL_REVISION) { + PreferedHandle = Bootstrap->GetLoadHandle (Bootstrap); + } + + if (PreferedHandle != NULL) { + *FsPtr = LocateRootVolume (PreferedHandle, NULL); + } else { + *FsPtr = NULL; + } + + DEBUG ((DEBUG_INFO, "OCSCR: Preferred handle is %p found fs %p\n", PreferedHandle, *FsPtr)); + + if (*FsPtr == NULL) { + return FindWritableFileSystem(FsPtr); + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +EFIAPI +TakeScreenshot ( + IN EFI_KEY_DATA *KeyData + ) +{ + EFI_FILE_PROTOCOL *Fs; + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Image; + UINTN ImageSize; ///< Size in pixels + VOID *PngFile; + UINTN PngFileSize; ///< Size in bytes + EFI_STATUS Status; + UINT32 ScreenWidth; + UINT32 ScreenHeight; + CHAR16 FileName[16]; + EFI_TIME Time; + UINTN Index; + UINT8 Temp; + + Status = FindWritableFs (&Fs); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "OCSCR: Can't find writable FS - %r\n", Status)); + ShowStatus (0xFF, 0xFF, 0x00); ///< Yellow + return EFI_SUCCESS; + } + + Status = OcHandleProtocolFallback ( + gST->ConsoleOutHandle, + &gEfiGraphicsOutputProtocolGuid, + (VOID **) &GraphicsOutput + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "OCSCR: Graphics output protocol not found for screen - %r\n", Status)); + return EFI_SUCCESS; + } + + // + // Set screen width, height and image size in pixels. + // + ScreenWidth = GraphicsOutput->Mode->Info->HorizontalResolution; + ScreenHeight = GraphicsOutput->Mode->Info->VerticalResolution; + ImageSize = ScreenWidth * ScreenHeight; + + if (ImageSize == 0) { + DEBUG ((DEBUG_INFO, "OCSCR: Empty screen size\n")); + return EFI_SUCCESS; + } + + // + // Get current time. + // + Status = gRT->GetTime ( + &Time, + NULL + ); + if (!EFI_ERROR (Status)) { + // + // Set file name to current day and time + // + UnicodeSPrint ( + FileName, + sizeof (FileName), + L"%02d%02d%02d%02d.png", + Time.Day, + Time.Hour, + Time.Minute, + Time.Second + ); + } else { + // + // Set file name to scrnshot.png + // + StrCpyS (FileName, sizeof (FileName), L"scrnshot.png"); + } + + // + // Allocate memory for screenshot. + // + Status = gBS->AllocatePool ( + EfiBootServicesData, + ImageSize * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL), + (VOID **) &Image + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "CRSCR: gBS->AllocatePool returned %r\n", Status)); + ShowStatus (0xFF, 0x00, 0x00); ///< Red + return EFI_SUCCESS; + } + + // + // Take screenshot. + // + Status = GraphicsOutput->Blt ( + GraphicsOutput, + Image, + EfiBltVideoToBltBuffer, + 0, + 0, + 0, + 0, + ScreenWidth, + ScreenHeight, + 0 + ); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_INFO, "CRSCR: GraphicsOutput->Blt returned %r\n", Status)); + gBS->FreePool (Image); + ShowStatus (0xFF, 0x00, 0x00); ///< Red + return EFI_SUCCESS; + } + + // + // Convert BGR to RGBA with Alpha set to 0xFF. + // + for (Index = 0; Index < ImageSize; ++Index) { + Temp = Image[Index].Blue; + Image[Index].Blue = Image[Index].Red; + Image[Index].Red = Temp; + Image[Index].Reserved = 0xFF; + } + + Status = EncodePng ( + Image, + ScreenWidth, + ScreenHeight, + &PngFile, + &PngFileSize + ); + gBS->FreePool (Image); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "CRSCR: EncodePng returned %r\n", Status)); + ShowStatus (0xFF, 0x00, 0x00); ///< Red + return EFI_SUCCESS; + } + + // + // Write PNG image into the file. + // + Status = SetFileData (Fs, FileName, PngFile, (UINT32) PngFileSize); + gBS->FreePool (PngFile); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "CRSCR: EncodePng returned %r\n", Status)); + ShowStatus (0xFF, 0x00, 0x00); ///< Red + return EFI_SUCCESS; + } + + // + // Show success. + // + ShowStatus (0x00, 0xFF, 0x00); ///< Green + + return EFI_SUCCESS; +} + +STATIC +VOID +EFIAPI +AppleEventKeyHandler ( + IN APPLE_EVENT_INFORMATION *Information, + IN VOID *NotifyContext + ) +{ + // + // Mark the context argument as used. + // + (VOID) NotifyContext; + + // + // Ignore invalid information if it happened to arrive. + // + if (Information == NULL || (Information->EventType & APPLE_EVENT_TYPE_KEY_UP) == 0) { + return; + } + + // + // Apple calls ALT key by the name of OPTION key. + // + if (Information->EventData.KeyData->InputKey.ScanCode == SCAN_F12 + && Information->Modifiers == (APPLE_MODIFIER_LEFT_CONTROL | APPLE_MODIFIER_LEFT_OPTION)) { + // + // Take a screenshot + // + TakeScreenshot (NULL); + } +} + +EFI_STATUS +EFIAPI +CrScreenshotDxeEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINTN HandleCount; + EFI_HANDLE *HandleBuffer; + UINTN Index; + EFI_KEY_DATA SimpleTextInExKeyStroke; + EFI_HANDLE SimpleTextInExHandle; + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx; + APPLE_EVENT_HANDLE AppleEventHandle; + APPLE_EVENT_PROTOCOL *AppleEvent; + BOOLEAN Installed; + + Installed = FALSE; + + // + // Locate compatible protocols, firstly try SimpleTextInEx, otherwise use AppleEvent. + // + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiSimpleTextInputExProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); + if (!EFI_ERROR (Status)) { + // + // Set keystroke to be LCtrl+LAlt+F12. + // + SimpleTextInExKeyStroke.Key.ScanCode = SCAN_F12; + SimpleTextInExKeyStroke.Key.UnicodeChar = 0; + SimpleTextInExKeyStroke.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_LEFT_ALT_PRESSED; + SimpleTextInExKeyStroke.KeyState.KeyToggleState = 0; + + for (Index = 0; Index < HandleCount; ++Index) { + Status = gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiSimpleTextInputExProtocolGuid, + (VOID **) &SimpleTextInEx + ); + + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_INFO, + "CRSCR: gBS->HandleProtocol[%u] SimpleTextInputEx returned %r\n", + (UINT32) Index, + Status + )); + continue; + } + + // + // Register key notification function + // + Status = SimpleTextInEx->RegisterKeyNotify ( + SimpleTextInEx, + &SimpleTextInExKeyStroke, + TakeScreenshot, + &SimpleTextInExHandle + ); + if (!EFI_ERROR (Status)) { + Installed = TRUE; + } else { + DEBUG (( + DEBUG_INFO, + "CRSCR: SimpleTextInEx->RegisterKeyNotify[%u] returned %r\n", + (UINT32) Index, + Status + )); + } + } + + gBS->FreePool (HandleBuffer); + } else { + DEBUG (( + DEBUG_INFO, + "CRSCR: gBS->LocateHandleBuffer SimpleTextInputEx returned %r\n", + Status + )); + + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gAppleEventProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_INFO, + "CRSCR: gBS->LocateHandleBuffer AppleEvent returned %r\n", + Status + )); + return EFI_UNSUPPORTED; + } + + for (Index = 0; Index < HandleCount; ++Index) { + Status = gBS->HandleProtocol (HandleBuffer[Index], &gAppleEventProtocolGuid, (VOID **) &AppleEvent); + + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_INFO, + "CRSCR: gBS->HandleProtocol[%u] AppleEvent returned %r\n", + (UINT32) Index, + Status + )); + continue; + } + + if (AppleEvent->Revision < APPLE_EVENT_PROTOCOL_REVISION) { + DEBUG (( + DEBUG_INFO, + "CRSCR: AppleEvent[%u] has outdated revision %u, expected %u\n", + (UINT32) Index, + (UINT32) AppleEvent->Revision, + (UINT32) APPLE_EVENT_PROTOCOL_REVISION + )); + continue; + } + + // + // Register key handler, which will later determine LCtrl+LAlt+F12 combination + // + Status = AppleEvent->RegisterHandler ( + APPLE_EVENT_TYPE_KEY_UP, + AppleEventKeyHandler, + &AppleEventHandle, + NULL + ); + if (!EFI_ERROR (Status)) { + Installed = TRUE; + } else { + DEBUG (( + DEBUG_INFO, + "CRSCR: AppleEvent->RegisterHandler[%u] returned %r\n", + (UINT32) Index, + Status + )); + } + } + + gBS->FreePool (HandleBuffer); + } + + // + // Show success only when we found at least one working implementation + // + if (Installed) { + ShowStatus (0xFF, 0xFF, 0xFF); //White + } + + return EFI_SUCCESS; +} diff --git a/Platform/CrScreenshotDxe/CrScreenshotDxe.inf b/Platform/CrScreenshotDxe/CrScreenshotDxe.inf new file mode 100644 index 00000000..ba6dbf9b --- /dev/null +++ b/Platform/CrScreenshotDxe/CrScreenshotDxe.inf @@ -0,0 +1,39 @@ +## @file +# Copyright (c) 2020, vit9696. All rights reserved. +# SPDX-License-Identifier: BSD-3-Clause +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = CrScreenshotDxe + FILE_GUID = 91867CFC-F80C-4BC4-94CC-E9E3ED88BC84 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = CrScreenshotDxeEntry + +[Sources.common] + CrScreenshotDxe.c + +[Packages] + OpenCorePkg/OpenCorePkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + UefiDriverEntryPoint + DebugLib + PrintLib + OcPngLib + OcFileLib + +[Protocols] + gEfiGraphicsOutputProtocolGuid + gEfiSimpleTextInputExProtocolGuid + gAppleEventProtocolGuid + gEfiSimpleFileSystemProtocolGuid + gOcBootstrapProtocolGuid + +[Depex] + gEfiGraphicsOutputProtocolGuid diff --git a/Platform/CrScreenshotDxe/LICENSE b/Platform/CrScreenshotDxe/LICENSE new file mode 100644 index 00000000..6023850e --- /dev/null +++ b/Platform/CrScreenshotDxe/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2016, Nikolaj Schlej +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/Platform/CrScreenshotDxe/README.md b/Platform/CrScreenshotDxe/README.md new file mode 100644 index 00000000..558a6a4f --- /dev/null +++ b/Platform/CrScreenshotDxe/README.md @@ -0,0 +1,30 @@ +# CrScreenshotDxe +UEFI DXE driver to take screenshots from GOP-compatible graphic consoles. + +[This blog post in Russian](http://habrahabr.ru/post/274463/) explains more, here is just a description and usage. + +## Description +This DXE driver tries to register keyboard shortcut (LCtrl + LAlt + F12) handler for all text input devices. The handler tries to find a writable FS, enumerates all GOP-capable video devices, takes screenshots from them and saves the result as PNG files on that writable FS. + +The main goal is to be able to make BIOS Setup screenshots for systems without serial console redirection support, but it can also be used to take screenshot from UEFI shell, UEFI apps and UEFI bootloaders. + +To start the driver, you can either: +- Integrate it into DXE volume of your UEFI firmware using [UEFITool](https://github.com/LongSoft/UEFITool) or any other suitable software (don't forget a DepEx section to prevent too early start) +- Add it to an OptionROM of a PCIe device (will try it once I have a device needed) +- Let BDS dispatcher load it by copying it to ESP and creating a DriverXXXX variable +- Load it from UEFI Shell with load command + +## Build +It's a normal EDK2-compatible DXE driver, just add it to your package's DSC file to include in the build process. + +## Usage +Load the driver, insert FAT32-formatted USB drive and press LCtrl + LAlt + F12 to take screenshots from all GOP-compatible graphic consoles available at the moment. + +To indicate it's status, the driver shows a small colored rectangle in top-left corner of the screen for half a second. + +Rectangle color codes: +- White - driver is loaded +- Yellow - no writable FS found, screenshot is not taken +- Blue - current GOP is pitch black, screenshot is not taken +- Red - something went wrong, screenshot is not taken +- Green - screnshot taken and saved to PNG file diff --git a/Platform/OpenCore/OpenCore.c b/Platform/OpenCore/OpenCore.c index f824d3b5..faf31a98 100644 --- a/Platform/OpenCore/OpenCore.c +++ b/Platform/OpenCore/OpenCore.c @@ -59,6 +59,10 @@ STATIC OC_PRIVILEGE_CONTEXT mOpenCorePrivilege; +STATIC +EFI_HANDLE +mLoadHandle; + STATIC EFI_STATUS EFIAPI @@ -97,7 +101,6 @@ OcMain ( ) { EFI_STATUS Status; - EFI_HANDLE LoadHandle; OC_PRIVILEGE_CONTEXT *Privilege; DEBUG ((DEBUG_INFO, "OC: OcMiscEarlyInit...\n")); @@ -124,7 +127,7 @@ OcMain ( DEBUG ((DEBUG_INFO, "OC: OcLoadDevPropsSupport...\n")); OcLoadDevPropsSupport (&mOpenCoreConfiguration); DEBUG ((DEBUG_INFO, "OC: OcMiscLateInit...\n")); - OcMiscLateInit (Storage, &mOpenCoreConfiguration, LoadPath, &LoadHandle); + OcMiscLateInit (Storage, &mOpenCoreConfiguration, LoadPath, &mLoadHandle); DEBUG ((DEBUG_INFO, "OC: OcLoadKernelSupport...\n")); OcLoadKernelSupport (&mOpenCoreStorage, &mOpenCoreConfiguration, &mOpenCoreCpuInfo); @@ -147,7 +150,7 @@ OcMain ( Privilege, OcStartImage, mOpenCoreConfiguration.Uefi.Quirks.RequestBootVarRouting, - LoadHandle + mLoadHandle ); } @@ -195,13 +198,24 @@ OcBootstrapRerun ( return Status; } +STATIC +EFI_HANDLE +EFIAPI +OcGetLoadHandle ( + IN OC_BOOTSTRAP_PROTOCOL *This + ) +{ + return mLoadHandle; +} + STATIC OC_BOOTSTRAP_PROTOCOL mOpenCoreBootStrap = { - .Revision = OC_BOOTSTRAP_PROTOCOL_REVISION, - .NestedCount = 0, - .VaultKey = NULL, - .ReRun = OcBootstrapRerun + .Revision = OC_BOOTSTRAP_PROTOCOL_REVISION, + .NestedCount = 0, + .VaultKey = NULL, + .ReRun = OcBootstrapRerun, + .GetLoadHandle = OcGetLoadHandle, }; EFI_STATUS diff --git a/build_oc.tool b/build_oc.tool index d5ec946c..89e86603 100755 --- a/build_oc.tool +++ b/build_oc.tool @@ -72,6 +72,7 @@ package() { cp RtcRw.efi tmp/EFI/OC/Tools || exit 1 cp NvmExpressDxe.efi tmp/EFI/OC/Drivers/ || exit 1 cp AudioDxe.efi tmp/EFI/OC/Drivers/ || exit 1 + cp CrScreenshotDxe.efi tmp/EFI/OC/Drivers/ || exit 1 cp OpenCanopy.efi tmp/EFI/OC/Drivers/ || exit 1 cp OpenControl.efi tmp/EFI/OC/Tools/ || exit 1 cp OpenCore.efi tmp/EFI/OC/ || exit 1