mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-22 02:01:47 +01:00
Rename OSVersion to macOSVersion.
Fixed some icons ordering in main menu. Fixed macOs version detection for custom entries. Fixed main Big Sur partition appearing in menu. Refactor IsValidGuidAsciiString.
This commit is contained in:
parent
5de09acb3f
commit
16c627596f
@ -1 +1 @@
|
||||
Subproject commit 620e4378f9a3d0558c144936e3fc5affbf445e44
|
||||
Subproject commit 78708c2edcfb358a6577f92a6afda1f99f2f48a0
|
@ -2333,11 +2333,12 @@
|
||||
$PROJECT_DIR/../../MdePkg/Include/X64,
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
$PROJECT_DIR/../../OpenCorePkg,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Intel,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
@ -2418,11 +2419,12 @@
|
||||
$PROJECT_DIR/../../MdePkg/Include/X64,
|
||||
$PROJECT_DIR/../../MdeModulePkg/Include,
|
||||
$PROJECT_DIR/../../Library/MemLogLibDefault,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
$PROJECT_DIR/../../OpenCorePkg,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
|
||||
$PROJECT_DIR/../../OpenCorePkg/Include/Intel,
|
||||
$PROJECT_DIR/../../UefiCpuPkg/Include,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
|
@ -117,3 +117,8 @@ AsciiStrHexToUint64 (
|
||||
if ( ret == 0 ) return 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
UINTN AsciiStrLen(const char* String)
|
||||
{
|
||||
return strlen(String);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ UINTN StrLen(const wchar_t* String);
|
||||
//int StrCmp(const wchar_t* FirstString, const wchar_t* SecondString);
|
||||
//int StrnCmp(const wchar_t* FirstString, const wchar_t* SecondString, UINTN Length);
|
||||
//UINTN StrLen(const wchar_t* String);
|
||||
//UINTN AsciiStrLen(const char* String);
|
||||
UINTN AsciiStrLen(const char* String);
|
||||
//INTN AsciiStrCmp (const char *FirstString,const char *SecondString);
|
||||
|
||||
CHAR16* StrStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString);
|
||||
|
34
Xcode/cpp_tests/Include/Library/MemoryAllocationLib.c
Normal file
34
Xcode/cpp_tests/Include/Library/MemoryAllocationLib.c
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// MemoryAllocationLib.c
|
||||
// cpp_tests UTF16 signed char
|
||||
//
|
||||
// Created by Jief on 30/01/2021.
|
||||
// Copyright © 2021 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#include "MemoryAllocationLib.h"
|
||||
|
||||
|
||||
void* AllocatePool(UINTN AllocationSize)
|
||||
{
|
||||
return (void*)malloc((size_t)AllocationSize);
|
||||
}
|
||||
|
||||
void* AllocateZeroPool(UINTN AllocationSize)
|
||||
{
|
||||
void* p = (void*)malloc((size_t)AllocationSize);
|
||||
memset(p, 0, (size_t)AllocationSize);
|
||||
return p;
|
||||
}
|
||||
|
||||
void* ReallocatePool(UINTN OldSize, UINTN NewSize, void* OldBuffer)
|
||||
{
|
||||
(void)OldSize;
|
||||
if ( !OldBuffer ) return AllocatePool(NewSize);
|
||||
return (void*)realloc(OldBuffer, (size_t)NewSize);
|
||||
}
|
||||
|
||||
void FreePool(IN VOID *Buffer)
|
||||
{
|
||||
free((void*)Buffer);
|
||||
}
|
101
Xcode/cpp_tests/Include/Library/MemoryAllocationLib.h
Normal file
101
Xcode/cpp_tests/Include/Library/MemoryAllocationLib.h
Normal file
@ -0,0 +1,101 @@
|
||||
//
|
||||
// MemoryAllocationLib.h
|
||||
// cpp_tests
|
||||
//
|
||||
// Created by Jief on 30/01/2021.
|
||||
// Copyright © 2021 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MemoryAllocationLib_h
|
||||
#define MemoryAllocationLib_h
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
|
||||
pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
|
||||
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
|
||||
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
|
||||
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateZeroPool(
|
||||
IN UINTN AllocationSize
|
||||
);
|
||||
|
||||
/**
|
||||
Reallocates a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates and zeros the number bytes specified by NewSize from memory of type
|
||||
EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
|
||||
NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
|
||||
OldBuffer is freed. A pointer to the newly allocated buffer is returned.
|
||||
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
|
||||
enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
|
||||
is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
|
||||
|
||||
@param OldSize The size, in bytes, of OldBuffer.
|
||||
@param NewSize The size, in bytes, of the buffer to reallocate.
|
||||
@param OldBuffer The buffer to copy to the allocated buffer. This is an optional
|
||||
parameter that may be NULL.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ReallocatePool (
|
||||
IN UINTN OldSize,
|
||||
IN UINTN NewSize,
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
||||
Memory Allocation Library.
|
||||
|
||||
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
|
||||
pool allocation services of the Memory Allocation Library. If it is not possible to free pool
|
||||
resources, then this function will perform no actions.
|
||||
|
||||
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
|
||||
then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreePool(
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
#endif /* MemoryAllocationLib_h */
|
25
Xcode/cpp_tests/Include/Library/PrintLib.c
Normal file
25
Xcode/cpp_tests/Include/Library/PrintLib.c
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// PrintLib.c
|
||||
// cpp_tests
|
||||
//
|
||||
// Created by Jief on 30/01/2021.
|
||||
// Copyright © 2021 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#include "PrintLib.h"
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiSPrint (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, FormatString);
|
||||
int ret = vsnprintf(StartOfBuffer, BufferSize, FormatString, va);
|
||||
va_end(va);
|
||||
return (UINTN)ret; // vsnprintf seems to always return >= 0. So cast should be safe.
|
||||
}
|
60
Xcode/cpp_tests/Include/Library/PrintLib.h
Normal file
60
Xcode/cpp_tests/Include/Library/PrintLib.h
Normal file
@ -0,0 +1,60 @@
|
||||
//
|
||||
// Header.h
|
||||
// cpp_tests
|
||||
//
|
||||
// Created by Jief on 30/01/2021.
|
||||
// Copyright © 2021 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef PrintLib_h
|
||||
#define PrintLib_h
|
||||
|
||||
/**
|
||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||
ASCII format string and variable argument list.
|
||||
|
||||
This function is similar as snprintf_s defined in C11.
|
||||
|
||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||
and BufferSize.
|
||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||
Arguments are pulled from the variable argument list based on the contents of the
|
||||
format string.
|
||||
The number of ASCII characters in the produced output buffer is returned not including
|
||||
the Null-terminator.
|
||||
|
||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||
unmodified and 0 is returned.
|
||||
If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
|
||||
unmodified and 0 is returned.
|
||||
If PcdMaximumAsciiStringLength is not zero, and BufferSize >
|
||||
(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
|
||||
is unmodified and 0 is returned.
|
||||
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||
|
||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||
|
||||
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
|
||||
ASCII string.
|
||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||
@param FormatString A Null-terminated ASCII format string.
|
||||
@param ... Variable argument list whose contents are accessed based on the
|
||||
format string specified by FormatString.
|
||||
|
||||
@return The number of ASCII characters in the produced output buffer not including the
|
||||
Null-terminator.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiSPrint (
|
||||
OUT CHAR8 *StartOfBuffer,
|
||||
IN UINTN BufferSize,
|
||||
IN CONST CHAR8 *FormatString,
|
||||
...
|
||||
);
|
||||
|
||||
|
||||
#endif /* PrintLib_h */
|
@ -13,12 +13,23 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Uefi.h"
|
||||
#include "../Include/Library/Base.h"
|
||||
#include "../Include/Library/BaseLib.h"
|
||||
#include "../Include/Library/BaseMemoryLib.h"
|
||||
#include "../Include/Library/MemoryAllocationLib.h"
|
||||
#include <BootLog.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
@ -54,20 +65,6 @@ void PauseForKey(const wchar_t* msg);
|
||||
|
||||
const char* efiStrError(EFI_STATUS Status);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void* AllocatePool(UINTN AllocationSize);
|
||||
void* AllocateZeroPool(UINTN AllocationSize);
|
||||
void* ReallocatePool(UINTN OldSize, UINTN NewSize, void* OldBuffer);
|
||||
void FreePool(const void* Buffer);
|
||||
|
||||
//void ZeroMem(void *Destination, UINTN Length);
|
||||
//void SetMem(void *Destination, UINTN Length, char c);
|
||||
//void CopyMem(void *Destination, const void *Source, UINTN Length);
|
||||
//INTN CompareMem(const void* DestinationBuffer, const void* SourceBuffer, UINTN Length);
|
||||
|
||||
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src);
|
||||
|
||||
#define DEBUG_VERBOSE 0
|
||||
|
@ -181,6 +181,17 @@
|
||||
9ACAB117242623EE00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9AD0358C25C57A4500E58351 /* MemoryAllocationLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */; };
|
||||
9AD0358D25C57AFA00E58351 /* MemoryAllocationLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */; };
|
||||
9AD0358E25C57AFA00E58351 /* MemoryAllocationLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */; };
|
||||
9AD0358F25C57AFB00E58351 /* MemoryAllocationLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */; };
|
||||
9AD0359025C57BF700E58351 /* BaseLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CBF253485C8008303F5 /* BaseLib.c */; };
|
||||
9AD0359125C57BF700E58351 /* BaseLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CBF253485C8008303F5 /* BaseLib.c */; };
|
||||
9AD0359225C57BF700E58351 /* BaseLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A838CBF253485C8008303F5 /* BaseLib.c */; };
|
||||
9AD0359425C57C8A00E58351 /* PrintLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0359325C57C8A00E58351 /* PrintLib.c */; };
|
||||
9AD0359525C57C8A00E58351 /* PrintLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0359325C57C8A00E58351 /* PrintLib.c */; };
|
||||
9AD0359625C57C8A00E58351 /* PrintLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0359325C57C8A00E58351 /* PrintLib.c */; };
|
||||
9AD0359725C57C8A00E58351 /* PrintLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 9AD0359325C57C8A00E58351 /* PrintLib.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -337,6 +348,10 @@
|
||||
9AC790112452C45A0004FBE9 /* abort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abort.h; sourceTree = "<group>"; };
|
||||
9ACAB116242623EE00BDB3CF /* printf_lite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf_lite.c; sourceTree = "<group>"; };
|
||||
9ACAB1182426240C00BDB3CF /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = ../../Include/Library/printf_lite.h; sourceTree = "<group>"; };
|
||||
9AD0358925C5797E00E58351 /* MemoryAllocationLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MemoryAllocationLib.h; sourceTree = "<group>"; };
|
||||
9AD0358A25C579B200E58351 /* PrintLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrintLib.h; sourceTree = "<group>"; };
|
||||
9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MemoryAllocationLib.c; sourceTree = "<group>"; };
|
||||
9AD0359325C57C8A00E58351 /* PrintLib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = PrintLib.c; sourceTree = "<group>"; };
|
||||
9AD469472452B33700D6D0DB /* shared_with_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shared_with_menu.cpp; sourceTree = "<group>"; };
|
||||
9AD469482452B33700D6D0DB /* shared_with_menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_with_menu.h; sourceTree = "<group>"; };
|
||||
9AF4156D242CBC4900D2644C /* printf_lite-conf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "printf_lite-conf.h"; path = "../../Include/Library/printf_lite-conf.h"; sourceTree = "<group>"; };
|
||||
@ -581,6 +596,8 @@
|
||||
9A838CB7253481FF008303F5 /* Library */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AD0358925C5797E00E58351 /* MemoryAllocationLib.h */,
|
||||
9AD0358B25C57A4500E58351 /* MemoryAllocationLib.c */,
|
||||
9A838CB825348237008303F5 /* BaseMemoryLib.h */,
|
||||
9A838CB925348237008303F5 /* BaseMemoryLib.c */,
|
||||
9A838CBE253485C8008303F5 /* BaseLib.h */,
|
||||
@ -590,6 +607,8 @@
|
||||
9A838CC425348610008303F5 /* OcMiscLib.h */,
|
||||
9A838CC52534933F008303F5 /* Base.h */,
|
||||
9A838CC62534946C008303F5 /* ProcessorBind.h */,
|
||||
9AD0358A25C579B200E58351 /* PrintLib.h */,
|
||||
9AD0359325C57C8A00E58351 /* PrintLib.c */,
|
||||
);
|
||||
path = Library;
|
||||
sourceTree = "<group>";
|
||||
@ -751,10 +770,12 @@
|
||||
9A36E50524F3B537007A1107 /* TagInt64.cpp in Sources */,
|
||||
9A36E50124F3B537007A1107 /* TagDict.cpp in Sources */,
|
||||
9A36E50D24F3B537007A1107 /* TagData.cpp in Sources */,
|
||||
9AD0358D25C57AFA00E58351 /* MemoryAllocationLib.c in Sources */,
|
||||
9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
9A36E52D24F3C846007A1107 /* plist_tests.cpp in Sources */,
|
||||
9A0B08732403B08400E2B470 /* XObjArray_tests.cpp in Sources */,
|
||||
9A36E53D24F3EDED007A1107 /* base64.cpp in Sources */,
|
||||
9AD0359025C57BF700E58351 /* BaseLib.c in Sources */,
|
||||
9A28CD20241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA842451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
@ -782,6 +803,7 @@
|
||||
9A36E51124F3B537007A1107 /* TagArray.cpp in Sources */,
|
||||
9A36E4F124F3B537007A1107 /* TagString8.cpp in Sources */,
|
||||
9A36E50924F3B537007A1107 /* TagDate.cpp in Sources */,
|
||||
9AD0359525C57C8A00E58351 /* PrintLib.c in Sources */,
|
||||
9A4185C12439F73A00BEAFB8 /* XStringArray.cpp in Sources */,
|
||||
9A36E52024F3B82A007A1107 /* b64cdecode.cpp in Sources */,
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */,
|
||||
@ -800,10 +822,12 @@
|
||||
9A36E50724F3B537007A1107 /* TagInt64.cpp in Sources */,
|
||||
9A36E50324F3B537007A1107 /* TagDict.cpp in Sources */,
|
||||
9A36E50F24F3B537007A1107 /* TagData.cpp in Sources */,
|
||||
9AD0358F25C57AFB00E58351 /* MemoryAllocationLib.c in Sources */,
|
||||
9A2A7C6C24576CCE00422263 /* LoadOptions_test.cpp in Sources */,
|
||||
9A36E52F24F3C846007A1107 /* plist_tests.cpp in Sources */,
|
||||
9A2A7C6D24576CCE00422263 /* XObjArray_tests.cpp in Sources */,
|
||||
9A36E53F24F3EDED007A1107 /* base64.cpp in Sources */,
|
||||
9AD0359225C57BF700E58351 /* BaseLib.c in Sources */,
|
||||
9A2A7C6E24576CCE00422263 /* abort.cpp in Sources */,
|
||||
9A2A7C6F24576CCE00422263 /* XString.cpp in Sources */,
|
||||
9A2A7C7024576CCE00422263 /* XString_test.cpp in Sources */,
|
||||
@ -831,6 +855,7 @@
|
||||
9A36E51324F3B537007A1107 /* TagArray.cpp in Sources */,
|
||||
9A36E4F324F3B537007A1107 /* TagString8.cpp in Sources */,
|
||||
9A36E50B24F3B537007A1107 /* TagDate.cpp in Sources */,
|
||||
9AD0359725C57C8A00E58351 /* PrintLib.c in Sources */,
|
||||
9A2A7C7D24576CCE00422263 /* XStringArray.cpp in Sources */,
|
||||
9A36E52224F3B82A007A1107 /* b64cdecode.cpp in Sources */,
|
||||
9A2A7C7E24576CCE00422263 /* XArray_tests.cpp in Sources */,
|
||||
@ -849,10 +874,12 @@
|
||||
9A36E50624F3B537007A1107 /* TagInt64.cpp in Sources */,
|
||||
9A36E50224F3B537007A1107 /* TagDict.cpp in Sources */,
|
||||
9A36E50E24F3B537007A1107 /* TagData.cpp in Sources */,
|
||||
9AD0358E25C57AFA00E58351 /* MemoryAllocationLib.c in Sources */,
|
||||
9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
9A36E52E24F3C846007A1107 /* plist_tests.cpp in Sources */,
|
||||
9A57C21A2418B9A00029A39F /* XObjArray_tests.cpp in Sources */,
|
||||
9A36E53E24F3EDED007A1107 /* base64.cpp in Sources */,
|
||||
9AD0359125C57BF700E58351 /* BaseLib.c in Sources */,
|
||||
9A28CD21241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA852451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA832451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
@ -880,6 +907,7 @@
|
||||
9A36E51224F3B537007A1107 /* TagArray.cpp in Sources */,
|
||||
9A36E4F224F3B537007A1107 /* TagString8.cpp in Sources */,
|
||||
9A36E50A24F3B537007A1107 /* TagDate.cpp in Sources */,
|
||||
9AD0359625C57C8A00E58351 /* PrintLib.c in Sources */,
|
||||
9A4185C22439F73A00BEAFB8 /* XStringArray.cpp in Sources */,
|
||||
9A36E52124F3B82A007A1107 /* b64cdecode.cpp in Sources */,
|
||||
9A57C2272418B9A00029A39F /* XArray_tests.cpp in Sources */,
|
||||
@ -899,6 +927,7 @@
|
||||
9A36E50024F3B537007A1107 /* TagDict.cpp in Sources */,
|
||||
9A4C576B255AAD07004F0B21 /* MacOsVersion.cpp in Sources */,
|
||||
9A36E50C24F3B537007A1107 /* TagData.cpp in Sources */,
|
||||
9AD0358C25C57A4500E58351 /* MemoryAllocationLib.c in Sources */,
|
||||
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */,
|
||||
9A7D518424FC32F700FA1CC3 /* XBuffer.cpp in Sources */,
|
||||
9A36E52C24F3C846007A1107 /* plist_tests.cpp in Sources */,
|
||||
@ -935,6 +964,7 @@
|
||||
9A36E4F024F3B537007A1107 /* TagString8.cpp in Sources */,
|
||||
9A4C5771255AB280004F0B21 /* MacOsVersion_test.cpp in Sources */,
|
||||
9A36E50824F3B537007A1107 /* TagDate.cpp in Sources */,
|
||||
9AD0359425C57C8A00E58351 /* PrintLib.c in Sources */,
|
||||
9A36E51F24F3B82A007A1107 /* b64cdecode.cpp in Sources */,
|
||||
9A838CC3253485DC008303F5 /* DebugLib.c in Sources */,
|
||||
9A0B085B2402FF8700E2B470 /* XArray_tests.cpp in Sources */,
|
||||
|
@ -87,30 +87,6 @@ const char* efiStrError(EFI_STATUS Status)
|
||||
|
||||
|
||||
|
||||
void* AllocatePool(UINTN AllocationSize)
|
||||
{
|
||||
return (void*)malloc((size_t)AllocationSize);
|
||||
}
|
||||
|
||||
void* AllocateZeroPool(UINTN AllocationSize)
|
||||
{
|
||||
void* p = (void*)malloc((size_t)AllocationSize);
|
||||
memset(p, 0, (size_t)AllocationSize);
|
||||
return p;
|
||||
}
|
||||
|
||||
void* ReallocatePool(UINTN OldSize, UINTN NewSize, void* OldBuffer)
|
||||
{
|
||||
(void)OldSize;
|
||||
if ( !OldBuffer ) return AllocatePool(NewSize);
|
||||
return (void*)realloc(OldBuffer, (size_t)NewSize);
|
||||
}
|
||||
|
||||
void FreePool(const void* Buffer)
|
||||
{
|
||||
free((void*)Buffer);
|
||||
}
|
||||
|
||||
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src)
|
||||
{
|
||||
CHAR16* newS = (CHAR16*)malloc((wcslen_fixed(Src)+1)*sizeof(wchar_t));
|
||||
|
@ -408,7 +408,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
|
||||
// Sherlocks: to fix "OSInstall.mpkg appears to be missing or damaged" in 10.13+, we should remove this variables.
|
||||
if (Entry->LoaderType == OSTYPE_OSX_INSTALLER) {
|
||||
if (Entry->OSVersion.isEmpty() || Entry->OSVersion > MacOsVersion("10.12"_XS8)) {
|
||||
if (Entry->macOSVersion.isEmpty() || Entry->macOSVersion > MacOsVersion("10.12"_XS8)) {
|
||||
DeleteNvramVariable(L"install-product-url", &gEfiAppleBootGuid);
|
||||
DeleteNvramVariable(L"previous-system-uuid", &gEfiAppleBootGuid);
|
||||
}
|
||||
|
@ -4441,7 +4441,7 @@ ParseSMBIOSSettings(
|
||||
if ( !Prop->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in SmUUID\n");
|
||||
}else{
|
||||
if (IsValidGuidAsciiString(Prop->getString()->stringValue())) {
|
||||
if (IsValidGuidString(Prop->getString()->stringValue())) {
|
||||
gSettings.SmUUID = Prop->getString()->stringValue();
|
||||
} else {
|
||||
DBG("Error: invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
|
||||
@ -6093,7 +6093,7 @@ GetUserSettings(const TagDict* CfgDict)
|
||||
MsgLog("ATTENTION : property not string in Block/Guid\n");
|
||||
}else{
|
||||
if( Prop2->getString()->stringValue().notEmpty() ) {
|
||||
if (IsValidGuidAsciiString(Prop2->getString()->stringValue())) {
|
||||
if (IsValidGuidString(Prop2->getString()->stringValue())) {
|
||||
StrToGuidLE(Prop2->getString()->stringValue(), &RtVariable.VarGuid);
|
||||
}else{
|
||||
DBG("Error: invalid GUID for RT var '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
|
||||
@ -6148,7 +6148,7 @@ GetUserSettings(const TagDict* CfgDict)
|
||||
if ( !Prop->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in SystemParameters/CustomUUID\n");
|
||||
}else{
|
||||
if (IsValidGuidAsciiString(Prop->getString()->stringValue())) {
|
||||
if (IsValidGuidString(Prop->getString()->stringValue())) {
|
||||
gSettings.CustomUuid = Prop->getString()->stringValue();
|
||||
// if CustomUUID specified, then default for InjectSystemID=FALSE
|
||||
// to stay compatibile with previous Clover behaviour
|
||||
@ -6283,9 +6283,10 @@ static CONST CHAR8 *SearchString(
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MacOsVersion GetOSVersion(int LoaderType, const XStringW& APFSTargetUUID, const REFIT_VOLUME* Volume, XString8* BuildVersionPtr)
|
||||
{
|
||||
XString8 OSVersion;
|
||||
XString8 BuildVersion;
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
CHAR8* PlistBuffer = NULL;
|
||||
UINTN PlistLen;
|
||||
@ -6293,25 +6294,25 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
const TagDict* DictPointer = NULL;
|
||||
const TagStruct* Prop = NULL;
|
||||
|
||||
if (!Entry || !Entry->Volume) {
|
||||
if ( !Volume ) {
|
||||
return NullXString8;
|
||||
}
|
||||
|
||||
if (OSTYPE_IS_OSX(Entry->LoaderType))
|
||||
if (OSTYPE_IS_OSX(LoaderType))
|
||||
{
|
||||
XString8 uuidPrefix;
|
||||
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", Entry->APFSTargetUUID.wc_str());
|
||||
if ( APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", APFSTargetUUID.wc_str());
|
||||
|
||||
XStringW plist = SWPrintf("%s\\System\\Library\\CoreServices\\SystemVersion.plist", uuidPrefix.c_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist = SWPrintf("%s\\System\\Library\\CoreServices\\ServerVersion.plist", uuidPrefix.c_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist.setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
if ( plist.notEmpty() ) { // found macOS System
|
||||
Status = egLoadFile(Entry->Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6329,7 +6330,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MsgLog("ATTENTION : property not string in ProductBuildVersion\n");
|
||||
}else{
|
||||
if( Prop->getString()->stringValue().notEmpty() ) {
|
||||
Entry->BuildVersion = Prop->getString()->stringValue();
|
||||
BuildVersion = Prop->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6338,7 +6339,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
}
|
||||
}
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER (Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_INSTALLER (LoaderType)) {
|
||||
// Detect exact version for 2nd stage Installer (thanks to dmazar for this idea)
|
||||
// This should work for most installer cases. Rest cases will be read from boot.efi before booting.
|
||||
// Reworked by Sherlocks. 2018.04.12
|
||||
@ -6348,24 +6349,24 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
|
||||
XStringW InstallerPlist;
|
||||
|
||||
if ( Entry->APFSTargetUUID.notEmpty() ) {
|
||||
InstallerPlist = SWPrintf("%ls\\System\\Library\\CoreServices\\SystemVersion.plist", Entry->APFSTargetUUID.wc_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, InstallerPlist) ) InstallerPlist.setEmpty();
|
||||
if ( APFSTargetUUID.notEmpty() ) {
|
||||
InstallerPlist = SWPrintf("%ls\\System\\Library\\CoreServices\\SystemVersion.plist", APFSTargetUUID.wc_str());
|
||||
if ( !FileExists(Volume->RootDir, InstallerPlist) ) InstallerPlist.setEmpty();
|
||||
}
|
||||
|
||||
if ( InstallerPlist.isEmpty() ) {
|
||||
InstallerPlist = SWPrintf("\\.IABootFilesSystemVersion.plist"); // 10.9 - 10.13.3
|
||||
if (!FileExists(Entry->Volume->RootDir, InstallerPlist) && FileExists (Entry->Volume->RootDir, L"\\System\\Library\\CoreServices\\boot.efi") &&
|
||||
((FileExists(Entry->Volume->RootDir, L"\\BaseSystem.dmg") && FileExists (Entry->Volume->RootDir, L"\\mach_kernel")) || // 10.7/10.8
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app") || // 10.6/10.7
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app") || // 10.8 - 10.11
|
||||
FileExists(Entry->Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app") || // 10.12+
|
||||
FileExists(Entry->Volume->RootDir, L"\\.IAPhysicalMedia"))) { // 10.13.4+
|
||||
if (!FileExists(Volume->RootDir, InstallerPlist) && FileExists (Volume->RootDir, L"\\System\\Library\\CoreServices\\boot.efi") &&
|
||||
((FileExists(Volume->RootDir, L"\\BaseSystem.dmg") && FileExists (Volume->RootDir, L"\\mach_kernel")) || // 10.7/10.8
|
||||
FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app") || // 10.6/10.7
|
||||
FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app") || // 10.8 - 10.11
|
||||
FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app") || // 10.12+
|
||||
FileExists(Volume->RootDir, L"\\.IAPhysicalMedia"))) { // 10.13.4+
|
||||
InstallerPlist = SWPrintf("\\System\\Library\\CoreServices\\SystemVersion.plist");
|
||||
}
|
||||
}
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6383,7 +6384,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MsgLog("ATTENTION : property not string in ProductBuildVersion\n");
|
||||
}else{
|
||||
if( Prop->getString()->stringValue().notEmpty() ) {
|
||||
Entry->BuildVersion = Prop->getString()->stringValue();
|
||||
BuildVersion = Prop->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6393,7 +6394,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
|
||||
// if ( OSVersion.isEmpty() )
|
||||
// {
|
||||
// if ( FileExists(Entry->Volume->RootDir, SWPrintf("\\%ls\\com.apple.installer\\BridgeVersion.plist", Entry->APFSTargetUUID.wc_str()).wc_str()) ) {
|
||||
// if ( FileExists(Volume->RootDir, SWPrintf("\\%ls\\com.apple.installer\\BridgeVersion.plist", APFSTargetUUID.wc_str()).wc_str()) ) {
|
||||
// OSVersion = "11.0"_XS8;
|
||||
// // TODO so far, is there is a BridgeVersion.plist, it's version 11.0. Has to be improved with next releases.
|
||||
// }
|
||||
@ -6403,8 +6404,8 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
// Check for plist - createinstallmedia/NetInstall
|
||||
if (OSVersion.isEmpty()) {
|
||||
InstallerPlist = SWPrintf("\\.IABootFiles\\com.apple.Boot.plist"); // 10.9 - ...
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("Kernel Flags");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6412,7 +6413,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MsgLog("ATTENTION : property not string in Kernel Flags\n");
|
||||
}else{
|
||||
if ( Prop->getString()->stringValue().contains("Install%20macOS%20BigSur") || Prop->getString()->stringValue().contains("Install%20macOS%2011.0")) {
|
||||
OSVersion = "11.0"_XS8;
|
||||
OSVersion = "11"_XS8;
|
||||
} else if ( Prop->getString()->stringValue().contains("Install%20macOS%2010.16")) {
|
||||
OSVersion = "10.16"_XS8;
|
||||
} else if ( Prop->getString()->stringValue().contains("Install%20macOS%20Catalina") || Prop->getString()->stringValue().contains("Install%20macOS%2010.15")) {
|
||||
@ -6444,26 +6445,26 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
// Check for plist - AppStore/createinstallmedia/startosinstall/Fusion Drive
|
||||
if (OSVersion.isEmpty()) {
|
||||
InstallerPlist = SWPrintf("\\macOS Install Data\\Locked Files\\Boot Files\\SystemVersion.plist"); // 10.12.4+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = SWPrintf("\\macOS Install Data\\InstallInfo.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.R\\SystemVersion.plist)"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.P\\SystemVersion.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
InstallerPlist = SWPrintf("\\com.apple.boot.S\\SystemVersion.plist"); // 10.12+
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerPlist) &&
|
||||
(FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Entry->Volume->RootDir, L"\\com.apple.boot.S\\System\\Library\\PrelinkedKernels\\prelinkedkernel"))) {
|
||||
if (!FileExists (Volume->RootDir, InstallerPlist) &&
|
||||
(FileExists (Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists (Volume->RootDir, L"\\com.apple.boot.S\\System\\Library\\PrelinkedKernels\\prelinkedkernel"))) {
|
||||
InstallerPlist = SWPrintf("\\System\\Library\\CoreServices\\SystemVersion.plist"); // 10.11
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (FileExists (Volume->RootDir, InstallerPlist)) {
|
||||
Status = egLoadFile(Volume->RootDir, InstallerPlist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6481,7 +6482,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
MsgLog("ATTENTION : property not string in ProductBuildVersion\n");
|
||||
}else{
|
||||
if( Prop->getString()->stringValue().notEmpty() ) {
|
||||
Entry->BuildVersion = Prop->getString()->stringValue();
|
||||
BuildVersion = Prop->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6515,14 +6516,14 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
UINTN fileLen = 0;
|
||||
XStringW InstallerLog;
|
||||
InstallerLog = L"\\Mac OS X Install Data\\ia.log"_XSW; // 10.7
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerLog)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerLog)) {
|
||||
InstallerLog = L"\\OS X Install Data\\ia.log"_XSW; // 10.8 - 10.11
|
||||
if (!FileExists (Entry->Volume->RootDir, InstallerLog)) {
|
||||
if (!FileExists (Volume->RootDir, InstallerLog)) {
|
||||
InstallerLog = L"\\macOS Install Data\\ia.log"_XSW; // 10.12+
|
||||
}
|
||||
}
|
||||
if (FileExists (Entry->Volume->RootDir, InstallerLog)) {
|
||||
Status = egLoadFile(Entry->Volume->RootDir, InstallerLog.wc_str(), (UINT8 **)&fileBuffer, &fileLen);
|
||||
if (FileExists (Volume->RootDir, InstallerLog)) {
|
||||
Status = egLoadFile(Volume->RootDir, InstallerLog.wc_str(), (UINT8 **)&fileBuffer, &fileLen);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
XString8 targetString;
|
||||
targetString.strncpy(fileBuffer, fileLen);
|
||||
@ -6531,34 +6532,34 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
if (s[31] == ' ') {
|
||||
OSVersion.S8Printf("%c%c.%c\n", s[27], s[28], s[30]);
|
||||
if (s[38] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
} else if (s[39] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
}
|
||||
} else if (s[31] == '.') {
|
||||
OSVersion.S8Printf("%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
|
||||
if (s[40] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
} else if (s[41] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
}
|
||||
} else if (s[32] == ' ') {
|
||||
OSVersion.S8Printf("%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
|
||||
if (s[39] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
} else if (s[40] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
} else if (s[41] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
}
|
||||
} else if (s[32] == '.') {
|
||||
OSVersion.S8Printf("%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
|
||||
if (s[41] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
} else if (s[42] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
} else if (s[43] == ')') {
|
||||
Entry->BuildVersion.S8Printf("%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
BuildVersion.S8Printf("%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
}
|
||||
}
|
||||
FreePool(fileBuffer);
|
||||
@ -6571,13 +6572,13 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
if ( OSVersion.isEmpty() )
|
||||
{
|
||||
XStringW plist = L"\\macOS Install Data\\Locked Files\\Boot Files\\SystemVersion.plist"_XSW;
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist.setEmpty();
|
||||
}
|
||||
|
||||
if ( plist.notEmpty() ) { // found macOS System
|
||||
|
||||
Status = egLoadFile(Entry->Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6592,7 +6593,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
if ( !Prop->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in ProductBuildVersion\n");
|
||||
}else{
|
||||
Entry->BuildVersion = Prop->getString()->stringValue();
|
||||
BuildVersion = Prop->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6601,19 +6602,19 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
}
|
||||
}
|
||||
|
||||
if (OSTYPE_IS_OSX_RECOVERY (Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_RECOVERY (LoaderType)) {
|
||||
|
||||
XString8 uuidPrefix;
|
||||
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", Entry->APFSTargetUUID.wc_str());
|
||||
if ( APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", APFSTargetUUID.wc_str());
|
||||
|
||||
XStringW plist = SWPrintf("%s\\SystemVersion.plist", uuidPrefix.c_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist = SWPrintf("%s\\ServerVersion.plist", uuidPrefix.c_str());
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist = L"\\com.apple.recovery.boot\\SystemVersion.plist"_XSW;
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist = L"\\com.apple.recovery.boot\\ServerVersion.plist"_XSW;
|
||||
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
|
||||
if ( !FileExists(Volume->RootDir, plist) ) {
|
||||
plist.setEmpty();
|
||||
}
|
||||
}
|
||||
@ -6622,7 +6623,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
|
||||
// Detect exact version for OS X Recovery
|
||||
if ( plist.notEmpty() ) { // found macOS System
|
||||
Status = egLoadFile(Entry->Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
Status = egLoadFile(Volume->RootDir, plist.wc_str(), (UINT8 **)&PlistBuffer, &PlistLen);
|
||||
if (!EFI_ERROR(Status) && PlistBuffer != NULL && ParseXML(PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
|
||||
Prop = Dict->propertyForKey("ProductVersion");
|
||||
if ( Prop != NULL ) {
|
||||
@ -6637,12 +6638,12 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
if ( !Prop->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in ProductBuildVersion\n");
|
||||
}else{
|
||||
Entry->BuildVersion = Prop->getString()->stringValue();
|
||||
BuildVersion = Prop->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Dict->FreeTag();
|
||||
} else if (FileExists (Entry->Volume->RootDir, L"\\com.apple.recovery.boot\\boot.efi")) {
|
||||
} else if (FileExists (Volume->RootDir, L"\\com.apple.recovery.boot\\boot.efi")) {
|
||||
// Special case - com.apple.recovery.boot/boot.efi exists but SystemVersion.plist doesn't --> 10.9 recovery
|
||||
OSVersion = "10.9"_XS8;
|
||||
}
|
||||
@ -6651,7 +6652,7 @@ MacOsVersion GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
if (PlistBuffer != NULL) {
|
||||
FreePool(PlistBuffer);
|
||||
}
|
||||
|
||||
(*BuildVersionPtr).stealValueFrom(&BuildVersion);
|
||||
return OSVersion;
|
||||
}
|
||||
|
||||
@ -7906,7 +7907,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
(Pci.Hdr.ClassCode[1] == PCI_CLASS_MEDIA_AUDIO))) {
|
||||
// HDMI injection inside
|
||||
if (gSettings.HDAInjection ) {
|
||||
TmpDirty = setup_hda_devprop (PciIo, &PCIdevice, Entry->OSVersion);
|
||||
TmpDirty = setup_hda_devprop (PciIo, &PCIdevice, Entry->macOSVersion);
|
||||
StringDirty |= TmpDirty;
|
||||
}
|
||||
if (gSettings.ResetHDA) {
|
||||
@ -8325,7 +8326,7 @@ EFI_STATUS LOADER_ENTRY::SetFSInjection()
|
||||
//InjectKextsFromDir(Status, GetOtherKextsDir());
|
||||
InjectKextsFromDir(Status, SrcDir.wc_str());
|
||||
|
||||
SrcDir = GetOSVersionKextsDir(OSVersion);
|
||||
SrcDir = GetOSVersionKextsDir(macOSVersion);
|
||||
Status = FSInject->Install(
|
||||
Volume->DeviceHandle,
|
||||
L"\\System\\Library\\Extensions",
|
||||
|
@ -914,10 +914,9 @@ void
|
||||
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *LoadedEntry);
|
||||
|
||||
|
||||
MacOsVersion
|
||||
GetOSVersion (
|
||||
IN LOADER_ENTRY *Entry
|
||||
);
|
||||
MacOsVersion GetOSVersion(int LoaderType, const XStringW& APFSTargetUUID, const REFIT_VOLUME* Volume, XString8* BuildVersionPtr);
|
||||
|
||||
inline MacOsVersion GetOSVersion (IN LOADER_ENTRY *Entry) { return GetOSVersion(Entry->LoaderType, Entry->APFSTargetUUID, Entry->Volume, &Entry->BuildVersion); };
|
||||
|
||||
|
||||
void GetListOfThemes(void);
|
||||
|
@ -33,6 +33,8 @@
|
||||
#define IS_ASCII(x) ((x>=0x20) && (x<=0x7F))
|
||||
#define IS_PUNCT(x) ((x == '.') || (x == '-'))
|
||||
|
||||
inline bool isPathSeparator(char32_t c) { return c == '/' || c == '\\'; }
|
||||
|
||||
|
||||
////void LowCase (IN OUT CHAR8 *Str);
|
||||
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
|
||||
|
@ -2129,7 +2129,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
|
||||
DBG("ATI: No default properties injected\n");
|
||||
}
|
||||
|
||||
devprop_add_list(ati_devprop_list, Entry->OSVersion);
|
||||
devprop_add_list(ati_devprop_list, Entry->macOSVersion);
|
||||
if (!gSettings.NoDefaultProperties) {
|
||||
if (gSettings.UseIntelHDMI) {
|
||||
devprop_add_value(card->device, "hda-gfx", (UINT8*)"onboard-2", 10);
|
||||
|
@ -967,7 +967,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
UINT8 BuiltIn = 0x00;
|
||||
UINT32 FakeID;
|
||||
UINT32 DualLink = 1;
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(Entry->macOSVersion);
|
||||
BOOLEAN SetUGAWidth = FALSE;
|
||||
BOOLEAN SetUGAHeight = FALSE;
|
||||
BOOLEAN Injected = FALSE;
|
||||
@ -2548,7 +2548,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, sometimes this value causes force reboot in 10.14+
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8) ) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.14"_XS8) ) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", skylake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -2600,7 +2600,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
switch (gma_dev->device_id) {
|
||||
case 0x5902:
|
||||
case 0x5906:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8) ) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8) ) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19028086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2627,7 +2627,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5912:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19128086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2655,7 +2655,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x5916:
|
||||
case 0x5917:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19168086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2684,7 +2684,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
case 0x591A:
|
||||
case 0x591B:
|
||||
case 0x591D:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191B8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2712,7 +2712,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x591C:
|
||||
case 0x591E:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2739,7 +2739,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5923:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19168086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2766,7 +2766,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5926:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19268086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2793,8 +2793,8 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x5927:
|
||||
if (Entry->OSVersion.notEmpty() &&
|
||||
Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (Entry->macOSVersion.notEmpty() &&
|
||||
Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x19278086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2822,7 +2822,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x87C0:
|
||||
case 0x87CA:
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.12.6"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x191E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2834,7 +2834,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
devprop_add_value(device, "AAPL,ig-platform-id", skylake_ig_vals[8], 4);
|
||||
DBG(" Found ig-platform-id = 0x191E0000\n");
|
||||
}
|
||||
} else if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
} else if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x591E8086 >> 16;
|
||||
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
|
||||
@ -2905,7 +2905,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", kabylake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -2964,7 +2964,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
switch (gma_dev->device_id) {
|
||||
case 0x3E90:
|
||||
case 0x3E93:
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
if (( Entry->macOSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->macOSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E908086 >> 16;
|
||||
@ -2992,7 +2992,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x3E91:
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
if (( Entry->macOSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->macOSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E918086 >> 16;
|
||||
@ -3021,7 +3021,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
case 0x3E92:
|
||||
case 0x3E98:
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
if (( Entry->macOSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->macOSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E928086 >> 16;
|
||||
@ -3052,7 +3052,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
case 0x3EA0:
|
||||
case 0x9B41:
|
||||
case 0x9BCA:
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
if (( Entry->macOSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->macOSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3E9B8086 >> 16;
|
||||
@ -3080,7 +3080,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
case 0x3EA5:
|
||||
if (( Entry->OSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->OSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
if (( Entry->macOSVersion >= MacOsVersion("10.14"_XS8)) || (( Entry->macOSVersion == MacOsVersion("10.13.6"_XS8)) &&
|
||||
(Entry->BuildVersion.contains("17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
|
||||
if (!SetFake) {
|
||||
FakeID = 0x3EA58086 >> 16;
|
||||
@ -3146,7 +3146,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
|
||||
// if wakes up with an HDMI connected, somtimes this value causes force reboot in 10.14+
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", coffeelake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
@ -3311,7 +3311,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}*/
|
||||
|
||||
// if wakes up with an HDMI connected, sometimes this value causes force reboot in 10.14+
|
||||
if ( Entry->OSVersion.notEmpty() && Entry->OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
if ( Entry->macOSVersion.notEmpty() && Entry->macOSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
devprop_add_value(device, "AAPL,GfxYTile", cannonlake_hd_vals[1], 4);
|
||||
}
|
||||
break;
|
||||
|
@ -17,12 +17,12 @@ extern "C" EFI_GUID gEfiMiscSubClassGuid;
|
||||
constexpr const LString8 nullGuid = "00000000-0000-0000-0000-000000000000";
|
||||
|
||||
/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
|
||||
template <typename T, enable_if( is___String(T) )>
|
||||
BOOLEAN IsValidGuidAsciiString(const T& Str)
|
||||
template <typename T, typename IntegralType, enable_if( is_char(T) && is_integral(IntegralType) ) >
|
||||
BOOLEAN IsValidGuidString(const T* Str, IntegralType n)
|
||||
{
|
||||
UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
|
||||
|
||||
if ( Str.length() != 36 ) {
|
||||
if ( n != 36 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -47,6 +47,45 @@ BOOLEAN IsValidGuidAsciiString(const T& Str)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
|
||||
template <typename T, enable_if( is___String(T) )>
|
||||
BOOLEAN IsValidGuidString(const T& Str)
|
||||
{
|
||||
if ( Str.isEmpty() ) return false;
|
||||
return IsValidGuidString(Str.data(0), Str.length());
|
||||
}
|
||||
|
||||
///** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
|
||||
//template <typename T, enable_if( is___String(T) )>
|
||||
//BOOLEAN IsValidGuidAsciiString(const T& Str)
|
||||
//{
|
||||
// UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
|
||||
//
|
||||
// if ( Str.length() != 36 ) {
|
||||
// return FALSE;
|
||||
// }
|
||||
//
|
||||
// for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) {
|
||||
// if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) {
|
||||
// if (Str[Index4IsValidGuidAsciiString] != '-') {
|
||||
// return FALSE;
|
||||
// }
|
||||
// } else {
|
||||
// if (!(
|
||||
// (Str[Index4IsValidGuidAsciiString] >= '0' && Str[Index4IsValidGuidAsciiString] <= '9')
|
||||
// || (Str[Index4IsValidGuidAsciiString] >= 'a' && Str[Index4IsValidGuidAsciiString] <= 'f')
|
||||
// || (Str[Index4IsValidGuidAsciiString] >= 'A' && Str[Index4IsValidGuidAsciiString] <= 'F')
|
||||
// )
|
||||
// )
|
||||
// {
|
||||
// return FALSE;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return TRUE;
|
||||
//}
|
||||
|
||||
|
||||
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
|
||||
EFI_STATUS
|
||||
|
@ -423,15 +423,15 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
return;
|
||||
}
|
||||
|
||||
// os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
// make sure only kernels for OSX 10.6.0 to 10.7.3 are being patched by this approach
|
||||
if (OSVersion >= AsciiOSVersionToUint64("10.6") && OSVersion <= AsciiOSVersionToUint64("10.7.3")) {
|
||||
if (macOSVersion >= AsciiOSVersionToUint64("10.6") && macOSVersion <= AsciiOSVersionToUint64("10.7.3")) {
|
||||
|
||||
// DBG_RT( "will patch kernel for macOS 10.6.0 to 10.7.3\n");
|
||||
|
||||
// remove tsc_init: unknown CPU family panic for kernels prior to 10.6.2 which still had Atom support
|
||||
if (OSVersion < AsciiOSVersionToUint64("10.6.2")) {
|
||||
if (macOSVersion < AsciiOSVersionToUint64("10.6.2")) {
|
||||
for (i=0; i<0x1000000; i++) {
|
||||
// find _tsc_init panic address by byte sequence 488d3df4632a00
|
||||
if (bytes[i] == 0x48 && bytes[i+1] == 0x8D && bytes[i+2] == 0x3D && bytes[i+3] == 0xF4 &&
|
||||
@ -476,11 +476,11 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
|
||||
// Determine cpuid_model address
|
||||
// for 10.6.2 kernels it's offset by 299 bytes from cpuid_family address
|
||||
if (OSVersion == AsciiOSVersionToUint64("10.6.2")) {
|
||||
if (macOSVersion == AsciiOSVersionToUint64("10.6.2")) {
|
||||
cpuid_model_addr = cpuid_family_addr - 0X12B;
|
||||
}
|
||||
// for 10.6.3 to 10.6.7 it's offset by 303 bytes
|
||||
else if (OSVersion <= AsciiOSVersionToUint64("10.6.7")) {
|
||||
else if (macOSVersion <= AsciiOSVersionToUint64("10.6.7")) {
|
||||
cpuid_model_addr = cpuid_family_addr - 0X12F;
|
||||
}
|
||||
// for 10.6.8 to 10.7.3 kernels - by 339 bytes
|
||||
@ -528,17 +528,17 @@ void LOADER_ENTRY::KernelPatcher_64()
|
||||
}
|
||||
|
||||
// patch ssse3
|
||||
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.6",4)==0)) {
|
||||
if (!SSSE3 && (AsciiStrnCmp(macOSVersion,"10.6",4)==0)) {
|
||||
Patcher_SSE3_6((void*)bytes);
|
||||
}
|
||||
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.7",4)==0)) {
|
||||
if (!SSSE3 && (AsciiStrnCmp(macOSVersion,"10.7",4)==0)) {
|
||||
Patcher_SSE3_7();
|
||||
}
|
||||
}
|
||||
|
||||
// all 10.7.4+ kernels share common CPUID switch statement logic,
|
||||
// it needs to be exploited in diff manner due to the lack of space
|
||||
else if (OSVersion >= AsciiOSVersionToUint64("10.7.4")) {
|
||||
else if (macOSVersion >= AsciiOSVersionToUint64("10.7.4")) {
|
||||
|
||||
DBG_RT( "will patch kernel for macOS 10.7.4+\n");
|
||||
|
||||
@ -725,13 +725,13 @@ void LOADER_ENTRY::KernelPatcher_32()
|
||||
bytes[patchLocation + 3] = 0x90;
|
||||
bytes[patchLocation + 4] = 0x90;
|
||||
|
||||
if (OSVersion) {
|
||||
if (AsciiStrnCmp(OSVersion,"10.7",4)==0) return;
|
||||
if (macOSVersion) {
|
||||
if (AsciiStrnCmp(macOSVersion,"10.7",4)==0) return;
|
||||
|
||||
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.6",4)==0)) {
|
||||
if (!SSSE3 && (AsciiStrnCmp(macOSVersion,"10.6",4)==0)) {
|
||||
Patcher_SSE3_6((void*)bytes);
|
||||
}
|
||||
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.5",4)==0)) {
|
||||
if (!SSSE3 && (AsciiStrnCmp(macOSVersion,"10.5",4)==0)) {
|
||||
Patcher_SSE3_5((void*)bytes);
|
||||
}
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64()
|
||||
// address: 002e4a2f
|
||||
// bytes:658b04251c0000003b058bb97b00
|
||||
// call _panic -> change to nop {90,90,90,90,90}
|
||||
if ( OSVersion >= MacOsVersion("10.10"_XS8) ) {
|
||||
if ( macOSVersion >= MacOsVersion("10.10"_XS8) ) {
|
||||
UINTN procAddr = searchProc("lapic_interrupt"_XS8);
|
||||
patchLocation1 = searchProc("_panic"_XS8);
|
||||
patchLocation2 = FindRelative32(KernelData, procAddr, 0x140, patchLocation1);
|
||||
@ -1277,9 +1277,9 @@ void LOADER_ENTRY::applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *re
|
||||
// Global XCPM patches compatibility
|
||||
// Currently 10.8.5 - 10.15
|
||||
//
|
||||
static inline BOOLEAN IsXCPMOSVersionCompat(const MacOsVersion& OSVersion)
|
||||
static inline BOOLEAN IsXCPMOSVersionCompat(const MacOsVersion& macOSVersion)
|
||||
{
|
||||
return OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("11.1.0"_XS8);
|
||||
return macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("11.1.0"_XS8);
|
||||
}
|
||||
|
||||
//
|
||||
@ -1304,10 +1304,10 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
if (!IsXCPMOSVersionCompat(macOSVersion)) {
|
||||
DBG("HaswellEXCPM(): Unsupported macOS.\n");
|
||||
DBG("HaswellEXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1315,17 +1315,17 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
// _cpuid_set_info
|
||||
comment = "_cpuid_set_info"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3F, 0x74, 0x2D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3F, 0x75, 0x07 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.1"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.10.1"_XS8)) {
|
||||
// 10.10 - 10.10.1
|
||||
const UINT8 find[] = { 0x74, 0x11, 0x83, 0xF8, 0x3C };
|
||||
const UINT8 repl[] = { 0x74, 0x11, 0x83, 0xF8, 0x3F };
|
||||
@ -1334,32 +1334,32 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
// _xcpm_bootstrap
|
||||
comment = "_xcpm_bootstrap"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x54 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x68 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
// 10.10 - 10.10.2
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3F, 0x75, 0x63 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
// 10.10.3 - 10.10.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC3, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
// 10.11 DB/PB - 10.11.0
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC3, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
// 10.11.1 - 10.11.6
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xB8, 0x83, 0xFB, 0x09 };
|
||||
@ -1378,28 +1378,28 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
}
|
||||
}
|
||||
|
||||
/*if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
/*if (macOSVersion.notEmpty() && macOSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC1, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
@ -1409,7 +1409,7 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
comment = "_xcpm_pkg_scope_msrs"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
@ -1424,7 +1424,7 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM()
|
||||
0x00, 0x00, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
const UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
@ -1470,16 +1470,16 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
|
||||
UINT32 i;
|
||||
UINTN patchLocation;
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
if (!IsXCPMOSVersionCompat(macOSVersion)) {
|
||||
DBG("BroadwellEPM(): Unsupported macOS.\n");
|
||||
DBG("BroadwellEPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
KernelAndKextPatches.FakeCPUID = (UINT32)(OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10.3"_XS8) ? 0x0306C0 : 0x040674);
|
||||
KernelAndKextPatches.FakeCPUID = (UINT32)(macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10.3"_XS8) ? 0x0306C0 : 0x040674);
|
||||
KernelCPUIDPatch();
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
@ -1488,7 +1488,7 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
// ffffff800046882c BE07000000 mov esi, 0x7
|
||||
// ffffff8000468831 31D2 xor edx, edx
|
||||
// ffffff8000468833 E838FDFFFF call sub_ffffff8000468570
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
if (macOSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
// patchLocation = 0; // clean out the value just in case
|
||||
// for (i = 0; i < 0x1000000; i++) {
|
||||
@ -1526,11 +1526,11 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM()
|
||||
BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
{
|
||||
DBG("HaswellLowEndXCPM() ===>\n");
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
XString8 comment;
|
||||
|
||||
// check OS version suit for patches
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
if (!IsXCPMOSVersionCompat(macOSVersion)) {
|
||||
DBG("HaswellLowEndXCPM(): Unsupported macOS.\n");
|
||||
DBG("HaswellLowEndXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1540,7 +1540,7 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
KernelCPUIDPatch();
|
||||
|
||||
// 10.8.5 - 10.11.x no need the following kernel patches on Haswell Celeron/Pentium
|
||||
if (OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
if (macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
DBG("HaswellLowEndXCPM() <===\n");
|
||||
return TRUE;
|
||||
}
|
||||
@ -1568,17 +1568,17 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
// ; Basic Block Input Regs: rbx - Killed Regs: rax
|
||||
// ffffff80004fa0f7 89D8 mov eax, ebx
|
||||
@ -1589,11 +1589,11 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
@ -1602,7 +1602,7 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM()
|
||||
*/
|
||||
comment = "_cpuid_set_info_rdmsr"_XS8;
|
||||
// PMheart: bytes seem stable as of 10.12
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
if (macOSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
const UINT8 find[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x0F, 0x32 };
|
||||
const UINT8 repl[] = { 0xB9, 0xA0, 0x01, 0x00, 0x00, 0x31, 0xC0 };
|
||||
@ -1621,7 +1621,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
// check whether Ivy Bridge
|
||||
if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE) {
|
||||
@ -1632,18 +1632,18 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
|
||||
// check OS version suit for patches
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
if (!IsXCPMOSVersionCompat(macOSVersion)) {
|
||||
DBG("KernelIvyBridgeXCPM():Unsupported macOS.\n");
|
||||
DBG("KernelIvyBridgeXCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
} else if (OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
} else if (macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
// 10.8.5 - 10.11.x no need the following kernel patches on Ivy Bridge - we just use -xcpm boot-args
|
||||
DBG("KernelIvyBridgeXCPM() <===\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DBG("Searching _xcpm_pkg_scope_msr ...\n");
|
||||
if (OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
if (macOSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
// 10.12+
|
||||
/* patchLocation = 0; // clean out the value just in case
|
||||
for (i = 0; i < 0x1000000; i++) {
|
||||
@ -1685,28 +1685,28 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM()
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (OSVersion.notEmpty() && OSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= AsciiOSVersionToUint64("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC6, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC6, 0x80, 0xFB, 0x42 };
|
||||
@ -1727,7 +1727,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
XString8 comment;
|
||||
// UINT32 i;
|
||||
UINTN patchLocation;
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
// check whether Ivy Bridge-E5
|
||||
if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE_E5) {
|
||||
@ -1738,7 +1738,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
|
||||
// check OS version suit for patches
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
if (!IsXCPMOSVersionCompat(OSVersion)) {
|
||||
if (!IsXCPMOSVersionCompat(macOSVersion)) {
|
||||
DBG("KernelIvyE5XCPM(): Unsupported macOS.\n");
|
||||
DBG("KernelIvyE5XCPM() <===FALSE\n");
|
||||
return FALSE;
|
||||
@ -1747,12 +1747,12 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
// _cpuid_set_info
|
||||
// TODO: should we use FakeCPUID instead?
|
||||
comment = "_cpuid_set_info"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x74, 0x2D };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x74, 0x2D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if ( OSVersion == MacOsVersion("10.9"_XS8) || OSVersion == MacOsVersion("10.9.1"_XS8) ) {
|
||||
} else if ( macOSVersion == MacOsVersion("10.9"_XS8) || macOSVersion == MacOsVersion("10.9.1"_XS8) ) {
|
||||
// 10.9.0 - 10.9.1
|
||||
const UINT8 find[] = { 0x83, 0xF8, 0x3C, 0x75, 0x07 };
|
||||
const UINT8 repl[] = { 0x83, 0xF8, 0x3E, 0x75, 0x07 };
|
||||
@ -1762,7 +1762,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
// _xcpm_pkg_scope_msrs
|
||||
DBG("Searching _xcpm_pkg_scope_msrs ...\n");
|
||||
comment = "_xcpm_pkg_scope_msrs"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = {
|
||||
0x48, 0x8D, 0x3D, 0x02, 0x71, 0x55, 0x00, 0xBE,
|
||||
@ -1777,7 +1777,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
0x00, 0x00, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x74, 0x13, 0x31, 0xD2, 0xE8, 0x5F, 0x02, 0x00, 0x00 };
|
||||
const UINT8 repl[] = { 0xBE, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x31, 0xD2, 0x90, 0x90, 0x90, 0x90, 0x90 };
|
||||
@ -1812,32 +1812,32 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
|
||||
// _xcpm_bootstrap
|
||||
comment = "_xcpm_bootstrap"_XS8;
|
||||
if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.8.5"_XS8)) {
|
||||
// 10.8.5
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x54 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x54 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x68 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x68 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.10.2"_XS8)) {
|
||||
// 10.10 - 10.10.2
|
||||
const UINT8 find[] = { 0x83, 0xFB, 0x3C, 0x75, 0x63 };
|
||||
const UINT8 repl[] = { 0x83, 0xFB, 0x3E, 0x75, 0x63 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.10.5"_XS8)) {
|
||||
// 10.10.3 - 10.10.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.11"_XS8)) {
|
||||
// 10.11 DB/PB - 10.11.0
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC6, 0x83, 0xFB, 0x0D };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x0D };
|
||||
applyKernPatch(find, sizeof(find), repl, comment.c_str());
|
||||
} else if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.11.6"_XS8)) {
|
||||
// 10.11.1 - 10.11.6
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xBB, 0x83, 0xFB, 0x09 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xB9, 0x83, 0xFB, 0x09 };
|
||||
@ -1857,28 +1857,28 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
|
||||
}
|
||||
}
|
||||
|
||||
/* if (OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.12.5")) {
|
||||
/* if (macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.12.5")) {
|
||||
// 10.12 - 10.12.5
|
||||
const UINT8 find[] = { 0x83, 0xC3, 0xC4, 0x83, 0xFB, 0x22 };
|
||||
const UINT8 repl[] = { 0x83, 0xC3, 0xC2, 0x83, 0xFB, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.13")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.13")) {
|
||||
// 10.12.6
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x83, 0xF8, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC2, 0x83, 0xF8, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.14 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.15")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.15")) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[] = { 0x89, 0xD8, 0x04, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x89, 0xD8, 0x04, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
// PMheart: attempt to add 10.15 compatibility
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.15.4")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.15.4")) {
|
||||
const UINT8 find[] = { 0x8D, 0x43, 0xC4, 0x3C, 0x22 };
|
||||
const UINT8 repl[] = { 0x8D, 0x43, 0xC1, 0x3C, 0x22 };
|
||||
applyKernPatch(find, sizeof(find), repl, comment);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.16")) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.16")) {
|
||||
// vector sigma: 10.15.5 Beta 2 build 19F62f and 10.15.4 build 19E287
|
||||
const UINT8 find[] = { 0x3B, 0x7E, 0x2E, 0x80, 0xC3, 0xC4, 0x80, 0xFB, 0x42 };
|
||||
const UINT8 repl[] = { 0x00, 0x7E, 0x2E, 0x80, 0xC3, 0xC1, 0x80, 0xFB, 0x42 };
|
||||
@ -2365,7 +2365,7 @@ LOADER_ENTRY::KernelUserPatch()
|
||||
for (size_t i = 0 ; i < KernelAndKextPatches.KernelPatches.size(); ++i) {
|
||||
DBG( "Patch[%zu]: %s\n", i, KernelAndKextPatches.KernelPatches[i].Label.c_str());
|
||||
if (!KernelAndKextPatches.KernelPatches[i].MenuItem.BValue) {
|
||||
//DBG_RT( "Patch[%d]: %a :: is not allowed for booted OS %a\n", i, KernelAndKextPatches.KernelPatches[i].Label, OSVersion);
|
||||
//DBG_RT( "Patch[%d]: %a :: is not allowed for booted OS %a\n", i, KernelAndKextPatches.KernelPatches[i].Label, macOSVersion);
|
||||
DBG( "==> disabled\n");
|
||||
continue;
|
||||
}
|
||||
@ -2511,10 +2511,10 @@ LOADER_ENTRY::KernelAndKextPatcherInit()
|
||||
// for ML: bootArgs2->kslide + 0x00200000
|
||||
// for AptioFix booting - it's always at KernelRelocBase + 0x00200000
|
||||
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
DBG("OSVersion=%s\n", OSVersion.asString().c_str());
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
DBG("macOSVersion=%s\n", macOSVersion.asString().c_str());
|
||||
|
||||
// if (OSVersion.notEmpty() && OSVersion < AsciiOSVersionToUint64("10.6")) {
|
||||
// if (macOSVersion.notEmpty() && macOSVersion < AsciiOSVersionToUint64("10.6")) {
|
||||
// KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000);
|
||||
// } else {
|
||||
KernelData = (UINT8*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
|
||||
|
@ -408,7 +408,7 @@ void LOADER_ENTRY::LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirN
|
||||
//}
|
||||
|
||||
// Jief : this should replace LOADER_ENTRY::AddKexts
|
||||
void LOADER_ENTRY::AddKextsFromDirInArray(const XString8& SrcDir, const XString8& Path, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
void LOADER_ENTRY::AddKextsFromDirInArray(const XString8& SrcDir, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
{
|
||||
XStringW FileName;
|
||||
XStringW PlugInName;
|
||||
@ -417,7 +417,7 @@ void LOADER_ENTRY::AddKextsFromDirInArray(const XString8& SrcDir, const XString8
|
||||
for ( size_t idx = 0 ; idx < InjectKextList.size() ; idx ++ ) {
|
||||
SIDELOAD_KEXT& CurrentKext = InjectKextList[idx];
|
||||
// DBG(" current kext name=%ls path=%ls, match against=%s\n", CurrentKext.FileName.wc_str(), CurrentKext.KextDirNameUnderOEMPath.wc_str(), Path.c_str());
|
||||
if ( CurrentKext.KextDirNameUnderOEMPath == Path ) {
|
||||
if ( CurrentKext.KextDirNameUnderOEMPath == SrcDir ) {
|
||||
FileName = SWPrintf("%s\\%ls", SrcDir.c_str(), CurrentKext.FileName.wc_str());
|
||||
if (!(CurrentKext.MenuItem.BValue)) {
|
||||
// inject require
|
||||
@ -479,12 +479,12 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
// } else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) {
|
||||
} else if (LoadOptions.contains("arch=i386")) {
|
||||
archCpuType = CPU_TYPE_I386;
|
||||
} else if (OSVersion.notEmpty()) {
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
if (OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
archCpuType = CPU_TYPE_X86_64; // For OSVersion >= 10.8, only x86_64 exists
|
||||
} else if (OSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
archCpuType = CPU_TYPE_I386; // For OSVersion < 10.7, use default of i386
|
||||
} else if (macOSVersion.notEmpty()) {
|
||||
// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
if (macOSVersion.isEmpty() || macOSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
archCpuType = CPU_TYPE_X86_64; // For macOSVersion >= 10.8, only x86_64 exists
|
||||
} else if (macOSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
archCpuType = CPU_TYPE_I386; // For macOSVersion < 10.7, use default of i386
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,104 +519,74 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
}
|
||||
|
||||
// XStringW UniOSVersion;
|
||||
// UniOSVersion = OSVersion;
|
||||
// UniOSVersion = macOSVersion;
|
||||
// DBG("UniOSVersion == %ls\n", UniOSVersion.wc_str());
|
||||
//
|
||||
// XStringW UniShortOSVersion;
|
||||
//// XString8 ShortOSVersion;
|
||||
// if ( OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// // OSVersion that are earlier than 10.10(form: 10.x.y)
|
||||
//// ShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
// UniShortOSVersion.strncpy(OSVersion.c_str(), 4);
|
||||
// if ( macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// // macOSVersion that are earlier than 10.10(form: 10.x.y)
|
||||
//// ShortOSVersion.strncpy(macOSVersion.c_str(), 4);
|
||||
// UniShortOSVersion.strncpy(macOSVersion.c_str(), 4);
|
||||
// } else {
|
||||
//// ShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
// UniShortOSVersion.strncpy(OSVersion.c_str(), 5);
|
||||
//// ShortOSVersion.strncpy(macOSVersion.c_str(), 5);
|
||||
// UniShortOSVersion.strncpy(macOSVersion.c_str(), 5);
|
||||
// }
|
||||
//// DBG("ShortOSVersion == %s\n", ShortOSVersion.c_str());
|
||||
// DBG("UniShortOSVersion == %ls\n", UniShortOSVersion.wc_str());
|
||||
|
||||
// syscl - allow specific load inject kext
|
||||
// Clover/Kexts/Other is for general injection thus we need to scan both Other and OSVersion folder
|
||||
// Clover/Kexts/Other is for general injection thus we need to scan both Other and macOSVersion folder
|
||||
SrcDir = GetOtherKextsDir(TRUE);
|
||||
if ( SrcDir.notEmpty() ) {
|
||||
AddKextsFromDirInArray(SrcDir, "Other"_XS8, archCpuType, kextArray);
|
||||
AddKextsFromDirInArray(SrcDir, archCpuType, kextArray);
|
||||
} else {
|
||||
DBG("GetOtherKextsDir(TRUE) return NULL\n");
|
||||
}
|
||||
// slice: CLOVER/kexts/Off keep disabled kext which can be allowed
|
||||
SrcDir = GetOtherKextsDir(FALSE);
|
||||
if ( SrcDir.notEmpty() ) {
|
||||
AddKextsFromDirInArray(SrcDir, "Off"_XS8, archCpuType, kextArray);
|
||||
AddKextsFromDirInArray(SrcDir, archCpuType, kextArray);
|
||||
} else {
|
||||
DBG("GetOtherKextsDir(FALSE) return NULL\n");
|
||||
}
|
||||
|
||||
if ( OSVersion.notEmpty() )
|
||||
if ( macOSVersion.notEmpty() )
|
||||
{
|
||||
// Add kext from 10 or 11
|
||||
XStringW osMajorVersion = OSVersion.asString(1);
|
||||
XString8 OSVersionKextsDirName; // declare here to avoid multiple allocation
|
||||
|
||||
XStringW OSAllVersionKextsDir;
|
||||
XStringW OSShortVersionKextsDir;
|
||||
XStringW DirName;
|
||||
XStringW DirPath;
|
||||
|
||||
OSAllVersionKextsDir = SWPrintf("%ls", osMajorVersion.wc_str());
|
||||
AddKextsFromDirInArray(OSAllVersionKextsDir, osMajorVersion, archCpuType, kextArray);
|
||||
DirName = S8Printf("%ls_%s", osMajorVersion.wc_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
// Add kext from 10 or 11
|
||||
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_install", osMajorVersion.wc_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_recovery", osMajorVersion.wc_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%ls_normal", osMajorVersion.wc_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
OSVersionKextsDirName = macOSVersion.asString(1);
|
||||
AddKextsFromDirInArray(OSVersionKextsDirName, archCpuType, kextArray);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
AddKextsFromDirInArray(OSVersionKextsDirName, archCpuType, kextArray);
|
||||
|
||||
|
||||
// Add kext from ${osMajorVersion}.{version}
|
||||
|
||||
OSShortVersionKextsDir = OSVersion.asString(2);
|
||||
AddKextsFromDirInArray( OSShortVersionKextsDir, OSShortVersionKextsDir, archCpuType, kextArray);
|
||||
DirName = S8Printf("%ls_%s", OSShortVersionKextsDir.wc_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_install", OSShortVersionKextsDir.wc_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%ls_recovery", OSShortVersionKextsDir.wc_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%ls_normal", OSShortVersionKextsDir.wc_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
OSVersionKextsDirName = macOSVersion.asString(2);
|
||||
if ( macOSVersion.elementAt(1) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
AddKextsFromDirInArray( OSVersionKextsDirName, archCpuType, kextArray);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
AddKextsFromDirInArray(OSVersionKextsDirName, archCpuType, kextArray);
|
||||
|
||||
|
||||
// Add kext from :
|
||||
// ${osMajorVersion}.{version}.0 if NO minor version
|
||||
// ${osMajorVersion}.{version}.{minor version} if minor version is > 0
|
||||
|
||||
XString8 OSVersionKextsDirName;
|
||||
OSVersionKextsDirName = OSVersion.asString(3);
|
||||
if ( OSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
OSVersionKextsDirName = macOSVersion.asString(3);
|
||||
if ( macOSVersion.elementAt(1) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
if ( macOSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
|
||||
DirPath = SWPrintf("%s", OSVersionKextsDirName.c_str());
|
||||
AddKextsFromDirInArray(DirPath, OSVersionKextsDirName, archCpuType, kextArray);
|
||||
DirName = S8Printf("%s_%s", OSVersionKextsDirName.c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
// if ( OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = SWPrintf("%s_install", OSVersionKextsDirName.c_str());
|
||||
// } else if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = SWPrintf("%s_recovery", OSVersionKextsDirName.c_str());
|
||||
// } else {
|
||||
// DirName = SWPrintf("%s_normal", OSVersionKextsDirName.c_str());
|
||||
// }
|
||||
DirPath = SWPrintf("%ls", DirName.wc_str());
|
||||
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
|
||||
AddKextsFromDirInArray(OSVersionKextsDirName, archCpuType, kextArray);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
AddKextsFromDirInArray(OSVersionKextsDirName, archCpuType, kextArray);
|
||||
}else{
|
||||
//MsgLog("No os version is detected\n");
|
||||
AddKextsFromDirInArray("Unknown"_XS8, "Unknown"_XS8, archCpuType, kextArray);
|
||||
AddKextsFromDirInArray("Unknown"_XS8, archCpuType, kextArray);
|
||||
}
|
||||
|
||||
}
|
||||
@ -643,12 +613,12 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
// // } else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) {
|
||||
// } else if (LoadOptions.contains("arch=i386")) {
|
||||
// archCpuType = CPU_TYPE_I386;
|
||||
// } else if (OSVersion.notEmpty()) {
|
||||
//// UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
// if (OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_X86_64; // For OSVersion >= 10.8, only x86_64 exists
|
||||
// } else if (OSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_I386; // For OSVersion < 10.7, use default of i386
|
||||
// } else if (macOSVersion.notEmpty()) {
|
||||
//// UINT64 os_version = AsciiOSVersionToUint64(macOSVersion);
|
||||
// if (macOSVersion.isEmpty() || macOSVersion >= MacOsVersion("10.8"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_X86_64; // For macOSVersion >= 10.8, only x86_64 exists
|
||||
// } else if (macOSVersion < MacOsVersion("10.7"_XS8)) {
|
||||
// archCpuType = CPU_TYPE_I386; // For macOSVersion < 10.7, use default of i386
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@ -1000,7 +970,7 @@ const UINT8 KBELionReplaceEXT_X64[] = { 0xE8, 0x0C, 0xFD, 0xFF, 0xFF, 0x90, 0
|
||||
|
||||
|
||||
//
|
||||
// We can not rely on OSVersion global variable for OS version detection,
|
||||
// We can not rely on macOSVersion global variable for OS version detection,
|
||||
// since in some cases it is not correct (install of ML from Lion, for example).
|
||||
// So, we'll use "brute-force" method - just try to patch.
|
||||
// Actually, we'll at least check that if we can find only one instance of code that
|
||||
|
@ -383,7 +383,7 @@ const UINT8 Moj4CataSearch[] = { 0x75, 0x33, 0x0f, 0xb7 };
|
||||
const UINT8 Moj4CataReplace[] = { 0xeb, 0x33, 0x0f, 0xb7 };
|
||||
#endif
|
||||
//
|
||||
// We can not rely on OSVersion global variable for OS version detection,
|
||||
// We can not rely on macOSVersion global variable for OS version detection,
|
||||
// since in some cases it is not correct (install of ML from Lion, for example). -- AppleRTC patch is not needed for installation
|
||||
// So, we'll use "brute-force" method - just try to patch.
|
||||
// Actually, we'll at least check that if we can find only one instance of code that
|
||||
@ -559,9 +559,9 @@ void LOADER_ENTRY::DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
|
||||
{
|
||||
UINT32 i;
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
if ( OSVersion.isEmpty() ) return; // Jief : not 100% sure, but if OSVersion is unknown, it's > 11.0.1
|
||||
if ( macOSVersion.isEmpty() ) return; // Jief : not 100% sure, but if macOSVersion is unknown, it's > 11.0.1
|
||||
|
||||
DBG_RT("\nSNBE_AICPUPatch: driverAddr = %llx, driverSize = %x\n", (UINTN)Driver, DriverSize);
|
||||
if (KernelAndKextPatches.KPDebug) {
|
||||
@ -571,13 +571,13 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
DBG_RT("Kext: %s\n", gKextBundleIdentifier);
|
||||
|
||||
// now let's patch it
|
||||
if (OSVersion < MacOsVersion("10.9"_XS8) || OSVersion >= MacOsVersion("10.14"_XS8)) {
|
||||
if (macOSVersion < MacOsVersion("10.9"_XS8) || macOSVersion >= MacOsVersion("10.14"_XS8)) {
|
||||
DBG("Unsupported macOS.\nSandyBridge-E requires macOS 10.9 - 10.13.x, aborted\n");
|
||||
DBG("SNBE_AICPUPatch() <===FALSE\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (OSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
if (macOSVersion < MacOsVersion("10.10"_XS8)) {
|
||||
// 10.9.x
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x84, 0x2F, 0x01 },
|
||||
@ -605,7 +605,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
DBG("SNBE_AICPUPatch (%d/7) not apply\n", i);
|
||||
}
|
||||
}
|
||||
} else if (OSVersion < MacOsVersion("10.11"_XS8)) {
|
||||
} else if (macOSVersion < MacOsVersion("10.11"_XS8)) {
|
||||
// 10.10.x
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x3E, 0x75, 0x39 },
|
||||
@ -657,7 +657,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
} else if (macOSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
// 10.11
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x3E, 0x75, 0x39 },
|
||||
@ -708,7 +708,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (OSVersion < MacOsVersion("10.13"_XS8)) {
|
||||
} else if (macOSVersion < MacOsVersion("10.13"_XS8)) {
|
||||
// 10.12
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x01, 0x74, 0x61 },
|
||||
@ -759,7 +759,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
} else {
|
||||
DBG("SNBE_AICPUPatch (7/7) not apply\n");
|
||||
}
|
||||
} else if (OSVersion < MacOsVersion("10.15"_XS8)) {
|
||||
} else if (macOSVersion < MacOsVersion("10.15"_XS8)) {
|
||||
// 10.13/10.14
|
||||
const UINT8 find[][3] = {
|
||||
{ 0x01, 0x74, 0x61 },
|
||||
@ -837,7 +837,7 @@ const UINT8 BroadwellE_IOPCI_Repl_MojCata[] = { 0x48, 0x3D, 0x00, 0x00, 0x00,
|
||||
void LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
|
||||
{
|
||||
UINTN count = 0;
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
|
||||
// UINT64 os_ver = AsciiOSVersionToUint64(macOSVersion);
|
||||
|
||||
DBG_RT("\nBDWE_IOPCIPatch: driverAddr = %llx, driverSize = %x\n", (UINTN)Driver, DriverSize);
|
||||
if (KernelAndKextPatches.KPDebug) {
|
||||
@ -849,9 +849,9 @@ void LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
|
||||
// now, let's patch it!
|
||||
//
|
||||
|
||||
if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.12"_XS8)) {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_El, sizeof(BroadwellE_IOPCI_Find_El), BroadwellE_IOPCI_Repl_El, 0);
|
||||
} else if (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
} else if (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.14"_XS8)) {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_SieHS, sizeof(BroadwellE_IOPCI_Find_SieHS), BroadwellE_IOPCI_Repl_SieHS, 0);
|
||||
} else {
|
||||
count = SearchAndReplace(Driver, DriverSize, BroadwellE_IOPCI_Find_MojCata, sizeof(BroadwellE_IOPCI_Find_MojCata), BroadwellE_IOPCI_Repl_MojCata, 0);
|
||||
|
@ -853,7 +853,7 @@ GetPropertyAsInteger(
|
||||
return (INTN)AsciiStrDecimalToUintn((Prop->getString()->stringValue()[0] == '+') ? (Prop->getString()->stringValue().c_str() + 1) : Prop->getString()->stringValue().c_str());
|
||||
} else if (Prop->isData()) {
|
||||
|
||||
INTN Size = Prop->getData()->dataLenValue();
|
||||
UINTN Size = Prop->getData()->dataLenValue();
|
||||
if (Size > 8) Size = 8;
|
||||
INTN Data = 0;
|
||||
CopyMem(&Data, Prop->getData()->dataValue(), Size);
|
||||
|
@ -78,6 +78,30 @@ int XStringAbstract__startWith(const S* src, const O* other, bool ignoreCase)
|
||||
return src_char32 != 0;
|
||||
}
|
||||
|
||||
template<typename S, typename O>
|
||||
int XStringAbstract__startWithOrEqualTo(const S* src, const O* other, bool ignoreCase)
|
||||
{
|
||||
size_t nb = 0;
|
||||
const S* src2 = src;
|
||||
const O* other2 = other;
|
||||
|
||||
char32_t src_char32;
|
||||
char32_t other_char32;
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
if ( !other_char32 ) return true; // startWith with empty string is considered true
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
while ( other_char32 ) {
|
||||
if ( ignoreCase ) {
|
||||
src_char32 = asciiToLower(src_char32);
|
||||
other_char32 = asciiToLower(other_char32);
|
||||
}
|
||||
if ( src_char32 != other_char32 ) return false;
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
nb += 1;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Returns 1 if src > other
|
||||
*/
|
||||
@ -246,8 +270,12 @@ public:
|
||||
|
||||
|
||||
const T* s() const { return m_data; }
|
||||
|
||||
const T* data() const { return m_data; }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
const T* data(IntegralType pos) const { return __String<T, ThisXStringClass>::_data(pos); }
|
||||
|
||||
/* Empty ? */
|
||||
bool isEmpty() const { return m_data == nullptr || *m_data == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
@ -397,6 +425,20 @@ public:
|
||||
template<typename O>
|
||||
bool startWithIC(const O* other) const { return XStringAbstract__startWith(m_data, other, true); }
|
||||
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
bool startWithOrEqualTo(O otherChar) const {
|
||||
O other[2] = { otherChar, 0};
|
||||
return XStringAbstract__startWithOrEqualTo(m_data, other, false);
|
||||
}
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool startWithOrEqualTo(const __String<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWithOrEqualTo(m_data, otherS.m_data, false); }
|
||||
template<typename O>
|
||||
bool startWithOrEqualTo(const O* other) const { return XStringAbstract__startWithOrEqualTo(m_data, other, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool startWithOrEqualToIC(const __String<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWithOrEqualTo(m_data, otherS.m_data, true); }
|
||||
template<typename O>
|
||||
bool startWithOrEqualToIC(const O* other) const { return XStringAbstract__startWithOrEqualTo(m_data, other, true); }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
ThisXStringClass basename() const
|
||||
@ -777,10 +819,13 @@ public:
|
||||
else m_data[0] = 0;
|
||||
}
|
||||
|
||||
T* data() const { return m_data; }
|
||||
T* data() { return m_data; }
|
||||
const T* data() const { return m_data; }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return __String<T, ThisXStringClass>::_data(pos); }
|
||||
const T* data(IntegralType pos) const { return __String<T, ThisXStringClass>::_data(pos); }
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) { return __String<T, ThisXStringClass>::_data(pos); }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size)
|
||||
@ -1097,6 +1142,13 @@ public:
|
||||
return *((ThisXStringClass*)this);
|
||||
}
|
||||
|
||||
ThisXStringClass& stealValueFrom(ThisXStringClass* S) {
|
||||
if ( m_allocatedSize > 0 ) free((void*)m_data);
|
||||
m_allocatedSize = S->m_allocatedSize;
|
||||
m_data = S->forgetDataWithoutFreeing();
|
||||
return *((ThisXStringClass*)this);
|
||||
}
|
||||
|
||||
/* takeValueFrom */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
|
@ -1696,6 +1696,14 @@ int XString_tests()
|
||||
t16.stealValueFrom(p16);
|
||||
}
|
||||
|
||||
{
|
||||
XString8 xs8 = "11"_XS8;
|
||||
bool b = xs8.startWithOrEqualTo("112");
|
||||
if ( b ) {
|
||||
nbTestFailed += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
|
||||
|
@ -447,7 +447,6 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
|
||||
IN CONST XStringW& FullTitle,
|
||||
IN CONST XStringW& LoaderTitle,
|
||||
IN REFIT_VOLUME *Volume,
|
||||
IN const XStringW& APFSTargetUUID,
|
||||
IN XIcon *Image,
|
||||
IN XIcon *DriveImage,
|
||||
IN UINT8 OSType,
|
||||
@ -581,7 +580,16 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
|
||||
}
|
||||
Entry->Row = 0;
|
||||
Entry->Volume = Volume;
|
||||
Entry->APFSTargetUUID = APFSTargetUUID;
|
||||
|
||||
if ( LoaderPath.length() >= 38 ) {
|
||||
if ( isPathSeparator(LoaderPath[0]) && isPathSeparator(LoaderPath[37]) ) {
|
||||
if ( IsValidGuidString(LoaderPath.data(1), 36) ) {
|
||||
Entry->APFSTargetUUID = LoaderPath.subString(1, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Entry->APFSTargetUUID = APFSTargetUUID;
|
||||
|
||||
Entry->LoaderPath = LoaderPath;
|
||||
Entry->DisplayedVolName = Volume->VolName;
|
||||
@ -614,8 +622,8 @@ if ( Entry->APFSTargetUUID.startWith("99999999") ) {
|
||||
DBG("%s", "");
|
||||
}
|
||||
#endif
|
||||
Entry->OSVersion = GetOSVersion(Entry);
|
||||
//DBG("OSVersion=%s \n", Entry->OSVersion);
|
||||
Entry->macOSVersion = GetOSVersion(Entry);
|
||||
DBG(" OSVersion=%s \n", Entry->macOSVersion.asString().c_str());
|
||||
// detect specific loaders
|
||||
XStringW OSIconName;
|
||||
ShortcutLetter = 0;
|
||||
@ -624,7 +632,7 @@ if ( Entry->APFSTargetUUID.startWith("99999999") ) {
|
||||
case OSTYPE_OSX:
|
||||
case OSTYPE_RECOVERY:
|
||||
case OSTYPE_OSX_INSTALLER:
|
||||
OSIconName = GetOSIconName(Entry->OSVersion);// Sothor - Get OSIcon name using OSVersion
|
||||
OSIconName = GetOSIconName(Entry->macOSVersion);// Sothor - Get OSIcon name using OSVersion
|
||||
// apianti - force custom logo even when verbose
|
||||
/* this is not needed, as this flag is also being unset when booting if -v is present (LoadOptions may change until then)
|
||||
if ( Entry->LoadOptions.containsIC("-v") ) {
|
||||
@ -794,11 +802,11 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
constexpr LString8 splashLitteral = "splash";
|
||||
|
||||
// Only kernels up to 10.7 have 32-bit mode
|
||||
KernelIs64BitOnly = (OSVersion.isEmpty() ||
|
||||
OSVersion >= MacOsVersion("10.8"_XS8));
|
||||
KernelIs64BitOnly = (macOSVersion.isEmpty() ||
|
||||
macOSVersion >= MacOsVersion("10.8"_XS8));
|
||||
|
||||
const char* macOS = (OSVersion.notEmpty() && OSVersion < MacOsVersion("10.8"_XS8))? "Mac OS X" :
|
||||
(OSVersion.notEmpty() && OSVersion < MacOsVersion("10.12"_XS8))? "OS X" : "macOS";
|
||||
const char* macOS = (macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.8"_XS8))? "Mac OS X" :
|
||||
(macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.12"_XS8))? "OS X" : "macOS";
|
||||
|
||||
FileName = LoaderPath.basename();
|
||||
|
||||
@ -834,7 +842,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
if (LoaderType == OSTYPE_OSX ||
|
||||
LoaderType == OSTYPE_OSX_INSTALLER ||
|
||||
LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
|
||||
SubScreen->AddMenuInfoLine_f("%s: %s", macOS, OSVersion.asString().c_str());
|
||||
SubScreen->AddMenuInfoLine_f("%s: %s", macOS, macOSVersion.asString().c_str());
|
||||
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_HIBERNATED)) {
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
@ -870,7 +878,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(), true);
|
||||
SubScreen->AddMenuInfo_f("=== boot-args ===");
|
||||
if (!KernelIs64BitOnly) {
|
||||
if ( OSVersion.notEmpty() && OSVersion < MacOsVersion("10.8"_XS8) ) {
|
||||
if ( macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.8"_XS8) ) {
|
||||
SubScreen->AddMenuCheck("Mac OS X 32bit", OPT_I386, 68);
|
||||
}
|
||||
// SubScreen->AddMenuCheck(XString8().SPrintf("%s 64bit", macOS).c_str(), OPT_X64, 68);
|
||||
@ -878,7 +886,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
}
|
||||
SubScreen->AddMenuCheck("Verbose (-v)", OPT_VERBOSE, 68);
|
||||
// No Caches option works on 10.6 - 10.9
|
||||
if ( OSVersion.notEmpty() && OSVersion < MacOsVersion("10.10"_XS8) ) {
|
||||
if ( macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10"_XS8) ) {
|
||||
SubScreen->AddMenuCheck("Without caches (-f)", OPT_NOCACHES, 68);
|
||||
}
|
||||
SubScreen->AddMenuCheck("Single User (-s)", OPT_SINGLE_USER, 68);
|
||||
@ -1007,7 +1015,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
|
||||
LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Array& LoaderOptions,
|
||||
IN CONST XStringW& FullTitle, IN CONST XStringW& LoaderTitle,
|
||||
IN REFIT_VOLUME *Volume, IN const XStringW& APFSTargetUUID, IN XIcon *Image,
|
||||
IN REFIT_VOLUME *Volume, IN XIcon *Image,
|
||||
IN UINT8 OSType, IN UINT8 Flags)
|
||||
{
|
||||
LOADER_ENTRY *Entry;
|
||||
@ -1036,9 +1044,15 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
|
||||
// }
|
||||
if ( Volume->ApfsContainerUUID.notEmpty() ) DBG(" ApfsContainerUUID=%s\n", Volume->ApfsContainerUUID.c_str());
|
||||
if ( Volume->ApfsFileSystemUUID.notEmpty() ) DBG(" ApfsFileSystemUUID=%s\n", Volume->ApfsFileSystemUUID.c_str());
|
||||
if ( APFSTargetUUID.notEmpty() ) DBG(" APFSTargetUUID=%ls\n", APFSTargetUUID.wc_str());
|
||||
if ( LoaderPath.length() >= 38 ) {
|
||||
if ( isPathSeparator(LoaderPath[0]) && isPathSeparator(LoaderPath[37]) ) {
|
||||
if ( IsValidGuidString(LoaderPath.data(1), 36) ) {
|
||||
DBG(" APFSTargetUUID=%.*ls\n", 36, LoaderPath.data(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, APFSTargetUUID, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE);
|
||||
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE);
|
||||
if (Entry != NULL) {
|
||||
if ((Entry->LoaderType == OSTYPE_OSX) ||
|
||||
(Entry->LoaderType == OSTYPE_OSX_INSTALLER ) ||
|
||||
@ -1067,6 +1081,7 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
|
||||
//TODO there is a problem that Entry->Flags is unique while InputItems are global ;(
|
||||
// InputItems[69].IValue = Entry->Flags;
|
||||
Entry->AddDefaultMenu();
|
||||
DBG(" Menu entry added at index %zd\n", MainMenu.Entries.size());
|
||||
MainMenu.AddMenuEntry(Entry, true);
|
||||
return Entry;
|
||||
}
|
||||
@ -1124,7 +1139,7 @@ STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
|
||||
DirIterClose(&DirIter);
|
||||
return;
|
||||
}
|
||||
AddLoaderEntry(File, NullXString8Array, L""_XSW, LoaderTitle, Volume, L""_XSW,
|
||||
AddLoaderEntry(File, NullXString8Array, L""_XSW, LoaderTitle, Volume,
|
||||
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
|
||||
} //anyway continue search other entries
|
||||
}
|
||||
@ -1146,7 +1161,7 @@ STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
|
||||
}
|
||||
return;
|
||||
}
|
||||
AddLoaderEntry(LinuxEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume, L""_XSW,
|
||||
AddLoaderEntry(LinuxEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume,
|
||||
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
|
||||
}
|
||||
}
|
||||
@ -1274,7 +1289,7 @@ STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
|
||||
}
|
||||
XString8Array Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXString8Array);
|
||||
// Add the entry
|
||||
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, L""_XSW, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
|
||||
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
|
||||
Path.setEmpty();
|
||||
}
|
||||
|
||||
@ -1289,7 +1304,7 @@ STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
|
||||
Path.SWPrintf("%ls\\%ls", LINUX_BOOT_PATH, FileInfo->FileName);
|
||||
XString8Array Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXString8Array);
|
||||
// Add the entry
|
||||
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, L""_XSW, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
|
||||
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
|
||||
Path.setEmpty();
|
||||
}
|
||||
}
|
||||
@ -1319,16 +1334,16 @@ void AddPRSEntry(REFIT_VOLUME *Volume)
|
||||
switch (WhatBoot) {
|
||||
case Paper:
|
||||
case (Paper | Rock):
|
||||
AddLoaderEntry(PaperBoot, NullXString8Array, L""_XSW, L"macOS InstallP"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
AddLoaderEntry(PaperBoot, NullXString8Array, L""_XSW, L"macOS InstallP"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
break;
|
||||
case Scissor:
|
||||
case (Paper | Scissor):
|
||||
AddLoaderEntry(ScissorBoot, NullXString8Array, L""_XSW, L"macOS InstallS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
AddLoaderEntry(ScissorBoot, NullXString8Array, L""_XSW, L"macOS InstallS"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
break;
|
||||
case Rock:
|
||||
case (Rock | Scissor):
|
||||
case (Rock | Scissor | Paper):
|
||||
AddLoaderEntry(RockBoot, NullXString8Array, L""_XSW, L"macOS InstallR"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
AddLoaderEntry(RockBoot, NullXString8Array, L""_XSW, L"macOS InstallR"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1344,7 +1359,8 @@ void ScanLoader(void)
|
||||
//DBG("Scanning loaders...\n");
|
||||
DbgHeader("ScanLoader");
|
||||
|
||||
for (UINTN VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) {
|
||||
for (UINTN VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++)
|
||||
{
|
||||
REFIT_VOLUME* Volume = &Volumes[VolumeIndex];
|
||||
if (Volume->RootDir == NULL) { // || Volume->VolName == NULL)
|
||||
//DBG(", no file system\n", VolumeIndex);
|
||||
@ -1370,41 +1386,46 @@ void ScanLoader(void)
|
||||
if (FileExists(Volume->RootDir, L"\\Install OS X Mavericks.app") ||
|
||||
FileExists(Volume->RootDir, L"\\Install OS X Yosemite.app") ||
|
||||
FileExists(Volume->RootDir, L"\\Install OS X El Capitan.app")) {
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
|
||||
} else {
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.13.3
|
||||
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.13.3
|
||||
}
|
||||
} else if (FileExists(Volume->RootDir, L"\\.IAPhysicalMedia") && FileExists(Volume->RootDir, MACOSX_LOADER_PATH)) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.13.4+
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.13.4+
|
||||
}
|
||||
// 2nd stage - InstallESD/AppStore/startosinstall/Fusion Drive
|
||||
AddLoaderEntry(L"\\Mac OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
AddLoaderEntry(L"\\OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
|
||||
AddLoaderEntry(L"\\macOS Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.12.3
|
||||
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\Boot Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12.4+
|
||||
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.16+
|
||||
// 10.7
|
||||
AddLoaderEntry(L"\\Mac OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
// 10.8 - 10.11
|
||||
AddLoaderEntry(L"\\OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
|
||||
// 10.12 - 10.12.3
|
||||
AddLoaderEntry(L"\\macOS Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.12.3
|
||||
// 10.12.4-10.15
|
||||
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\Boot Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
// Big Sur install must be via Preboot. Next line must stay commented.
|
||||
// AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 11+
|
||||
AddPRSEntry(Volume); // 10.12+
|
||||
|
||||
// Netinstall
|
||||
AddLoaderEntry(L"\\NetInstall macOS High Sierra.nbi\\i386\\booter"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
AddLoaderEntry(L"\\NetInstall macOS High Sierra.nbi\\i386\\booter"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
// Use standard location for boot.efi, according to the install files is present
|
||||
// That file indentifies a DVD/ESD/BaseSystem/Fusion Drive Install Media, so when present, check standard path to avoid entry duplication
|
||||
if (FileExists(Volume->RootDir, MACOSX_LOADER_PATH)) {
|
||||
if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app")) {
|
||||
// InstallDVD/BaseSystem
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.6/10.7
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.6/10.7
|
||||
} else if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app")) {
|
||||
// BaseSystem
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
|
||||
} else if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app")) {
|
||||
// BaseSystem
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12+
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12+
|
||||
} else if (FileExists(Volume->RootDir, L"\\BaseSystem.dmg") && FileExists(Volume->RootDir, L"\\mach_kernel")) {
|
||||
// InstallESD
|
||||
if (FileExists(Volume->RootDir, L"\\MacOSX_Media_Background.png")) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
|
||||
} else {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8
|
||||
}
|
||||
} else if (FileExists(Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
FileExists(Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
|
||||
@ -1412,18 +1433,18 @@ void ScanLoader(void)
|
||||
if (StriStr(Volume->VolName.wc_str(), L"Recovery") != NULL) {
|
||||
// FileVault of HFS+
|
||||
// TODO: need info for 10.11 and lower
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS FileVault"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS FileVault"_XSW, Volume, NULL, OSTYPE_OSX, 0); // 10.12+
|
||||
} else {
|
||||
// Fusion Drive
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.11
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.11
|
||||
}
|
||||
} else if (!FileExists(Volume->RootDir, L"\\.IAPhysicalMedia")) {
|
||||
// Installed
|
||||
if (EFI_ERROR(GetRootUUID(Volume)) || isFirstRootUUID(Volume)) {
|
||||
if (!FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\NotificationCenter.app") && !FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\Siri.app")) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.6 - 10.7
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X"_XSW, Volume, NULL, OSTYPE_OSX, 0); // 10.6 - 10.7
|
||||
} else if (FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\NotificationCenter.app") && !FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\Siri.app")) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.8 - 10.11
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X"_XSW, Volume, NULL, OSTYPE_OSX, 0); // 10.8 - 10.11
|
||||
} else {
|
||||
XString8 OSVersion;
|
||||
if ( Volume->ApfsFileSystemUUID.notEmpty() && (Volume->ApfsRole & APPLE_APFS_VOLUME_ROLE_SYSTEM) != 0 )
|
||||
@ -1458,8 +1479,8 @@ void ScanLoader(void)
|
||||
if ( PlistBuffer ) FreePool(PlistBuffer);
|
||||
}
|
||||
}
|
||||
if ( !OSVersion.equal("11.0") ) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
|
||||
if ( MacOsVersion(OSVersion) < MacOsVersion("11"_XS8) ) {
|
||||
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS"_XSW, Volume, NULL, OSTYPE_OSX, 0); // 10.12+
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1467,23 +1488,23 @@ void ScanLoader(void)
|
||||
}
|
||||
|
||||
// check for Mac OS X Recovery Boot
|
||||
AddLoaderEntry(L"\\com.apple.recovery.boot\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Recovery"_XSW, Volume, L""_XSW, NULL, OSTYPE_RECOVERY, 0);
|
||||
AddLoaderEntry(L"\\com.apple.recovery.boot\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Recovery"_XSW, Volume, NULL, OSTYPE_RECOVERY, 0);
|
||||
|
||||
// Sometimes, on some systems (HP UEFI, if Win is installed first)
|
||||
// it is needed to get rid of bootmgfw.efi to allow starting of
|
||||
// Clover as /efi/boot/bootx64.efi from HD. We can do that by renaming
|
||||
// bootmgfw.efi to bootmgfw-orig.efi
|
||||
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw-orig.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
|
||||
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw-orig.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI"_XSW, Volume, NULL, OSTYPE_WINEFI, 0);
|
||||
// check for Microsoft boot loader/menu
|
||||
// If there is bootmgfw-orig.efi, then do not check for bootmgfw.efi
|
||||
// since on some systems this will actually be CloverX64.efi
|
||||
// renamed to bootmgfw.efi
|
||||
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI Boot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
|
||||
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI Boot"_XSW, Volume, NULL, OSTYPE_WINEFI, 0);
|
||||
// check for Microsoft boot loader/menu. This entry is redundant so excluded
|
||||
// AddLoaderEntry(L"\\bootmgr.efi", L"", L"Microsoft EFI mgrboot", Volume, NULL, OSTYPE_WINEFI, 0);
|
||||
// check for Microsoft boot loader/menu on CDROM
|
||||
if (!AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI cdboot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0)) {
|
||||
AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\CDBOOT.EFI"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI CDBOOT"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
|
||||
if (!AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI cdboot"_XSW, Volume, NULL, OSTYPE_WINEFI, 0)) {
|
||||
AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\CDBOOT.EFI"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI CDBOOT"_XSW, Volume, NULL, OSTYPE_WINEFI, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1501,7 +1522,7 @@ void ScanLoader(void)
|
||||
XIcon ImageX;
|
||||
XStringW IconXSW = XStringW().takeValueFrom(AndroidEntryData[Index].Icon);
|
||||
ImageX.LoadXImage(&ThemeX.getThemeDir(), (L"os_"_XSW + IconXSW.subString(0, IconXSW.indexOf(','))).wc_str());
|
||||
AddLoaderEntry(AndroidEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume, L""_XSW,
|
||||
AddLoaderEntry(AndroidEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume,
|
||||
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
|
||||
}
|
||||
}
|
||||
@ -1515,16 +1536,16 @@ void ScanLoader(void)
|
||||
|
||||
// DBG("search for optical UEFI\n");
|
||||
if (Volume->DiskKind == DISK_KIND_OPTICAL) {
|
||||
AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI optical"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, 0);
|
||||
AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI optical"_XSW, Volume, NULL, OSTYPE_OTHER, 0);
|
||||
}
|
||||
// DBG("search for internal UEFI\n");
|
||||
if (Volume->DiskKind == DISK_KIND_INTERNAL) {
|
||||
LOADER_ENTRY* le = AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI internal"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, 0);
|
||||
LOADER_ENTRY* le = AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI internal"_XSW, Volume, NULL, OSTYPE_OTHER, 0);
|
||||
le->Hidden = true;
|
||||
}
|
||||
// DBG("search for external UEFI\n");
|
||||
if (Volume->DiskKind == DISK_KIND_EXTERNAL) {
|
||||
LOADER_ENTRY* le = AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI external"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, 0);
|
||||
LOADER_ENTRY* le = AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI external"_XSW, Volume, NULL, OSTYPE_OTHER, 0);
|
||||
le->Hidden = true;
|
||||
}
|
||||
|
||||
@ -1599,7 +1620,9 @@ void ScanLoader(void)
|
||||
FullTitle.SWPrintf("Boot Mac OS X from %.*s via %ls", (int)fileLen, fileBuffer, Volume->getVolLabelOrOSXVolumeNameOrVolName().wc_str());
|
||||
FullTitleRecovery.SWPrintf("Boot Mac OS X Recovery for %.*s via %ls", (int)fileLen, fileBuffer, Volume->getVolLabelOrOSXVolumeNameOrVolName().wc_str());
|
||||
FullTitleInstaller.SWPrintf("Boot Mac OS X Install for %.*s via %ls", (int)fileLen, fileBuffer, Volume->getVolLabelOrOSXVolumeNameOrVolName().wc_str());
|
||||
DBG("contentDetails name:%s\n", fileBuffer);
|
||||
if ( fileLen < MAX_INT32 ) {
|
||||
DBG(" contentDetails name:%.*s\n", (int)fileLen, fileBuffer);
|
||||
}
|
||||
FreePool(fileBuffer);
|
||||
}
|
||||
}
|
||||
@ -1616,14 +1639,14 @@ void ScanLoader(void)
|
||||
FullTitleInstaller.SWPrintf("Mac OS X Install via %ls", Volume->getVolLabelOrOSXVolumeNameOrVolName().wc_str());
|
||||
}
|
||||
}
|
||||
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXString8Array, FullTitle, LoaderTitle, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
|
||||
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXString8Array, FullTitle, LoaderTitle, Volume, NULL, OSTYPE_OSX, 0);
|
||||
//Try to add Recovery APFS entry
|
||||
if (!AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleRecovery, L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0)) {
|
||||
if (!AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleRecovery, L""_XSW, Volume, NULL, OSTYPE_RECOVERY, 0)) {
|
||||
//Try to add Recovery APFS entry as dmg
|
||||
AddLoaderEntry(SWPrintf("\\%s\\BaseSystem.dmg", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleRecovery, L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
|
||||
AddLoaderEntry(SWPrintf("\\%s\\BaseSystem.dmg", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleRecovery, L""_XSW, Volume, NULL, OSTYPE_RECOVERY, 0);
|
||||
}
|
||||
//Try to add macOS install entry
|
||||
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleInstaller, LoaderTitleInstaller, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, FullTitleInstaller, LoaderTitleInstaller, Volume, NULL, OSTYPE_OSX_INSTALLER, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1635,7 +1658,7 @@ void ScanLoader(void)
|
||||
if ( !loaderEntry1Ptr ) continue;
|
||||
LOADER_ENTRY& loaderEntry1 = *loaderEntry1Ptr;
|
||||
|
||||
if ( loaderEntry1.LoaderType == OSTYPE_OSX && loaderEntry1.APFSTargetUUID.notEmpty() )
|
||||
if ( ( loaderEntry1.LoaderType == OSTYPE_OSX || loaderEntry1.LoaderType == OSTYPE_OSX_INSTALLER ) && loaderEntry1.APFSTargetUUID.notEmpty() )
|
||||
{
|
||||
for ( size_t entryIdx2 = 0 ; entryIdx2 < MainMenu.Entries.sizeIncludingHidden() ; entryIdx2 ++ )
|
||||
{
|
||||
@ -1643,6 +1666,7 @@ void ScanLoader(void)
|
||||
LOADER_ENTRY& loaderEntry2 = *MainMenu.Entries.ElementAt(entryIdx2).getLOADER_ENTRY();
|
||||
if ( loaderEntry2.Volume->ApfsContainerUUID == loaderEntry1.Volume->ApfsContainerUUID ) {
|
||||
if ( loaderEntry2.Volume->ApfsFileSystemUUID == loaderEntry1.APFSTargetUUID ) {
|
||||
DBG("Hiding entry %zd because of entry %zd\n", entryIdx1, entryIdx2);
|
||||
loaderEntry1.Hidden = true;
|
||||
}
|
||||
}
|
||||
@ -1656,20 +1680,35 @@ void ScanLoader(void)
|
||||
REFIT_ABSTRACT_MENU_ENTRY* entry;
|
||||
EntryIdx(size_t _idx, REFIT_ABSTRACT_MENU_ENTRY* _entry) : idx(_idx), entry(_entry) {};
|
||||
} EntryIdx;
|
||||
|
||||
XObjArray<EntryIdx> EntriesArrayTmp;
|
||||
|
||||
for (size_t idx = 0; idx < MainMenu.Entries.sizeIncludingHidden(); idx++) {
|
||||
if ( MainMenu.Entries.ElementAt(idx).getLOADER_ENTRY() ) {
|
||||
if ( MainMenu.Entries.ElementAt(idx).getLOADER_ENTRY()->APFSTargetUUID.notEmpty() ) {
|
||||
// DBG("Add in EntriesArrayTmp at index %zd Entry %zd : %ls\n", EntriesArrayTmp.size(), idx, MainMenu.Entries.ElementAt(idx).Title.wc_str());
|
||||
EntriesArrayTmp.AddReference(new EntryIdx(idx, &MainMenu.Entries.ElementAt(idx)), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBG("Entries list before ordering\n");
|
||||
for (size_t idx = 0; idx < MainMenu.Entries.sizeIncludingHidden(); idx++) {
|
||||
if ( MainMenu.Entries.ElementAt(idx).getLOADER_ENTRY() ) {
|
||||
DBG(" Entry %zd : %ls\n", idx, MainMenu.Entries.ElementAt(idx).Title.wc_str());
|
||||
}else{
|
||||
DBG(" Entry %zd : %ls\n", idx, MainMenu.Entries.ElementAt(idx).Title.wc_str());
|
||||
}
|
||||
}
|
||||
|
||||
// DBG("Entries list before ordering\n");
|
||||
// for (size_t idx = 0; idx < EntriesArrayTmp.size(); idx++) {
|
||||
// DBG(" Entry %zd, EntriesArrayTmp %zd : %ls\n", EntriesArrayTmp.ElementAt(idx).idx, idx, EntriesArrayTmp.ElementAt(idx).entry->Title.wc_str());
|
||||
// }
|
||||
|
||||
|
||||
bool hasMovedSomething;
|
||||
|
||||
//MainMenu.Entries.moveBefore(5, 7); // this will move preboot entry just before main
|
||||
|
||||
// Re-order preboot partition
|
||||
do {
|
||||
hasMovedSomething = false;
|
||||
@ -1687,9 +1726,9 @@ void ScanLoader(void)
|
||||
{
|
||||
size_t prebootIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
if ( prebootIdx == SIZE_T_MAX ) panic ("bug");
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID);
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX && idxMain != prebootIdx+1 ) {
|
||||
DBG("Move preboot entry %zu before system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
DBG("Move preboot entry %zu before system %zu\n", prebootIdx, idxMain);
|
||||
MainMenu.Entries.moveBefore(prebootIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
@ -1716,7 +1755,7 @@ void ScanLoader(void)
|
||||
{
|
||||
size_t installerIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
if ( installerIdx == SIZE_T_MAX ) panic ("bug");
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID);
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot != installerIdx + 1 ) {
|
||||
DBG("Move installer entry %zu before preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
@ -1725,7 +1764,7 @@ void ScanLoader(void)
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}else{
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID);
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain != installerIdx+1 ) {
|
||||
DBG("Move installer entry %zu before system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
@ -1757,7 +1796,7 @@ void ScanLoader(void)
|
||||
{
|
||||
size_t recoveryIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
if ( recoveryIdx == SIZE_T_MAX ) panic ("bug");
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID);
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
@ -1766,7 +1805,7 @@ void ScanLoader(void)
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}else{
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID);
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
@ -2091,7 +2130,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
|
||||
|
||||
DBG("match!\n");
|
||||
// Create an entry for this volume
|
||||
Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom->FullTitle, Custom->Title, Volume, L""_XSW,
|
||||
Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom->FullTitle, Custom->Title, Volume,
|
||||
(Image.isEmpty() ? NULL : &Image), (DriveImage.isEmpty() ? NULL : &DriveImage),
|
||||
Custom->Type, Custom->Flags, Custom->Hotkey, Custom->BootBgColor, Custom->CustomBoot, &Custom->CustomLogo,
|
||||
/*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE);
|
||||
|
@ -148,6 +148,22 @@ public:
|
||||
return SIZE_T_MAX;
|
||||
}
|
||||
|
||||
size_t getApfsLoaderIdx(const XString8& ApfsContainerUUID, const XString8& ApfsFileSystemUUID, uint8_t osType)
|
||||
{
|
||||
for ( size_t i=0 ; i < XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::size() ; i++ ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY() ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->LoaderType == osType ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->Volume->ApfsContainerUUID == ApfsContainerUUID ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->Volume->ApfsFileSystemUUID == ApfsFileSystemUUID ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SIZE_T_MAX;
|
||||
}
|
||||
|
||||
size_t getApfsPrebootLoaderIdx(const XString8& ApfsContainerUUID, const XString8& ApfsFileSystemUUID)
|
||||
{
|
||||
for ( size_t i=0 ; i < XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::size() ; i++ ) {
|
||||
@ -164,6 +180,24 @@ public:
|
||||
return SIZE_T_MAX;
|
||||
}
|
||||
|
||||
size_t getApfsPrebootLoaderIdx(const XString8& ApfsContainerUUID, const XString8& ApfsFileSystemUUID, uint8_t osType)
|
||||
{
|
||||
for ( size_t i=0 ; i < XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::size() ; i++ ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY() ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->LoaderType == osType ) {
|
||||
if ( (XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->Volume->ApfsRole & APPLE_APFS_VOLUME_ROLE_PREBOOT) != 0 ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->Volume->ApfsContainerUUID == ApfsContainerUUID ) {
|
||||
if ( XObjArray<REFIT_ABSTRACT_MENU_ENTRY>::ElementAt(i).getLOADER_ENTRY()->APFSTargetUUID == ApfsFileSystemUUID ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SIZE_T_MAX;
|
||||
}
|
||||
|
||||
template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
|
||||
void moveBefore(IntegralType1 idxFrom, IntegralType2 idxTo)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ LOADER_ENTRY* LOADER_ENTRY::getPartiallyDuplicatedEntry() const
|
||||
DuplicateEntry->DevicePath = DevicePath;
|
||||
DuplicateEntry->Flags = Flags;
|
||||
DuplicateEntry->LoaderType = LoaderType;
|
||||
DuplicateEntry->OSVersion = OSVersion;
|
||||
DuplicateEntry->macOSVersion = macOSVersion;
|
||||
DuplicateEntry->BuildVersion = BuildVersion;
|
||||
// CopyKernelAndKextPatches(&DuplicateEntry->KernelAndKextPatches, &KernelAndKextPatches);
|
||||
DuplicateEntry->KernelAndKextPatches = KernelAndKextPatches;
|
||||
|
@ -371,7 +371,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
UINT16 Flags;
|
||||
UINT8 LoaderType;
|
||||
MacOsVersion OSVersion;
|
||||
MacOsVersion macOSVersion;
|
||||
XString8 BuildVersion;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor;
|
||||
|
||||
@ -415,7 +415,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
|
||||
|
||||
LOADER_ENTRY()
|
||||
: REFIT_MENU_ITEM_BOOTNUM(), APFSTargetUUID(), DisplayedVolName(), DevicePath(0), Flags(0), LoaderType(0), OSVersion(), BuildVersion(),
|
||||
: REFIT_MENU_ITEM_BOOTNUM(), APFSTargetUUID(), DisplayedVolName(), DevicePath(0), Flags(0), LoaderType(0), macOSVersion(), BuildVersion(),
|
||||
BootBgColor({0,0,0,0}),
|
||||
CustomBoot(0), CustomLogo(), KernelAndKextPatches(), Settings(), KernelData(0),
|
||||
AddrVtable(0), SizeVtable(0), NamesTable(0), SegVAddr(0), shift(0),
|
||||
@ -467,7 +467,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
EFI_STATUS AddKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType);
|
||||
void LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
|
||||
// void AddKexts(const XStringW& SrcDir, const XStringW& Path, cpu_type_t archCpuType);
|
||||
void AddKextsFromDirInArray(const XString8& SrcDir, const XString8& Path, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray);
|
||||
void AddKextsFromDirInArray(const XString8& SrcDir, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray);
|
||||
void AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray);
|
||||
void KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);
|
||||
void KextPatcherStart();
|
||||
|
@ -113,7 +113,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
||||
LOADER_ENTRY* loaderEntry = Entry->getLOADER_ENTRY();
|
||||
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion
|
||||
if (gSettings.OptionsBits & OPT_NVWEBON) {
|
||||
if ( loaderEntry->OSVersion >= MacOsVersion("10.12"_XS8) ) {
|
||||
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) {
|
||||
gSettings.NvidiaWeb = TRUE;
|
||||
} else {
|
||||
//Entry->LoadOptions = loaderEntry->LoadOptions;
|
||||
@ -122,7 +122,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
||||
}
|
||||
}
|
||||
if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) {
|
||||
if ( loaderEntry->OSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) {
|
||||
gSettings.NvidiaWeb = FALSE;
|
||||
} else {
|
||||
//Entry->LoadOptions = loaderEntry->LoadOptions;
|
||||
|
@ -889,7 +889,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
||||
//DBG("Skip dot entries: %ls\n", DirEntry->FileName);
|
||||
continue;
|
||||
}
|
||||
if ( IsValidGuidAsciiString(LStringW(DirEntry->FileName)) ) {
|
||||
if ( IsValidGuidString(LStringW(DirEntry->FileName)) ) {
|
||||
Volume->ApfsTargetUUIDArray.Add(DirEntry->FileName);
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void LOADER_ENTRY::FilterKextPatches()
|
||||
i,
|
||||
KernelAndKextPatches.KextPatches[i].Label.c_str(),
|
||||
KernelAndKextPatches.KextPatches[i].IsPlistPatch ? "PlistPatch" : "BinPatch",
|
||||
OSVersion.asString().c_str(),
|
||||
macOSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.KextPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.KextPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.KextPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.KextPatches[i].MatchBuild.c_str() : "All"
|
||||
);
|
||||
@ -448,7 +448,7 @@ void LOADER_ENTRY::FilterKextPatches()
|
||||
continue;
|
||||
}
|
||||
|
||||
KernelAndKextPatches.KextPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KextPatches[i].MatchOS, OSVersion);
|
||||
KernelAndKextPatches.KextPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KextPatches[i].MatchOS, macOSVersion);
|
||||
DBG(" ==> %s\n", KernelAndKextPatches.KextPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
}
|
||||
}
|
||||
@ -462,7 +462,7 @@ void LOADER_ENTRY::FilterKernelPatches()
|
||||
DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
|
||||
i,
|
||||
KernelAndKextPatches.KernelPatches[i].Label.c_str(),
|
||||
OSVersion.asString().c_str(),
|
||||
macOSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.KernelPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.KernelPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.KernelPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.KernelPatches[i].MatchBuild.c_str() : "no"
|
||||
);
|
||||
@ -478,7 +478,7 @@ void LOADER_ENTRY::FilterKernelPatches()
|
||||
continue;
|
||||
}
|
||||
|
||||
KernelAndKextPatches.KernelPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KernelPatches[i].MatchOS, OSVersion);
|
||||
KernelAndKextPatches.KernelPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.KernelPatches[i].MatchOS, macOSVersion);
|
||||
DBG(" ==> %s by OS\n", KernelAndKextPatches.KernelPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
}
|
||||
}
|
||||
@ -492,7 +492,7 @@ void LOADER_ENTRY::FilterBootPatches()
|
||||
DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
|
||||
i,
|
||||
KernelAndKextPatches.BootPatches[i].Label.c_str(),
|
||||
OSVersion.asString().c_str(),
|
||||
macOSVersion.asString().c_str(),
|
||||
KernelAndKextPatches.BootPatches[i].MatchOS.notEmpty() ? KernelAndKextPatches.BootPatches[i].MatchOS.c_str() : "All",
|
||||
KernelAndKextPatches.BootPatches[i].MatchBuild.notEmpty() ? KernelAndKextPatches.BootPatches[i].MatchBuild.c_str() : "no"
|
||||
);
|
||||
@ -507,7 +507,7 @@ void LOADER_ENTRY::FilterBootPatches()
|
||||
continue;
|
||||
}
|
||||
|
||||
KernelAndKextPatches.BootPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.BootPatches[i].MatchOS, OSVersion);
|
||||
KernelAndKextPatches.BootPatches[i].MenuItem.BValue = IsPatchEnabled(KernelAndKextPatches.BootPatches[i].MatchOS, macOSVersion);
|
||||
DBG(" ==> %s by OS\n", KernelAndKextPatches.BootPatches[i].MenuItem.BValue ? "allowed" : "not allowed");
|
||||
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
// Correct OSVersion if it was not found
|
||||
// This should happen only for 10.7-10.9 OSTYPE_OSX_INSTALLER
|
||||
// For these cases, take OSVersion from loaded boot.efi image in memory
|
||||
if (/*LoaderType == OSTYPE_OSX_INSTALLER ||*/ OSVersion.isEmpty()) {
|
||||
if (/*LoaderType == OSTYPE_OSX_INSTALLER ||*/ macOSVersion.isEmpty()) {
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
// version in boot.efi appears as "Mac OS X 10.?"
|
||||
@ -1291,8 +1291,8 @@ void LOADER_ENTRY::StartLoader()
|
||||
InstallerVersion = NULL; // flag known version was not found
|
||||
}
|
||||
if (InstallerVersion != NULL) { // known version was found in image
|
||||
OSVersion = InstallerVersion;
|
||||
DBG("Corrected OSVersion: %s\n", OSVersion.asString().c_str());
|
||||
macOSVersion = InstallerVersion;
|
||||
DBG("Corrected OSVersion: %s\n", macOSVersion.asString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1300,12 +1300,12 @@ void LOADER_ENTRY::StartLoader()
|
||||
}
|
||||
|
||||
if (BuildVersion.notEmpty()) {
|
||||
DBG(" %s (%s)\n", OSVersion.asString().c_str(), BuildVersion.c_str());
|
||||
DBG(" %s (%s)\n", macOSVersion.asString().c_str(), BuildVersion.c_str());
|
||||
} else {
|
||||
DBG(" %s\n", OSVersion.asString().c_str());
|
||||
DBG(" %s\n", macOSVersion.asString().c_str());
|
||||
}
|
||||
|
||||
if ( OSVersion >= MacOsVersion("10.11"_XS8) ) {
|
||||
if ( macOSVersion >= MacOsVersion("10.11"_XS8) ) {
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_NOSIP)) {
|
||||
gSettings.CsrActiveConfig = (UINT32)0xB7F;
|
||||
gSettings.BooterConfig = 0x28;
|
||||
@ -1326,7 +1326,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
if ( OSFLAG_ISSET(Flags, OSFLAG_NOCACHES) && !LoadOptions.containsStartWithIC("Kernel=") ) {
|
||||
XString8 KernelLocation;
|
||||
|
||||
if ( OSVersion.notEmpty() && OSVersion <= MacOsVersion("10.9"_XS8) ) {
|
||||
if ( macOSVersion.notEmpty() && macOSVersion <= MacOsVersion("10.9"_XS8) ) {
|
||||
KernelLocation.S8Printf("\"Kernel=/mach_kernel\"");
|
||||
} else {
|
||||
// used for 10.10, 10.11, and new version. Jief : also for unknown version.
|
||||
@ -1345,7 +1345,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
CheckEmptyFB();
|
||||
PatchSmbios();
|
||||
// DBG("PatchACPI\n");
|
||||
PatchACPI(Volume, OSVersion);
|
||||
PatchACPI(Volume, macOSVersion);
|
||||
//
|
||||
// // If KPDebug is true boot in verbose mode to see the debug messages
|
||||
// if (KernelAndKextPatches.KPDebug) {
|
||||
@ -1390,7 +1390,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
if (KernelAndKextPatches.KPKernelXCPM &&
|
||||
gCPUStructure.Vendor == CPU_VENDOR_INTEL && gCPUStructure.Model >= CPU_MODEL_HASWELL &&
|
||||
(AsciiStrStr(gCPUStructure.BrandString, "Celeron") || AsciiStrStr(gCPUStructure.BrandString, "Pentium")) &&
|
||||
OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Haswell+ Celeron/Pentium
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
@ -1399,7 +1399,7 @@ void LOADER_ENTRY::StartLoader()
|
||||
// add -xcpm on Ivy Bridge if set KernelXCPM and system version is 10.8.5 - 10.11.x
|
||||
if (KernelAndKextPatches.KPKernelXCPM &&
|
||||
gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE &&
|
||||
OSVersion >= MacOsVersion("10.8.5"_XS8) && OSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8) &&
|
||||
(!LoadOptions.containsIC("-xcpm"))) {
|
||||
// add "-xcpm" argv if not present on Ivy Bridge
|
||||
LoadOptions.AddID("-xcpm"_XS8);
|
||||
|
@ -1765,13 +1765,12 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(const XString8& UniSysVer)
|
||||
REFIT_MENU_ITEM_OPTIONS *Entry = NULL;
|
||||
REFIT_MENU_SCREEN *SubScreen = NULL;
|
||||
REFIT_INPUT_DIALOG *InputBootArgs;
|
||||
XString8 sysVer = S8Printf("%s->", UniSysVer.c_str());
|
||||
|
||||
for ( size_t idx = 0 ; idx < InjectKextList.size() ; idx ++ ) {
|
||||
SIDELOAD_KEXT& Kext = InjectKextList[idx];
|
||||
if ( Kext.KextDirNameUnderOEMPath == UniSysVer ) {
|
||||
if ( SubScreen == NULL ) {
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXT_INJECT, S8Printf("%s->", UniSysVer.c_str()));
|
||||
SubScreen->AddMenuInfoLine_f("Choose/check kext to disable:");
|
||||
}
|
||||
InputBootArgs = new REFIT_INPUT_DIALOG;
|
||||
@ -1805,97 +1804,47 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
{
|
||||
LOADER_ENTRY *SubEntry;
|
||||
REFIT_MENU_SCREEN *SubSubScreen;
|
||||
XStringW kextDir;
|
||||
// UINTN i;
|
||||
// XString8 ShortOSVersion;
|
||||
// CHAR16 *UniSysVer = NULL;
|
||||
|
||||
SubEntry = new LOADER_ENTRY();
|
||||
NewEntry_(SubEntry, &SubSubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->"_XS8);
|
||||
SubEntry->Flags = Flags;
|
||||
if (OSVersion.notEmpty()) {
|
||||
// DBG("chosen os %s\n", ChosenOS);
|
||||
//shorten os version 10.11.6 -> 10.11
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// if (OSVersion[i] == '\0') {
|
||||
// break;
|
||||
// }
|
||||
// if (((i > 2) && (OSVersion[i] == '.')) || (i == 5)) {
|
||||
// break;
|
||||
// }
|
||||
// ShortOSVersion += OSVersion[i];
|
||||
// }
|
||||
if (macOSVersion.notEmpty()) {
|
||||
|
||||
XString8 ShortOSVersion = OSVersion.asString(2);
|
||||
XString8 DirName;
|
||||
XString8 OSVersionKextsDirName; // declare here to avoid multiple allocation
|
||||
|
||||
SubSubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s", ShortOSVersion.c_str());
|
||||
{
|
||||
XString8 ShortOSVersion = macOSVersion.nbElement() == 1 ? macOSVersion.asString(1) : macOSVersion.asString(macOSVersion.nbElement()-1);
|
||||
SubSubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s", ShortOSVersion.c_str());
|
||||
}
|
||||
|
||||
// Add kext from 10 or 11
|
||||
// if ( OSVersion.contains(".") )
|
||||
// {
|
||||
// XString8 osMajorVersion = OSVersion.subString(0, OSVersion.indexOf('.'));
|
||||
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersion.asString(1)), true);
|
||||
DirName = S8Printf("%d_%s", OSVersion.elementAt(0), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName = S8Printf("%d_install", OSVersion.elementAt(0));
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName = S8Printf("%d_recovery", OSVersion.elementAt(0));
|
||||
// }
|
||||
// else {
|
||||
// DirName = S8Printf("%d_normal", OSVersion.elementAt(0));
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
// }
|
||||
|
||||
// Add kext from 10.{version}
|
||||
{
|
||||
DirName.takeValueFrom(ShortOSVersion);
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
DirName = S8Printf("%s_%s", ShortOSVersion.c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
OSVersionKextsDirName = macOSVersion.asString(1);
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName.S8Printf("%s_install", ShortOSVersion.c_str());
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName.S8Printf("%s_recovery", ShortOSVersion.c_str());
|
||||
// }
|
||||
// else {
|
||||
// DirName.S8Printf("%s_normal", ShortOSVersion.c_str());
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
// Add kext from 10(or 11).{version}
|
||||
{
|
||||
OSVersionKextsDirName = macOSVersion.asString(2);
|
||||
if ( macOSVersion.elementAt(1) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
|
||||
// Add kext from :
|
||||
// 10.{version}.0 if NO minor version
|
||||
// 10.{version}.{minor version} if minor version is > 0
|
||||
{
|
||||
{
|
||||
XString8 OSVersionKextsDirName = OSVersion.asString(3);
|
||||
if ( OSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
DirName = S8Printf("%s_%s", OSVersion.asString(3).c_str(), getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
|
||||
// if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
// DirName.S8Printf("%s_install", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// else {
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
// DirName.S8Printf("%s_recovery", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// else {
|
||||
// DirName.S8Printf("%s_normal", OSVersion.asString(3).c_str());
|
||||
// }
|
||||
// }
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
// 10(or 11).{version}.0 if NO minor version
|
||||
// 10(or 11).{version}.{minor version} if minor version is > 0
|
||||
if ( macOSVersion.nbElement() >= 2 )
|
||||
{
|
||||
OSVersionKextsDirName = macOSVersion.asString(3);
|
||||
if ( macOSVersion.elementAt(1) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
if ( macOSVersion.elementAt(2) == -1 ) OSVersionKextsDirName.S8Catf(".0");
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
OSVersionKextsDirName.S8Catf("_%s", getSuffixForMacOsVersion(LoaderType).c_str());
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1903,6 +1852,7 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Unknown"_XS8), true);
|
||||
}
|
||||
|
||||
XStringW kextDir;
|
||||
kextDir = GetOtherKextsDir(TRUE);
|
||||
if ( kextDir.notEmpty() ) {
|
||||
SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Other"_XS8), true);
|
||||
|
Loading…
Reference in New Issue
Block a user