mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Merge pull request #52 from jief666/KextLoadingVersionMode
Kext loading new structure
This commit is contained in:
commit
9fccb22efa
@ -860,7 +860,7 @@ struct SIDELOAD_KEXT {
|
||||
SIDELOAD_KEXT *Next;
|
||||
SIDELOAD_KEXT *PlugInList;
|
||||
CHAR16 *FileName;
|
||||
CHAR16 *MatchOS;
|
||||
CHAR16 *KextDirNameUnderOEMPath;
|
||||
CHAR16 *Version;
|
||||
INPUT_ITEM MenuItem;
|
||||
};
|
||||
|
@ -3463,7 +3463,7 @@ CHAR16* GetBundleVersion(CHAR16 *FullName)
|
||||
return CFBundleVersion;
|
||||
}
|
||||
|
||||
VOID GetListOfInjectKext(CHAR16 *KextPath)
|
||||
VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
|
||||
{
|
||||
|
||||
REFIT_DIR_ITER DirIter;
|
||||
@ -3471,13 +3471,13 @@ VOID GetListOfInjectKext(CHAR16 *KextPath)
|
||||
SIDELOAD_KEXT* mKext;
|
||||
SIDELOAD_KEXT* mPlugInKext;
|
||||
CHAR16* FullName;
|
||||
CHAR16* FullPath = PoolPrint(L"%s\\KEXTS\\%s", OEMPath, KextPath);
|
||||
CHAR16* FullPath = PoolPrint(L"%s\\KEXTS\\%s", OEMPath, KextDirNameUnderOEMPath);
|
||||
REFIT_DIR_ITER PlugInsIter;
|
||||
EFI_FILE_INFO *PlugInEntry;
|
||||
CHAR16* PlugInsPath;
|
||||
CHAR16* PlugInsName;
|
||||
BOOLEAN Blocked = FALSE;
|
||||
if (StrCmp(KextPath, L"Off") == 0) {
|
||||
if (StrCmp(KextDirNameUnderOEMPath, L"Off") == 0) {
|
||||
Blocked = TRUE;
|
||||
}
|
||||
|
||||
@ -3495,7 +3495,7 @@ VOID GetListOfInjectKext(CHAR16 *KextPath)
|
||||
mKext = AllocateZeroPool (sizeof(SIDELOAD_KEXT));
|
||||
mKext->FileName = PoolPrint(L"%s", DirEntry->FileName);
|
||||
mKext->MenuItem.BValue = Blocked;
|
||||
mKext->MatchOS = PoolPrint(L"%s", KextPath);
|
||||
mKext->KextDirNameUnderOEMPath = PoolPrint(L"%s", KextDirNameUnderOEMPath);
|
||||
mKext->Next = InjectKextList;
|
||||
mKext->Version = GetBundleVersion(FullName);
|
||||
InjectKextList = mKext;
|
||||
@ -3514,7 +3514,7 @@ VOID GetListOfInjectKext(CHAR16 *KextPath)
|
||||
mPlugInKext = AllocateZeroPool(sizeof(SIDELOAD_KEXT));
|
||||
mPlugInKext->FileName = PoolPrint(L"%s", PlugInEntry->FileName);
|
||||
mPlugInKext->MenuItem.BValue = Blocked;
|
||||
mPlugInKext->MatchOS = PoolPrint(L"%s", KextPath);
|
||||
mPlugInKext->KextDirNameUnderOEMPath = PoolPrint(L"%s", KextDirNameUnderOEMPath);
|
||||
mPlugInKext->Next = mKext->PlugInList;
|
||||
mPlugInKext->Version = GetBundleVersion(PlugInsName);
|
||||
mKext->PlugInList = mPlugInKext;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Platform.h"
|
||||
|
||||
#define KEXT_INJECT_DEBUG 0
|
||||
#define KEXT_INJECT_DEBUG 2
|
||||
|
||||
#if KEXT_INJECT_DEBUG == 2
|
||||
#define DBG(...) MsgLog(__VA_ARGS__)
|
||||
@ -99,20 +99,20 @@ BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
|
||||
else
|
||||
osbundlerequired[0] = '\0';
|
||||
|
||||
if (OSTYPE_IS_OSX_RECOVERY(loaderType)) {
|
||||
if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
|
||||
AsciiStrnCmp(osbundlerequired, "local", 5) &&
|
||||
AsciiStrnCmp(osbundlerequired, "console", 7) &&
|
||||
AsciiStrnCmp(osbundlerequired, "network-root", 12)) {
|
||||
inject = FALSE;
|
||||
}
|
||||
} else if (OSTYPE_IS_OSX_INSTALLER(loaderType)) {
|
||||
if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
|
||||
AsciiStrnCmp(osbundlerequired, "local", 5) &&
|
||||
AsciiStrnCmp(osbundlerequired, "console", 7)) {
|
||||
inject = FALSE;
|
||||
}
|
||||
}
|
||||
// if (OSTYPE_IS_OSX_RECOVERY(loaderType)) {
|
||||
// if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
|
||||
// AsciiStrnCmp(osbundlerequired, "local", 5) &&
|
||||
// AsciiStrnCmp(osbundlerequired, "console", 7) &&
|
||||
// AsciiStrnCmp(osbundlerequired, "network-root", 12)) {
|
||||
// inject = FALSE;
|
||||
// }
|
||||
// } else if (OSTYPE_IS_OSX_INSTALLER(loaderType)) {
|
||||
// if (AsciiStrnCmp(osbundlerequired, "root", 4) &&
|
||||
// AsciiStrnCmp(osbundlerequired, "local", 5) &&
|
||||
// AsciiStrnCmp(osbundlerequired, "console", 7)) {
|
||||
// inject = FALSE;
|
||||
// }
|
||||
// }
|
||||
|
||||
return inject;
|
||||
}
|
||||
@ -277,7 +277,7 @@ VOID LoadPlugInKexts(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR16 *Di
|
||||
DirIterClose(&PlugInIter);
|
||||
}
|
||||
|
||||
VOID AddKexts(IN LOADER_ENTRY *Entry, CHAR16 *SrcDir, CHAR16 *Path, CHAR16 *UniSysVers, cpu_type_t archCpuType)
|
||||
VOID AddKexts(IN LOADER_ENTRY *Entry, CHAR16 *SrcDir, CHAR16 *Path/*, CHAR16 *UniSysVers*/, cpu_type_t archCpuType)
|
||||
{
|
||||
CHAR16 FileName[256];
|
||||
CHAR16 PlugInName[256];
|
||||
@ -288,12 +288,12 @@ VOID AddKexts(IN LOADER_ENTRY *Entry, CHAR16 *SrcDir, CHAR16 *Path, CHAR16 *UniS
|
||||
MsgLog("Preparing kexts injection for arch=%s from %s\n", (archCpuType==CPU_TYPE_X86_64)?L"x86_64":(archCpuType==CPU_TYPE_I386)?L"i386":L"", SrcDir);
|
||||
CurrentKext = InjectKextList;
|
||||
while (CurrentKext) {
|
||||
DBG("current kext name %s Match %s, while sysver: %s\n", CurrentKext->FileName, CurrentKext->MatchOS, UniSysVers);
|
||||
if (StrStr(CurrentKext->MatchOS, Path) != NULL) {
|
||||
DBG(" current kext name=%s path=%s, match against=%s\n", CurrentKext->FileName, CurrentKext->KextDirNameUnderOEMPath, Path);
|
||||
if (StrCmp(CurrentKext->KextDirNameUnderOEMPath, Path) == 0) {
|
||||
UnicodeSPrint(FileName, 512, L"%s\\%s", SrcDir, CurrentKext->FileName);
|
||||
if (!(CurrentKext->MenuItem.BValue)) {
|
||||
// inject require
|
||||
MsgLog("Extra kext: %s (v.%s)\n", FileName, CurrentKext->Version);
|
||||
MsgLog("->Extra kext: %s (v.%s)\n", FileName, CurrentKext->Version);
|
||||
Status = AddKext(Entry, SelfVolume->RootDir, FileName, archCpuType);
|
||||
if(!EFI_ERROR(Status)) {
|
||||
// decide which plugins to inject
|
||||
@ -302,10 +302,10 @@ VOID AddKexts(IN LOADER_ENTRY *Entry, CHAR16 *SrcDir, CHAR16 *Path, CHAR16 *UniS
|
||||
UnicodeSPrint(PlugInName, 512, L"%s\\%s\\%s", FileName, L"Contents\\PlugIns", CurrentPlugInKext->FileName);
|
||||
if (!(CurrentPlugInKext->MenuItem.BValue)) {
|
||||
// inject PlugIn require
|
||||
MsgLog(" |-- PlugIn kext: %s (v.%s)\n", PlugInName, CurrentPlugInKext->Version);
|
||||
MsgLog(" |-- PlugIn kext: %s (v.%s)\n", PlugInName, CurrentPlugInKext->Version);
|
||||
AddKext(Entry, SelfVolume->RootDir, PlugInName, archCpuType);
|
||||
} else {
|
||||
MsgLog(" |-- Disabled plug-in kext: %s (v.%s)\n", PlugInName, CurrentPlugInKext->Version);
|
||||
MsgLog(" |-- Disabled plug-in kext: %s (v.%s)\n", PlugInName, CurrentPlugInKext->Version);
|
||||
}
|
||||
CurrentPlugInKext = CurrentPlugInKext->Next;
|
||||
} // end of plug-in kext injection
|
||||
@ -319,6 +319,21 @@ VOID AddKexts(IN LOADER_ENTRY *Entry, CHAR16 *SrcDir, CHAR16 *Path, CHAR16 *UniS
|
||||
} // end of kext injection
|
||||
|
||||
}
|
||||
//
|
||||
//CHAR16* tryKextDir(CHAR16* FormatString, ...)
|
||||
//{
|
||||
// VA_LIST Marker;
|
||||
// CHAR16 Dir[1024];
|
||||
//
|
||||
// // Make sure the buffer is intact for writing
|
||||
// if (FormatString == NULL) return NULL;
|
||||
//
|
||||
// // Print message to log buffer
|
||||
// VA_START(Marker, FormatString);
|
||||
// UnicodeVSPrint(Dir, sizeof(Dir), FormatString, Marker);
|
||||
// VA_END(Marker);
|
||||
//
|
||||
//}
|
||||
|
||||
EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
|
||||
{
|
||||
@ -397,33 +412,111 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
|
||||
}
|
||||
}
|
||||
|
||||
CHAR16 UniSysVers[6];
|
||||
CHAR16 UniOSVersion[16];
|
||||
AsciiStrToUnicodeStrS(Entry->OSVersion, UniOSVersion, 16);
|
||||
DBG("UniOSVersion == %s\n", UniOSVersion);
|
||||
|
||||
CHAR16 UniShortOSVersion[6];
|
||||
CHAR8 ShortOSVersion[6];
|
||||
if (AsciiOSVersionToUint64(Entry->OSVersion) < AsciiOSVersionToUint64("10.10")) {
|
||||
// OSVersion that are earlier than 10.10(form: 10.x.y)
|
||||
AsciiStrnCpyS(ShortOSVersion, 6, Entry->OSVersion, 4);
|
||||
AsciiStrToUnicodeStrS(Entry->OSVersion, UniSysVers, 5);
|
||||
AsciiStrToUnicodeStrS(Entry->OSVersion, UniShortOSVersion, 5);
|
||||
} else {
|
||||
AsciiStrnCpyS(ShortOSVersion, 6, Entry->OSVersion, 5);
|
||||
AsciiStrToUnicodeStrS(Entry->OSVersion, UniSysVers, 6);
|
||||
AsciiStrToUnicodeStrS(Entry->OSVersion, UniShortOSVersion, 6);
|
||||
}
|
||||
DBG("ShortOSVersion == %a\n", ShortOSVersion);
|
||||
DBG("UniShortOSVersion == %s\n", UniShortOSVersion);
|
||||
|
||||
// syscl - allow specific load inject kext
|
||||
// Clover/Kexts/Other is for general injection thus we need to scan both Other and OSVersion folder
|
||||
if ((SrcDir = GetOtherKextsDir(TRUE)) != NULL) {
|
||||
AddKexts(Entry, SrcDir, L"Other", UniSysVers, archCpuType);
|
||||
AddKexts(Entry, SrcDir, L"Other", archCpuType);
|
||||
FreePool(SrcDir);
|
||||
}else{
|
||||
DBG("GetOtherKextsDir(TRUE) return NULL\n");
|
||||
}
|
||||
// slice: CLOVER/kexts/Off keep disabled kext which can be allowed
|
||||
if ((SrcDir = GetOtherKextsDir(FALSE)) != NULL) {
|
||||
AddKexts(Entry, SrcDir, L"Off", UniSysVers, archCpuType);
|
||||
AddKexts(Entry, SrcDir, L"Off", archCpuType);
|
||||
FreePool(SrcDir);
|
||||
}else{
|
||||
DBG("GetOtherKextsDir(FALSE) return NULL\n");
|
||||
}
|
||||
|
||||
if ((SrcDir = GetOSVersionKextsDir(ShortOSVersion)) != NULL) {
|
||||
AddKexts(Entry, SrcDir, UniSysVers, UniSysVers, archCpuType);
|
||||
FreePool(SrcDir);
|
||||
}
|
||||
// Add kext from 10.x
|
||||
{
|
||||
CHAR16 OSAllVersionKextsDir[1024];
|
||||
UnicodeSPrint(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), L"%s\\kexts\\10.x", OEMPath);
|
||||
AddKexts(Entry, OSAllVersionKextsDir, L"10.x", archCpuType);
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_install");
|
||||
} else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_recovery");
|
||||
}else{
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_normal");
|
||||
}
|
||||
}
|
||||
CHAR16 DirPath[1024];
|
||||
UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
|
||||
AddKexts(Entry, DirPath, DirName, archCpuType);
|
||||
}
|
||||
|
||||
|
||||
// Add kext from 10.{version}
|
||||
{
|
||||
CHAR16 OSShortVersionKextsDir[1024];
|
||||
UnicodeSPrint(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), L"%s\\kexts\\%s", OEMPath, UniShortOSVersion);
|
||||
AddKexts(Entry, OSShortVersionKextsDir, UniShortOSVersion, archCpuType);
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", UniShortOSVersion);
|
||||
} else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", UniShortOSVersion);
|
||||
}else{
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", UniShortOSVersion);
|
||||
}
|
||||
}
|
||||
CHAR16 DirPath[1024];
|
||||
UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
|
||||
AddKexts(Entry, DirPath, DirName, archCpuType);
|
||||
}
|
||||
|
||||
// Add kext from :
|
||||
// 10.{version}.0 if NO minor version
|
||||
// 10.{version}.{minor version} if minor version is > 0
|
||||
{
|
||||
CHAR16 OSVersionKextsDirName[256];
|
||||
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
|
||||
UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion);
|
||||
}else{
|
||||
UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion);
|
||||
}
|
||||
|
||||
CHAR16 DirPath[1024];
|
||||
UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
|
||||
AddKexts(Entry, DirPath, OSVersionKextsDirName, archCpuType);
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if ( OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", OSVersionKextsDirName);
|
||||
}else{
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", OSVersionKextsDirName);
|
||||
}else{
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", OSVersionKextsDirName);
|
||||
}
|
||||
}
|
||||
UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
|
||||
AddKexts(Entry, DirPath, DirName, archCpuType);
|
||||
}
|
||||
|
||||
|
||||
// reserve space in the device tree
|
||||
if (GetKextCount() > 0) {
|
||||
@ -449,13 +542,13 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
|
||||
while (CurrentPlugInKext) {
|
||||
Next = CurrentPlugInKext->Next;
|
||||
FreePool(CurrentPlugInKext->FileName);
|
||||
FreePool(CurrentPlugInKext->MatchOS);
|
||||
FreePool(CurrentPlugInKext->KextDirNameUnderOEMPath);
|
||||
FreePool(CurrentPlugInKext->Version);
|
||||
FreePool(CurrentPlugInKext);
|
||||
CurrentPlugInKext = Next;
|
||||
}
|
||||
FreePool(InjectKextList->FileName);
|
||||
FreePool(InjectKextList->MatchOS);
|
||||
FreePool(InjectKextList->KextDirNameUnderOEMPath);
|
||||
FreePool(InjectKextList->Version);
|
||||
FreePool(InjectKextList);
|
||||
InjectKextList = CurrentKext;
|
||||
|
@ -2155,6 +2155,8 @@ VOID AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CHAR16 *InfoLine)
|
||||
|
||||
VOID AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry)
|
||||
{
|
||||
if ( !Screen ) return;
|
||||
if ( !Entry ) return;
|
||||
AddListElement((VOID ***) &(Screen->Entries), (UINTN*)&(Screen->EntryCount), Entry);
|
||||
}
|
||||
|
||||
@ -4611,27 +4613,30 @@ REFIT_MENU_ENTRY *SubMenuKextPatches()
|
||||
|
||||
REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
|
||||
{
|
||||
REFIT_MENU_ENTRY *Entry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
REFIT_MENU_ENTRY *Entry = NULL;
|
||||
REFIT_MENU_SCREEN *SubScreen = NULL;
|
||||
REFIT_INPUT_DIALOG *InputBootArgs;
|
||||
UINTN i = 0;
|
||||
SIDELOAD_KEXT *Kext = NULL;
|
||||
CHAR8 sysVer[17]; //RehabMan: logic below uses max index of 16, so buffer must be 17
|
||||
CHAR8 sysVer[256];
|
||||
|
||||
UnicodeStrToAsciiStrS(UniSysVer, sysVer, 16);
|
||||
for (i = 0; i < 16; i++) {
|
||||
UnicodeStrToAsciiStrS(UniSysVer, sysVer, sizeof(sysVer));
|
||||
for (i = 0; i < sizeof(sysVer)-2; i++) {
|
||||
if (sysVer[i] == '\0') {
|
||||
sysVer[i+0] = '-';
|
||||
sysVer[i+1] = '>';
|
||||
sysVer[i+2] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Kext = InjectKextList;
|
||||
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
|
||||
AddMenuInfoLine(SubScreen, PoolPrint(L"Choose/check kext to disable:"));
|
||||
while (Kext) {
|
||||
if (StrStr(Kext->MatchOS, UniSysVer) != NULL) {
|
||||
if (StrCmp(Kext->KextDirNameUnderOEMPath, UniSysVer) == 0) {
|
||||
if ( SubScreen == NULL ) {
|
||||
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
|
||||
AddMenuInfoLine(SubScreen, PoolPrint(L"Choose/check kext to disable:"));
|
||||
}
|
||||
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs->Entry.Title = PoolPrint(L"%s, v.%s", Kext->FileName, Kext->Version);
|
||||
InputBootArgs->Entry.Tag = TAG_INPUT;
|
||||
@ -4657,57 +4662,129 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
|
||||
Kext = Kext->Next;
|
||||
}
|
||||
|
||||
AddMenuEntry(SubScreen, &MenuEntryReturn);
|
||||
if ( SubScreen != NULL ) AddMenuEntry(SubScreen, &MenuEntryReturn);
|
||||
return Entry;
|
||||
}
|
||||
|
||||
LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
{
|
||||
LOADER_ENTRY *SubEntry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
CHAR16 *kextDir = NULL;
|
||||
UINTN i;
|
||||
CHAR8 ShortOSVersion[8];
|
||||
CHAR16 *UniSysVer = NULL;
|
||||
CHAR8 *ChosenOS =Entry->OSVersion;
|
||||
LOADER_ENTRY *SubEntry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
CHAR16 *kextDir = NULL;
|
||||
UINTN i;
|
||||
CHAR8 ShortOSVersion[8];
|
||||
CHAR16 *UniSysVer = NULL;
|
||||
CHAR8 *ChosenOS = Entry->OSVersion;
|
||||
|
||||
NewEntry((REFIT_MENU_ENTRY**)&SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
|
||||
SubEntry->Flags = Entry->Flags;
|
||||
if (ChosenOS) {
|
||||
NewEntry((REFIT_MENU_ENTRY**) &SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
|
||||
SubEntry->Flags = Entry->Flags;
|
||||
if (ChosenOS) {
|
||||
// DBG("chosen os %a\n", ChosenOS);
|
||||
//shorten os version 10.11.6 -> 10.11
|
||||
for (i = 0; i < 8; i++) {
|
||||
ShortOSVersion[i] = ChosenOS[i];
|
||||
if (ShortOSVersion[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
if (((i > 2) && (ShortOSVersion[i] == '.')) || (i == 5)) {
|
||||
ShortOSVersion[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
UniSysVer = PoolPrint(L"%a", ShortOSVersion);
|
||||
//shorten os version 10.11.6 -> 10.11
|
||||
for (i = 0; i < 8; i++) {
|
||||
ShortOSVersion[i] = ChosenOS[i];
|
||||
if (ShortOSVersion[i] == '\0') {
|
||||
break;
|
||||
}
|
||||
if (((i > 2) && (ShortOSVersion[i] == '.')) || (i == 5)) {
|
||||
ShortOSVersion[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddMenuInfoLine(SubScreen, PoolPrint(L"Block injected kexts for target version of macOS: %a", ShortOSVersion));
|
||||
if ((kextDir = GetOSVersionKextsDir(ShortOSVersion)) != NULL) {
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(UniSysVer));
|
||||
FreePool(kextDir);
|
||||
}
|
||||
FreePool(UniSysVer);
|
||||
} else {
|
||||
AddMenuInfoLine(SubScreen, PoolPrint(L"Block injected kexts for target version of macOS: %a", ChosenOS));
|
||||
}
|
||||
if ((kextDir = GetOtherKextsDir(TRUE)) != NULL) {
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(L"Other"));
|
||||
FreePool(kextDir);
|
||||
}
|
||||
if ((kextDir = GetOtherKextsDir(FALSE)) != NULL) {
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(L"Off"));
|
||||
FreePool(kextDir);
|
||||
}
|
||||
AddMenuInfoLine(SubScreen,
|
||||
PoolPrint(
|
||||
L"Block injected kexts for target version of macOS: %a",
|
||||
ShortOSVersion));
|
||||
|
||||
AddMenuEntry(SubScreen, &MenuEntryReturn);
|
||||
return SubEntry;
|
||||
// Add kext from 10.x
|
||||
{
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(L"10.x"));
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_install");
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_recovery");
|
||||
}
|
||||
else {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"10.x_normal");
|
||||
}
|
||||
}
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(DirName));
|
||||
}
|
||||
|
||||
// Add kext from 10.{version}
|
||||
{
|
||||
CHAR16 DirName[256];
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a", ShortOSVersion);
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(DirName));
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_install", ShortOSVersion);
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_recovery", ShortOSVersion);
|
||||
}
|
||||
else {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_normal", ShortOSVersion);
|
||||
}
|
||||
}
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(DirName));
|
||||
}
|
||||
|
||||
// Add kext from :
|
||||
// 10.{version}.0 if NO minor version
|
||||
// 10.{version}.{minor version} if minor version is > 0
|
||||
{
|
||||
{
|
||||
CHAR16 OSVersionKextsDirName[256];
|
||||
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
|
||||
UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion);
|
||||
}else{
|
||||
UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion);
|
||||
}
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(OSVersionKextsDirName));
|
||||
}
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_install",
|
||||
Entry->OSVersion);
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_recovery",
|
||||
Entry->OSVersion);
|
||||
}
|
||||
else {
|
||||
UnicodeSPrint(DirName, sizeof(DirName), L"%a_normal",
|
||||
Entry->OSVersion);
|
||||
}
|
||||
}
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(DirName));
|
||||
}
|
||||
}
|
||||
else {
|
||||
AddMenuInfoLine(SubScreen,
|
||||
PoolPrint(
|
||||
L"Block injected kexts for target version of macOS: %a",
|
||||
ChosenOS));
|
||||
}
|
||||
if ((kextDir = GetOtherKextsDir(TRUE)) != NULL) {
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(L"Other"));
|
||||
FreePool(kextDir);
|
||||
}
|
||||
if ((kextDir = GetOtherKextsDir(FALSE)) != NULL) {
|
||||
AddMenuEntry(SubScreen, SubMenuKextBlockInjection(L"Off"));
|
||||
FreePool(kextDir);
|
||||
}
|
||||
|
||||
AddMenuEntry(SubScreen, &MenuEntryReturn);
|
||||
return SubEntry;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user