2020-02-29 08:30:21 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020 Jief
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* * Neither the name of Christoph Pfisterer nor the names of the
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* OWNER 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __menu_items_H__
|
|
|
|
#define __menu_items_H__
|
|
|
|
|
|
|
|
|
2020-03-28 16:14:18 +01:00
|
|
|
#include "../../libeg/libeg.h"
|
2020-03-02 13:00:24 +01:00
|
|
|
#include "../../refit/lib.h"
|
2020-05-01 18:26:28 +02:00
|
|
|
#include "../../Platform/LoaderUefi.h"
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
#include "../../cpp_foundation/XObjArray.h"
|
2020-04-26 12:12:05 +02:00
|
|
|
#include "../../cpp_foundation/XStringArray.h"
|
2020-04-05 14:25:39 +02:00
|
|
|
#include "../../cpp_foundation/XString.h"
|
2020-03-02 13:00:24 +01:00
|
|
|
#include "../../libeg/XPointer.h"
|
2020-05-01 18:26:28 +02:00
|
|
|
|
2020-03-03 21:44:07 +01:00
|
|
|
|
2020-02-29 08:30:21 +01:00
|
|
|
//
|
|
|
|
//#define REFIT_DEBUG (2)
|
|
|
|
//#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
|
|
|
|
////#include "GenericBdsLib.h"
|
|
|
|
|
|
|
|
|
|
|
|
//#define TAG_ABOUT_OLD (1)
|
|
|
|
//#define TAG_RESET_OLD (2)
|
|
|
|
//#define TAG_SHUTDOWN_OLD (3)
|
|
|
|
//#define TAG_TOOL_OLD (4)
|
|
|
|
////#define TAG_LOADER (5)
|
|
|
|
////#define TAG_LEGACY (6)
|
|
|
|
//#define TAG_INFO_OLD (7)
|
|
|
|
//#define TAG_OPTIONS (8)
|
|
|
|
//#define TAG_INPUT_OLD (9)
|
|
|
|
//#define TAG_HELP_OLD (10) // wasn't used ?
|
|
|
|
//#define TAG_SWITCH_OLD (11)
|
|
|
|
//#define TAG_CHECKBIT_OLD (12)
|
|
|
|
//#define TAG_SECURE_BOOT_OLD (13)
|
|
|
|
//#define TAG_SECURE_BOOT_CONFIG_OLD (14)
|
|
|
|
//#define TAG_CLOVER_OLD (100)
|
|
|
|
//#define TAG_EXIT_OLD (101)
|
|
|
|
//#define TAG_RETURN_OLD ((UINTN)(-1))
|
|
|
|
|
|
|
|
//typedef struct _refit_menu_screen REFIT_MENU_SCREEN;
|
|
|
|
class REFIT_MENU_SCREEN;
|
|
|
|
class REFIT_MENU_SWITCH;
|
|
|
|
class REFIT_MENU_CHECKBIT;
|
|
|
|
class REFIT_MENU_ENTRY_CLOVER;
|
|
|
|
class REFIT_MENU_ITEM_RETURN;
|
|
|
|
class REFIT_INPUT_DIALOG;
|
|
|
|
class REFIT_INFO_DIALOG;
|
|
|
|
class REFIT_MENU_ENTRY_LOADER_TOOL;
|
|
|
|
class REFIT_MENU_ITEM_SHUTDOWN;
|
|
|
|
class REFIT_MENU_ITEM_RESET;
|
|
|
|
class REFIT_MENU_ITEM_ABOUT;
|
|
|
|
class REFIT_MENU_ITEM_OPTIONS;
|
2020-02-29 13:56:36 +01:00
|
|
|
class REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER;
|
2020-02-29 08:30:21 +01:00
|
|
|
class LOADER_ENTRY;
|
|
|
|
class LEGACY_ENTRY;
|
|
|
|
class REFIT_MENU_ENTRY_OTHER;
|
|
|
|
class REFIT_SIMPLE_MENU_ENTRY_TAG;
|
2020-03-10 10:45:17 +01:00
|
|
|
class REFIT_MENU_ENTRY_ITEM_ABSTRACT;
|
|
|
|
class REFIT_MENU_ITEM_BOOTNUM;
|
2020-03-02 13:00:24 +01:00
|
|
|
class XPointer;
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
/********************************************************** REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
|
|
|
|
|
2020-02-29 08:30:21 +01:00
|
|
|
class REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
2020-03-10 12:51:04 +01:00
|
|
|
XStringW Title;
|
2020-02-29 08:30:21 +01:00
|
|
|
UINTN Row;
|
|
|
|
CHAR16 ShortcutDigit;
|
|
|
|
CHAR16 ShortcutLetter;
|
2020-03-24 16:17:12 +01:00
|
|
|
XImage Image;
|
2020-02-29 08:30:21 +01:00
|
|
|
EG_RECT Place;
|
|
|
|
ACTION AtClick;
|
|
|
|
ACTION AtDoubleClick;
|
|
|
|
ACTION AtRightClick;
|
|
|
|
ACTION AtMouseOver;
|
|
|
|
REFIT_MENU_SCREEN *SubScreen;
|
|
|
|
|
2020-04-03 22:00:42 +02:00
|
|
|
virtual XImage* getDriveImage() { return nullptr; };
|
|
|
|
virtual XImage* getBadgeImage() { return nullptr; };
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-02-29 13:56:36 +01:00
|
|
|
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return nullptr; };
|
2020-02-29 08:30:21 +01:00
|
|
|
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return nullptr; };
|
|
|
|
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return nullptr; };
|
|
|
|
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return nullptr; };
|
2020-02-29 13:56:36 +01:00
|
|
|
virtual REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER* getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() { return nullptr; };
|
2020-02-29 08:30:21 +01:00
|
|
|
virtual LOADER_ENTRY* getLOADER_ENTRY() { return nullptr; };
|
|
|
|
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ENTRY_OTHER* getREFIT_MENU_ENTRY_OTHER() { return nullptr; };
|
2020-03-10 10:45:17 +01:00
|
|
|
virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return nullptr; };
|
|
|
|
virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return nullptr; };
|
2020-05-01 18:26:28 +02:00
|
|
|
virtual void StartLoader() {};
|
|
|
|
virtual void StartLegacy() {};
|
|
|
|
virtual void StartTool() {};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-04-03 22:00:42 +02:00
|
|
|
REFIT_ABSTRACT_MENU_ENTRY() : Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
|
|
|
{};
|
|
|
|
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
|
|
|
{};
|
|
|
|
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
|
|
|
{};
|
|
|
|
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
|
|
|
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_), Image(), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
|
|
|
{};
|
|
|
|
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, UINTN Row_,
|
|
|
|
CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, const XImage& Image_,
|
|
|
|
EG_RECT Place_, ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
|
|
|
|
REFIT_MENU_SCREEN *SubScreen_)
|
|
|
|
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_),
|
|
|
|
Image(Image_), Place(Place_),
|
|
|
|
AtClick(AtClick_), AtDoubleClick(AtDoubleClick_), AtRightClick(AtRightClick_), AtMouseOver(AtMouseOver_),
|
|
|
|
SubScreen(SubScreen_) {};
|
|
|
|
|
2020-02-29 08:30:21 +01:00
|
|
|
virtual ~REFIT_ABSTRACT_MENU_ENTRY() {}; // virtual destructor : this is vital
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
/********************************************************** REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
|
|
|
|
|
|
|
|
class REFIT_SIMPLE_MENU_ENTRY_TAG : public REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UINTN Tag;
|
|
|
|
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_SIMPLE_MENU_ENTRY_TAG(const XStringW& Title_, UINTN Tag_, ACTION AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, AtClick_), Tag(Tag_)
|
|
|
|
{};
|
|
|
|
|
|
|
|
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************** Simple entries. Inherit from REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
|
|
|
|
|
|
|
|
class REFIT_MENU_ITEM_RETURN : public REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
2020-03-10 11:27:05 +01:00
|
|
|
REFIT_MENU_ITEM_RETURN() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_MENU_ITEM_RETURN(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
2020-03-10 11:27:05 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
{};
|
|
|
|
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
2020-03-10 11:27:05 +01:00
|
|
|
REFIT_MENU_ITEM_SHUTDOWN() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_MENU_ITEM_SHUTDOWN(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
2020-03-10 11:27:05 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
{};
|
|
|
|
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_ITEM_RESET : public REFIT_ABSTRACT_MENU_ENTRY {
|
|
|
|
public:
|
2020-03-10 11:27:05 +01:00
|
|
|
REFIT_MENU_ITEM_RESET() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_MENU_ITEM_RESET(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
2020-03-10 11:27:05 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
{};
|
|
|
|
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_ITEM_ABOUT : public REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
2020-03-10 11:27:05 +01:00
|
|
|
REFIT_MENU_ITEM_ABOUT() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_MENU_ITEM_ABOUT(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
2020-03-10 11:27:05 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
{};
|
|
|
|
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_ITEM_OPTIONS : public REFIT_ABSTRACT_MENU_ENTRY {
|
|
|
|
public:
|
|
|
|
REFIT_MENU_ITEM_OPTIONS() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
2020-03-10 17:50:55 +01:00
|
|
|
REFIT_MENU_ITEM_OPTIONS(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
2020-03-10 11:27:05 +01:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
2020-03-10 10:45:17 +01:00
|
|
|
{};
|
|
|
|
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class REFIT_INFO_DIALOG : public REFIT_ABSTRACT_MENU_ENTRY {
|
|
|
|
public:
|
|
|
|
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************** *************************************************************/
|
|
|
|
|
|
|
|
class REFIT_MENU_ENTRY_ITEM_ABSTRACT : public REFIT_ABSTRACT_MENU_ENTRY {
|
|
|
|
public:
|
|
|
|
INPUT_ITEM *Item;
|
|
|
|
REFIT_MENU_ENTRY_ITEM_ABSTRACT() : Item(0) {}
|
|
|
|
virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Classes that needs a Item member */
|
|
|
|
class REFIT_INPUT_DIALOG : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
|
|
|
|
public:
|
|
|
|
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_SWITCH : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
|
|
|
|
public:
|
|
|
|
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
class REFIT_MENU_CHECKBIT : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
|
|
|
|
public:
|
|
|
|
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
/********************************************************** Loader entries *************************************************************/
|
|
|
|
/*
|
|
|
|
* Super class of LOADER_ENTRY & LEGACY_ENTRY
|
|
|
|
*/
|
|
|
|
class REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER : public REFIT_ABSTRACT_MENU_ENTRY
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CONST CHAR16 *DevicePathString;
|
2020-04-26 15:07:30 +02:00
|
|
|
XStringArray LoadOptions; //moved here for compatibility with legacy
|
2020-04-27 11:50:49 +02:00
|
|
|
XStringW LoaderPath;
|
2020-04-03 22:00:42 +02:00
|
|
|
XImage DriveImage;
|
|
|
|
XImage BadgeImage;
|
2020-03-10 10:45:17 +01:00
|
|
|
|
2020-04-03 22:00:42 +02:00
|
|
|
REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()
|
2020-04-27 11:50:49 +02:00
|
|
|
: REFIT_ABSTRACT_MENU_ENTRY(), DevicePathString(0), DriveImage(), BadgeImage()
|
2020-04-03 22:00:42 +02:00
|
|
|
{}
|
|
|
|
virtual XImage* getDriveImage() { return &DriveImage; };
|
|
|
|
virtual XImage* getBadgeImage() { return &BadgeImage; };
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
virtual REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER* getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() { return this; };
|
|
|
|
};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
//--------------------------------------- REFIT_MENU_ENTRY_LOADER_TOOL ---------------------------------------//
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
class REFIT_MENU_ENTRY_LOADER_TOOL : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UINT8 NoMemset;
|
|
|
|
UINT16 Flags;
|
|
|
|
EFI_DEVICE_PATH *DevicePath;
|
2020-05-01 18:26:28 +02:00
|
|
|
|
|
|
|
VOID StartTool();
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 11:00:17 +01:00
|
|
|
REFIT_MENU_ENTRY_LOADER_TOOL() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), NoMemset(1), Flags(0), DevicePath(0) {};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return this; };
|
|
|
|
};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
//--------------------------------------- REFIT_MENU_ENTRY_CLOVER ---------------------------------------//
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
class REFIT_MENU_ENTRY_CLOVER : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
REFIT_VOLUME *Volume;
|
|
|
|
CONST CHAR16 *VolName;
|
|
|
|
EFI_DEVICE_PATH *DevicePath;
|
|
|
|
UINT16 Flags;
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 11:00:17 +01:00
|
|
|
REFIT_MENU_ENTRY_CLOVER() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), Volume(NULL), VolName(NULL), DevicePath(NULL), Flags(0) {};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
REFIT_MENU_ENTRY_CLOVER* getPartiallyDuplicatedEntry() const;
|
|
|
|
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
|
|
|
|
};
|
2020-02-29 08:30:21 +01:00
|
|
|
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
//--------------------------------------- REFIT_MENU_ITEM_BOOTNUM ---------------------------------------//
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
class REFIT_MENU_ITEM_BOOTNUM : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
REFIT_VOLUME *Volume;
|
|
|
|
UINTN BootNum;
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 11:00:17 +01:00
|
|
|
REFIT_MENU_ITEM_BOOTNUM() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), Volume(NULL), BootNum(0) {};
|
2020-03-10 10:45:17 +01:00
|
|
|
virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return this; };
|
|
|
|
} ;
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-05 12:49:47 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
//--------------------------------------- LEGACY_ENTRY ---------------------------------------//
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
class LEGACY_ENTRY : public REFIT_MENU_ITEM_BOOTNUM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LEGACY_ENTRY() : REFIT_MENU_ITEM_BOOTNUM() {};
|
2020-05-01 18:26:28 +02:00
|
|
|
|
|
|
|
VOID StartLegacy();
|
2020-02-29 08:30:21 +01:00
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------- LOADER_ENTRY ---------------------------------------//
|
|
|
|
|
|
|
|
struct KERNEL_AND_KEXT_PATCHES;
|
|
|
|
|
|
|
|
class LOADER_ENTRY : public REFIT_MENU_ITEM_BOOTNUM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CONST CHAR16 *VolName;
|
|
|
|
EFI_DEVICE_PATH *DevicePath;
|
|
|
|
UINT16 Flags;
|
|
|
|
UINT8 LoaderType;
|
|
|
|
CHAR8 *OSVersion;
|
|
|
|
CHAR8 *BuildVersion;
|
2020-04-01 14:57:32 +02:00
|
|
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor;
|
|
|
|
|
2020-03-10 10:45:17 +01:00
|
|
|
UINT8 CustomBoot;
|
2020-04-11 14:34:59 +02:00
|
|
|
XImage CustomLogo;
|
2020-03-10 10:45:17 +01:00
|
|
|
KERNEL_AND_KEXT_PATCHES *KernelAndKextPatches;
|
|
|
|
CONST CHAR16 *Settings;
|
2020-05-09 09:56:30 +02:00
|
|
|
UINT8 *KernelData;
|
2020-05-01 18:26:28 +02:00
|
|
|
UINT32 AddrVtable;
|
|
|
|
UINT32 SizeVtable;
|
|
|
|
UINT32 NamesTable;
|
2020-05-02 05:38:38 +02:00
|
|
|
INT32 SegVAddr;
|
|
|
|
INT32 shift;
|
2020-03-10 10:45:17 +01:00
|
|
|
|
2020-03-10 11:00:17 +01:00
|
|
|
LOADER_ENTRY()
|
2020-04-01 14:57:32 +02:00
|
|
|
: REFIT_MENU_ITEM_BOOTNUM(), VolName(0), DevicePath(0), Flags(0), LoaderType(0), OSVersion(0), BuildVersion(0),
|
2020-04-10 12:04:21 +02:00
|
|
|
BootBgColor({0,0,0,0}),
|
2020-05-09 09:56:30 +02:00
|
|
|
CustomBoot(0), KernelAndKextPatches(0), Settings(0), KernelData(0),
|
2020-05-02 05:38:38 +02:00
|
|
|
AddrVtable(0), SizeVtable(0), NamesTable(0), shift(0)
|
2020-03-10 11:00:17 +01:00
|
|
|
{};
|
2020-05-01 18:26:28 +02:00
|
|
|
|
|
|
|
VOID FindBootArgs();
|
2020-05-09 09:56:30 +02:00
|
|
|
EFI_STATUS getVTable();
|
|
|
|
VOID Get_PreLink();
|
|
|
|
UINTN searchProc(const char *procedure);
|
2020-05-03 19:16:50 +02:00
|
|
|
UINTN searchProcInDriver(UINT8 * driver, UINT32 driverLen, const char *procedure);
|
2020-05-01 18:26:28 +02:00
|
|
|
VOID KernelAndKextsPatcherStart();
|
|
|
|
VOID KernelAndKextPatcherInit();
|
2020-05-09 09:56:30 +02:00
|
|
|
BOOLEAN KernelUserPatch();
|
|
|
|
BOOLEAN KernelPatchPm();
|
|
|
|
BOOLEAN KernelLapicPatch_32();
|
|
|
|
BOOLEAN KernelLapicPatch_64();
|
2020-05-01 18:26:28 +02:00
|
|
|
BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize);
|
2020-05-09 09:56:30 +02:00
|
|
|
VOID EFIAPI KernelBooterExtensionsPatch();
|
|
|
|
BOOLEAN KernelPanicNoKextDump();
|
|
|
|
VOID KernelCPUIDPatch();
|
|
|
|
BOOLEAN PatchCPUID(const UINT8* Location, INT32 LenLoc,
|
2020-05-06 08:21:30 +02:00
|
|
|
const UINT8* Search4, const UINT8* Search10, const UINT8* ReplaceModel,
|
|
|
|
const UINT8* ReplaceExt, INT32 Len);
|
2020-05-09 09:56:30 +02:00
|
|
|
VOID KernelPatcher_32();
|
2020-05-09 10:55:33 +02:00
|
|
|
// VOID KernelPatcher_64();
|
2020-05-01 18:26:28 +02:00
|
|
|
VOID FilterKernelPatches();
|
|
|
|
VOID FilterKextPatches();
|
|
|
|
VOID FilterBootPatches();
|
2020-05-09 09:56:30 +02:00
|
|
|
VOID applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *repl, const CHAR8 *comment);
|
2020-05-01 18:26:28 +02:00
|
|
|
|
|
|
|
EFI_STATUS SetFSInjection();
|
|
|
|
EFI_STATUS InjectKexts(IN UINT32 deviceTreeP, IN UINT32 *deviceTreeLength);
|
|
|
|
EFI_STATUS LoadKexts();
|
|
|
|
int is_mkext_v1(UINT8* drvPtr);
|
|
|
|
void patch_mkext_v1(UINT8 *drvPtr);
|
|
|
|
// why EFIAPI?
|
|
|
|
EFI_STATUS EFIAPI LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext);
|
|
|
|
EFI_STATUS EFIAPI AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType);
|
|
|
|
VOID LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
|
|
|
|
VOID AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType);
|
|
|
|
VOID KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);
|
|
|
|
VOID KextPatcherStart();
|
|
|
|
VOID PatchPrelinkedKexts();
|
|
|
|
VOID PatchLoadedKexts();
|
|
|
|
VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N);
|
|
|
|
VOID ATIConnectorsPatchInit();
|
|
|
|
VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *ForceLoadKexts_v);
|
|
|
|
VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID CheckForFakeSMC(CHAR8 *InfoPlist);
|
|
|
|
VOID DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
|
|
|
VOID BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
|
2020-05-09 09:56:30 +02:00
|
|
|
BOOLEAN SandyBridgeEPM();
|
|
|
|
BOOLEAN HaswellEXCPM();
|
|
|
|
BOOLEAN HaswellLowEndXCPM();
|
|
|
|
BOOLEAN BroadwellEPM();
|
|
|
|
BOOLEAN KernelIvyBridgeXCPM();
|
|
|
|
BOOLEAN KernelIvyE5XCPM();
|
2020-05-01 18:26:28 +02:00
|
|
|
|
|
|
|
VOID Stall(int Pause) { if ((KernelAndKextPatches != NULL) && KernelAndKextPatches->KPDebug) { gBS->Stall(Pause); } };
|
|
|
|
VOID StartLoader();
|
2020-03-10 10:45:17 +01:00
|
|
|
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
|
|
|
|
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
|
|
|
|
} ;
|
2020-02-29 08:30:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
|
|
|
|
EOF */
|