Some prototypes cleaning.

This commit is contained in:
Jief L 2020-04-11 09:21:06 +03:00
parent cb51add9aa
commit 84f956714f
11 changed files with 229 additions and 76 deletions

View File

@ -44,7 +44,7 @@ typedef INT32 vm_prot_t;
//
// And finally the xnu/EXTERNAL_HEADERS/mach-o/loader.h
//
#include "loader.h"
#include "MachO-loader.h"
//

View File

@ -98,6 +98,7 @@ extern "C" {
#include "../cpp_util/remove_ref.h"
#endif
#include "../libeg/BmLib.h"
#include "BootLog.h"
#include "BasicIO.h"
#include "../refit/lib.h"

View File

@ -3,6 +3,7 @@
*/
#include "../entry_scan/entry_scan.h"
#include "../entry_scan/loader.h"
#include "kernel_patcher.h"
#include "ati.h"
#include "../libeg/nanosvg.h"

View File

@ -48,6 +48,13 @@ CHAR8
);
VOID GetListOfThemes(VOID);
VOID GetListOfConfigs(VOID);
VOID GetListOfACPI(VOID);
VOID GetListOfDsdts(VOID);
// syscl - get list of inject kext(s)
VOID GetListOfInjectKext(CHAR16 *);
#endif

View File

@ -33,6 +33,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../Platform/Platform.h"
#include "entry_scan.h"
#include "../refit/menu.h"

View File

@ -0,0 +1,16 @@
/*
* common.h
*
* Created on: 10 Apr 2020
* Author: jief
*/
#ifndef LOADER_H_
#define LOADER_H_
UINT8 GetOSTypeFromPath (IN CONST CHAR16 *Path);
#endif

View File

@ -33,6 +33,7 @@
*/
#include "../../Platform/Platform.h"
#include "menu_items.h"
#include "../../libeg/libeg.h"

198
rEFIt_UEFI/libeg/BmLib.h Normal file
View File

@ -0,0 +1,198 @@
/*
* BmLib.h
*
* Created on: 10 Apr 2020
* Author: jief
*/
#ifndef LIBEG_BMLIB_H_
#define LIBEG_BMLIB_H_
#include <Guid/FileSystemVolumeLabelInfo.h>
#include <Guid/FileInfo.h>
#include <Guid/FileSystemInfo.h>
/**
Find the first instance of this Protocol
in the system and return it's interface.
@param ProtocolGuid Provides the protocol to search for
@param Interface On return, a pointer to the first interface
that matches ProtocolGuid
@retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
@retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
**/
EFI_STATUS
EfiLibLocateProtocol (
IN EFI_GUID *ProtocolGuid,
OUT VOID **Interface
);
/**
Function opens and returns a file handle to the root directory of a volume.
@param DeviceHandle A handle for a device
@return A valid file handle or NULL is returned
**/
EFI_FILE_HANDLE
EfiLibOpenRoot (
IN EFI_HANDLE DeviceHandle
);
/**
Function gets the file system information from an open file descriptor,
and stores it in a buffer allocated from pool.
@param FHand The file handle.
@return A pointer to a buffer with file information.
@retval NULL is returned if failed to get Volume Label Info.
**/
EFI_FILE_SYSTEM_VOLUME_LABEL *
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
);
/**
Duplicate a string.
@param Src The source.
@return A new string which is duplicated copy of the source.
@retval NULL If there is not enough memory.
**/
CHAR16 *
EfiStrDuplicate (
IN CONST CHAR16 *Src
);
//Compare strings case insensitive
// return 0 if strings are equal not accounting match case
INTN
StriCmp (
IN CONST CHAR16 *FirstS,
IN CONST CHAR16 *SecondS
);
// If Null-terminated strings are case insensitive equal or its sSize symbols are equal then TRUE
BOOLEAN
AsciiStriNCmp (
IN CONST CHAR8 *FirstS,
IN CONST CHAR8 *SecondS,
IN CONST UINTN sSize
);
// Case insensitive search of WhatString in WhereString
BOOLEAN
AsciiStrStriN (
IN CONST CHAR8 *WhatString,
IN CONST UINTN sWhatSize,
IN CONST CHAR8 *WhereString,
IN CONST UINTN sWhereSize
);
/**
Function gets the file information from an open file descriptor, and stores it
in a buffer allocated from pool.
@param FHand File Handle.
@return A pointer to a buffer with file information or NULL is returned
**/
EFI_FILE_INFO *
EfiLibFileInfo (
IN EFI_FILE_HANDLE FHand
);
EFI_FILE_SYSTEM_INFO *
EfiLibFileSystemInfo (
IN EFI_FILE_HANDLE FHand
);
/**
Function is used to determine the number of device path instances
that exist in a device path.
@param DevicePath A pointer to a device path data structure.
@return This function counts and returns the number of device path instances
in DevicePath.
**/
UINTN
EfiDevicePathInstanceCount (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Adjusts the size of a previously allocated buffer.
@param OldPool - A pointer to the buffer whose size is being adjusted.
@param OldSize - The size of the current buffer.
@param NewSize - The size of the new buffer.
@return The newly allocated buffer.
@retval NULL Allocation failed.
**/
VOID *
EfiReallocatePool (
IN VOID *OldPool,
IN UINTN OldSize,
IN UINTN NewSize
);
/**
Compare two EFI_TIME data.
@param FirstTime - A pointer to the first EFI_TIME data.
@param SecondTime - A pointer to the second EFI_TIME data.
@retval TRUE The FirstTime is not later than the SecondTime.
@retval FALSE The FirstTime is later than the SecondTime.
**/
BOOLEAN
TimeCompare (
IN EFI_TIME *FirstTime,
IN EFI_TIME *SecondTime
);
/*
Translate VT-UTF8 characters into one Unicode character.
UTF8 Encoding Table
Bits per Character | Unicode Character Range | Unicode Binary Encoding | UTF8 Binary Encoding
0-7 | 0x0000 - 0x007F | 00000000 0xxxxxxx | 0xxxxxxx
8-11 | 0x0080 - 0x07FF | 00000xxx xxxxxxxx | 110xxxxx 10xxxxxx
12-16 | 0x0800 - 0xFFFF | xxxxxxxx xxxxxxxx | 1110xxxx 10xxxxxx 10xxxxxx
$ U+0024 10 0100 00100100 24
¢ U+00A2 1010 0010 11000010 10100010 C2 A2
U+20AC 0010 0000 1010 1100 11100010 10000010 10101100 E2 82 AC
𐍈 U+10348 1 0000 0011 0100 1000 11110000 10010000 10001101 10001000 F0 90 8D 88
*/
CHAR8* GetUnicodeChar(CHAR8 *s, CHAR16* UnicodeChar);
#endif /* LIBEG_BMLIB_H_ */

View File

@ -50,6 +50,7 @@
entry_scan/common.cpp
entry_scan/common.h
entry_scan/legacy.cpp
entry_scan/loader.h
entry_scan/loader.cpp
entry_scan/tool.cpp
entry_scan/secureboot.cpp
@ -78,6 +79,7 @@
libeg/egemb_icons_dark.cpp
libeg/egemb_font.cpp
libeg/scroll_images.cpp
libeg/BmLib.h
libeg/BmLib.cpp
libeg/image.cpp
# libeg/load_bmp.cpp
@ -181,7 +183,7 @@
Platform/b64cdecode.h
Platform/b64cdecode.cpp
Platform/FixBiosDsdt.cpp
Platform/loader.h
Platform/MachO-loader.h
Platform/LoaderUefi.h
Platform/kernel_patcher.h
Platform/kernel_patcher.cpp

View File

@ -374,19 +374,11 @@ EFI_STATUS ReinitSelfLib(VOID);
//extern EFI_STATUS FinishInitRefitLib(VOID); -- static
BOOLEAN IsEmbeddedTheme(VOID);
UINT8 GetOSTypeFromPath (IN CONST CHAR16 *Path);
//VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialElementCount);
//VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement);
//VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount /*, IN Callback*/);
VOID GetListOfThemes(VOID);
VOID GetListOfConfigs(VOID);
VOID GetListOfACPI(VOID);
VOID GetListOfDsdts(VOID);
// syscl - get list of inject kext(s)
VOID GetListOfInjectKext(CHAR16 *);
EFI_STATUS ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, EFI_DEVICE_PATH **HardcodedPathList);
@ -539,70 +531,6 @@ VOID ReadConfig(INTN What);
//
// BmLib
//
extern EFI_STATUS
EfiLibLocateProtocol (
IN EFI_GUID *ProtocolGuid,
OUT VOID **Interface
);
extern EFI_FILE_HANDLE
EfiLibOpenRoot (
IN EFI_HANDLE DeviceHandle
);
extern EFI_FILE_SYSTEM_VOLUME_LABEL *
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
);
extern CHAR16 *
EfiStrDuplicate (
IN CONST CHAR16 *Src
);
extern INTN StriCmp (
IN CONST CHAR16 *FirstString,
IN CONST CHAR16 *SecondString
);
extern INTN EFIAPI AsciiStriCmp (
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString
);
extern BOOLEAN AsciiStriNCmp (
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString,
IN CONST UINTN sSize
);
extern BOOLEAN AsciiStrStriN (
IN CONST CHAR8 *WhatString,
IN CONST UINTN sWhatSize,
IN CONST CHAR8 *WhereString,
IN CONST UINTN sWhereSize
);
extern EFI_FILE_INFO * EfiLibFileInfo (IN EFI_FILE_HANDLE FHand);
extern EFI_FILE_SYSTEM_INFO * EfiLibFileSystemInfo (IN EFI_FILE_HANDLE Root);
extern UINTN
EfiDevicePathInstanceCount (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
extern VOID *
EfiReallocatePool (
IN VOID *OldPool,
IN UINTN OldSize,
IN UINTN NewSize
);
extern BOOLEAN
TimeCompare (
IN EFI_TIME *FirstTime,
IN EFI_TIME *SecondTime
);
extern BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt);
#ifdef DUMP_KERNEL_KEXT_PATCHES
@ -612,8 +540,6 @@ VOID DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches);
//VOID FilterKextPatches(IN LOADER_ENTRY *Entry);
CHAR8* GetUnicodeChar(CHAR8 *s, CHAR16* UnicodeChar);
#define KERNEL_MAX_SIZE 40000000