You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

4 years ago
#include "BootMgfw.h"
#include "SplashScreen.h"
4 years ago
4 years ago
CHAR8* gEfiCallerBaseName = "Voyager 1";
4 years ago
const UINT32 _gUefiDriverRevision = 0x200;
4 years ago
EFI_STATUS EFIAPI UefiUnload(EFI_HANDLE ImageHandle)
{
return EFI_SUCCESS;
}
4 years ago
4 years ago
EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable)
4 years ago
{
EFI_STATUS Result;
4 years ago
EFI_HANDLE BootMgfwHandle;
gST->ConOut->ClearScreen(gST->ConOut);
gST->ConOut->OutputString(gST->ConOut, AsciiArt);
Print(L"\n");
4 years ago
// since we replaced bootmgfw on disk, we are going to need to restore the image back
// this is simply just moving bootmgfw.efi.backup to bootmgfw.efi...
if (EFI_ERROR((Result = RestoreBootMgfw())))
4 years ago
{
Print(L"unable to restore bootmgfw... reason -> %r\n", Result);
4 years ago
gBS->Stall(5 * 1000000);
return Result;
4 years ago
}
4 years ago
// the payload is sitting on disk... we are going to load it into memory...
if (EFI_ERROR((Result = LoadPayLoadFromDisk(&PayLoad))))
{
Print(L"failed to read payload from disk... reason -> %r\n", Result);
gBS->Stall(5 * 1000000);
return Result;
}
EFI_DEVICE_PATH* BootMgfwPath = GetBootMgfwPath();
if (EFI_ERROR((Result = gBS->LoadImage(TRUE, ImageHandle, BootMgfwPath, NULL, NULL, &BootMgfwHandle))))
{
Print(L"failed to load bootmgfw.efi... reason -> %r\n", Result);
4 years ago
gBS->Stall(5 * 1000000);
return EFI_ABORTED;
}
if (EFI_ERROR((Result = InstallBootMgfwHooks(BootMgfwHandle))))
4 years ago
{
Print(L"Failed to install bootmgfw hooks... reason -> %r\n", Result);
4 years ago
gBS->Stall(5 * 1000000);
return Result;
4 years ago
}
if (EFI_ERROR((Result = gBS->StartImage(BootMgfwHandle, NULL, NULL))))
4 years ago
{
Print(L"Failed to start bootmgfw.efi... reason -> %r\n", Result);
4 years ago
gBS->Stall(5 * 1000000);
return EFI_ABORTED;
}
gBS->Stall(5 * 1000000);
4 years ago
return EFI_SUCCESS;
}