different addressing in the case of kc

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-07-26 16:44:38 +03:00
parent 32eba04396
commit 15b65bd95b
3 changed files with 18 additions and 8 deletions

View File

@ -23,7 +23,7 @@
//#include "sse3_5_patcher.h"
#ifndef DEBUG_ALL
#define KERNEL_DEBUG 0
#define KERNEL_DEBUG 1
#else
#define KERNEL_DEBUG DEBUG_ALL
#endif
@ -200,11 +200,20 @@ UINTN LOADER_ENTRY::searchProcInDriver(UINT8 * driver, UINT32 driverLen, const c
UINT32 symCmdOffset = Get_Symtab(driver);
DBG("symCmdOffset=0x%X\n", symCmdOffset);
if (symCmdOffset != 0) {
symCmd = (struct symtab_command *)&driver[symCmdOffset];
vArray = (struct nlist_64*)(&driver[symCmd->symoff]);
lSizeVtable = symCmd->nsyms;
Names = (const char*)(&driver[symCmd->stroff]);
DBG("driver: AddrVtable=0x%x SizeVtable=0x%x NamesTable=0x%x\n", symCmd->symoff, lSizeVtable, symCmd->stroff);
if ((((struct mach_header_64*)KernelData)->filetype) == MH_KERNEL_COLLECTION) {
symCmd = (struct symtab_command *)&KernelData[symCmdOffset];
vArray = (struct nlist_64*)(&KernelData[symCmd->symoff]);
lSizeVtable = symCmd->nsyms;
Names = (const char*)(&KernelData[symCmd->stroff]);
DBG("driverKC: AddrVtable=0x%x SizeVtable=0x%x NamesTable=0x%x\n", symCmd->symoff, lSizeVtable, symCmd->stroff);
} else {
symCmd = (struct symtab_command *)&driver[symCmdOffset];
vArray = (struct nlist_64*)(&driver[symCmd->symoff]);
lSizeVtable = symCmd->nsyms;
Names = (const char*)(&driver[symCmd->stroff]);
DBG("driver: AddrVtable=0x%x SizeVtable=0x%x NamesTable=0x%x\n", symCmd->symoff, lSizeVtable, symCmd->stroff);
}
}
if (!vArray || !lSizeVtable || !Names) {

View File

@ -3,7 +3,7 @@
#include "DataHubCpu.h"
#ifndef DEBUG_ALL
#define KEXT_INJECT_DEBUG 0
#define KEXT_INJECT_DEBUG 1
#else
#define KEXT_INJECT_DEBUG DEBUG_ALL
#endif

View File

@ -22,7 +22,7 @@ extern "C" {
#ifndef DEBUG_ALL
#define KEXT_DEBUG 0
#define KEXT_DEBUG 1
#else
#define KEXT_DEBUG DEBUG_ALL
#endif
@ -1497,6 +1497,7 @@ VOID LOADER_ENTRY::PatchPrelinkedKexts()
DBG("\n");
DictPtr = WholePlist;
//new dict is the new kext
while ((DictPtr = strstr(DictPtr, "dict>")) != NULL) {
if (DictPtr[-1] == '<') {
// opening dict