Get rid of AsciiPrint.

This commit is contained in:
Jief L 2020-03-29 15:47:04 +03:00
parent 6fa0bb81da
commit 5006d33c5d
7 changed files with 57 additions and 64 deletions

View File

@ -568,7 +568,6 @@
9AF41612242CD75C00D2644C /* BmLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5F24176C04005CDD5C /* BmLib.cpp */; };
9AF41613242CD75C00D2644C /* card_vlist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5724176C04005CDD5C /* card_vlist.cpp */; };
9AF41614242CD75C00D2644C /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780B22417EE4A005CDD5C /* global_test.cpp */; };
9AF41615242CD75C00D2644C /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
9AF41616242CD75C00D2644C /* load_icns.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F6F24176C04005CDD5C /* load_icns.cpp */; };
9AF41617242CD75C00D2644C /* egemb_font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F6A24176C04005CDD5C /* egemb_font.cpp */; };
9AF41618242CD75C00D2644C /* securemenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7E24176C04005CDD5C /* securemenu.cpp */; };
@ -777,7 +776,6 @@
9AF416EF242CDA5800D2644C /* BmLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5F24176C04005CDD5C /* BmLib.cpp */; };
9AF416F0242CDA5800D2644C /* card_vlist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F5724176C04005CDD5C /* card_vlist.cpp */; };
9AF416F1242CDA5800D2644C /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780B22417EE4A005CDD5C /* global_test.cpp */; };
9AF416F2242CDA5800D2644C /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
9AF416F3242CDA5800D2644C /* load_icns.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F6F24176C04005CDD5C /* load_icns.cpp */; };
9AF416F4242CDA5800D2644C /* egemb_font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F6A24176C04005CDD5C /* egemb_font.cpp */; };
9AF416F5242CDA5800D2644C /* securemenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7E24176C04005CDD5C /* securemenu.cpp */; };
@ -849,7 +847,6 @@
9AF41741242F15CC00D2644C /* BasicIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4173E242F15CC00D2644C /* BasicIO.h */; };
9AF41742242F15D600D2644C /* BasicIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4173D242F15CC00D2644C /* BasicIO.cpp */; };
9AF41743242F15D700D2644C /* BasicIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4173D242F15CC00D2644C /* BasicIO.cpp */; };
A5E326312428F4EE002240E8 /* XTheme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E3262F2428F4EE002240E8 /* XTheme.cpp */; };
A5E326322428F4EE002240E8 /* XTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E326302428F4EE002240E8 /* XTheme.h */; };
/* End PBXBuildFile section */
@ -2101,7 +2098,6 @@
9AC7804624176C04005CDD5C /* BmLib.cpp in Sources */,
9AC7804024176C04005CDD5C /* card_vlist.cpp in Sources */,
9AC780B32417EE4B005CDD5C /* global_test.cpp in Sources */,
A5E326312428F4EE002240E8 /* XTheme.cpp in Sources */,
9AC7805624176C04005CDD5C /* load_icns.cpp in Sources */,
9AC7805124176C04005CDD5C /* egemb_font.cpp in Sources */,
9AC7806424176C04005CDD5C /* securemenu.cpp in Sources */,
@ -2335,7 +2331,6 @@
9AF41612242CD75C00D2644C /* BmLib.cpp in Sources */,
9AF41613242CD75C00D2644C /* card_vlist.cpp in Sources */,
9AF41614242CD75C00D2644C /* global_test.cpp in Sources */,
9AF41615242CD75C00D2644C /* XTheme.cpp in Sources */,
9AF41616242CD75C00D2644C /* load_icns.cpp in Sources */,
9AF41617242CD75C00D2644C /* egemb_font.cpp in Sources */,
9AF41618242CD75C00D2644C /* securemenu.cpp in Sources */,
@ -2452,7 +2447,6 @@
9AF416EF242CDA5800D2644C /* BmLib.cpp in Sources */,
9AF416F0242CDA5800D2644C /* card_vlist.cpp in Sources */,
9AF416F1242CDA5800D2644C /* global_test.cpp in Sources */,
9AF416F2242CDA5800D2644C /* XTheme.cpp in Sources */,
9AF416F3242CDA5800D2644C /* load_icns.cpp in Sources */,
9AF416F4242CDA5800D2644C /* egemb_font.cpp in Sources */,
9AF416F5242CDA5800D2644C /* securemenu.cpp in Sources */,

View File

@ -151,7 +151,7 @@ VOID EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
{
// Print message to console
if (DebugMode >= 2) {
AsciiPrint("%a", LastMessage);
printf("%s", LastMessage);
}
if ((DebugMode >= 1) && GlobalConfig.DebugLog) {

View File

@ -205,7 +205,7 @@ OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
UINT64 msr = 0;
msr = AsmReadMsr64(MSR_PKG_CST_CONFIG_CONTROL); //0xE2
// AsciiPrint("MSR 0xE2 on Exit BS %08x\n", msr);
// printf("MSR 0xE2 on Exit BS %08x\n", msr);
} */
/*
@ -220,12 +220,12 @@ OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
if (FadtPointer != NULL) {
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE*)(UINTN)(FadtPointer->FirmwareCtrl);
AsciiPrint(" Firmware wake address=%08lx\n", Facs->FirmwareWakingVector);
AsciiPrint(" Firmware wake 64 addr=%16llx\n", Facs->XFirmwareWakingVector);
AsciiPrint(" Hardware signature =%08lx\n", Facs->HardwareSignature);
AsciiPrint(" GlobalLock =%08lx\n", Facs->GlobalLock);
AsciiPrint(" Flags =%08lx\n", Facs->Flags);
AsciiPrint(" HS at offset 0x%08x\n", OFFSET_OF(EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE, HardwareSignature));
printf(" Firmware wake address=%08lx\n", Facs->FirmwareWakingVector);
printf(" Firmware wake 64 addr=%16llx\n", Facs->XFirmwareWakingVector);
printf(" Hardware signature =%08lx\n", Facs->HardwareSignature);
printf(" GlobalLock =%08lx\n", Facs->GlobalLock);
printf(" Flags =%08lx\n", Facs->Flags);
printf(" HS at offset 0x%08x\n", OFFSET_OF(EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE, HardwareSignature));
// machineSignature = Facs->HardwareSignature;
}
}
@ -343,7 +343,7 @@ OnReadyToBoot (
msr = AsmReadMsr64(MSR_PKG_CST_CONFIG_CONTROL); //0xE2
}
// AsciiPrint("MSR 0xE2 on ReadyToBoot %08x\n", msr);
// printf("MSR 0xE2 on ReadyToBoot %08x\n", msr);
*/
}

View File

@ -21,7 +21,6 @@
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_HIB, __VA_ARGS__);
//#define DBG(...) AsciiPrint(__VA_ARGS__);
#endif
#define CREATE_NEW_BOOT_IMAGE 1

View File

@ -28,7 +28,7 @@
#endif
// runtime debug
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { AsciiPrint(__VA_ARGS__); }
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { printf(__VA_ARGS__); }
EFI_PHYSICAL_ADDRESS KernelRelocBase = 0;
@ -1718,13 +1718,13 @@ FindBootArgs(IN LOADER_ENTRY *Entry)
dtLength = &bootArgs2->deviceTreeLength;
KernelSlide = bootArgs2->kslide;
DBG_RT(Entry, "Found bootArgs2 at 0x%08x, DevTree at %p\n", ptr, dtRoot);
DBG_RT(Entry, "Found bootArgs2 at 0x%8s, DevTree at %p\n", ptr, dtRoot);
//DBG("bootArgs2->kaddr = 0x%08X and bootArgs2->ksize = 0x%08X\n", bootArgs2->kaddr, bootArgs2->ksize);
//DBG("bootArgs2->efiMode = 0x%02X\n", bootArgs2->efiMode);
DBG_RT(Entry, "bootArgs2->CommandLine = %a\n", bootArgs2->CommandLine);
DBG_RT(Entry, "bootArgs2->CommandLine = %s\n", bootArgs2->CommandLine);
DBG_RT(Entry, "bootArgs2->flags = 0x%x\n", bootArgs2->flags);
DBG_RT(Entry, "bootArgs2->kslide = 0x%x\n", bootArgs2->kslide);
DBG_RT(Entry, "bootArgs2->bootMemStart = 0x%x\n", bootArgs2->bootMemStart);
DBG_RT(Entry, "bootArgs2->bootMemStart = 0x%llx\n", bootArgs2->bootMemStart);
if (Entry && Entry->KernelAndKextPatches && Entry->KernelAndKextPatches->KPDebug)
gBS->Stall(2000000);
@ -1747,7 +1747,7 @@ FindBootArgs(IN LOADER_ENTRY *Entry)
dtRoot = (CHAR8*)(UINTN)bootArgs1->deviceTreeP;
dtLength = &bootArgs1->deviceTreeLength;
DBG_RT(Entry, "Found bootArgs1 at 0x%08x, DevTree at %p\n", ptr, dtRoot);
DBG_RT(Entry, "Found bootArgs1 at 0x%8s, DevTree at %p\n", ptr, dtRoot);
//DBG("bootArgs1->kaddr = 0x%08X and bootArgs1->ksize = 0x%08X\n", bootArgs1->kaddr, bootArgs1->ksize);
//DBG("bootArgs1->efiMode = 0x%02X\n", bootArgs1->efiMode);
@ -1767,7 +1767,7 @@ KernelUserPatch(IN UINT8 *UKernelData, LOADER_ENTRY *Entry)
// old confuse
for (; i < Entry->KernelAndKextPatches->NrKernels; ++i) {
DBG_RT(Entry, "Patch[%d]: %a\n", i, Entry->KernelAndKextPatches->KernelPatches[i].Label);
DBG_RT(Entry, "Patch[%lld]: %s\n", i, Entry->KernelAndKextPatches->KernelPatches[i].Label);
if (!Entry->KernelAndKextPatches->KernelPatches[i].MenuItem.BValue) {
//DBG_RT(Entry, "Patch[%d]: %a :: is not allowed for booted OS %a\n", i, Entry->KernelAndKextPatches->KernelPatches[i].Label, Entry->OSVersion);
DBG_RT(Entry, "==> disabled\n");
@ -1789,7 +1789,7 @@ KernelUserPatch(IN UINT8 *UKernelData, LOADER_ENTRY *Entry)
y++;
}
DBG_RT(Entry, "==> %a : %d replaces done\n", Num ? "Success" : "Error", Num);
DBG_RT(Entry, "==> %s : %lld replaces done\n", Num ? "Success" : "Error", Num);
}
if (Entry->KernelAndKextPatches->KPDebug) {
gBS->Stall(2000000);
@ -1803,7 +1803,7 @@ BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry)
{
INTN Num, i = 0, y = 0;
for (; i < Entry->KernelAndKextPatches->NrBoots; ++i) {
DBG_RT(Entry, "Patch[%d]: %a\n", i, Entry->KernelAndKextPatches->BootPatches[i].Label);
DBG_RT(Entry, "Patch[%lld]: %s\n", i, Entry->KernelAndKextPatches->BootPatches[i].Label);
if (!Entry->KernelAndKextPatches->BootPatches[i].MenuItem.BValue) {
DBG_RT(Entry, "==> disabled\n");
continue;
@ -1824,7 +1824,7 @@ BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry)
y++;
}
DBG_RT(Entry, "==> %a : %d replaces done\n", Num ? "Success" : "Error", Num);
DBG_RT(Entry, "==> %s : %lld replaces done\n", Num ? "Success" : "Error", Num);
}
if (Entry->KernelAndKextPatches->KPDebug) {
gBS->Stall(2000000);
@ -1886,7 +1886,7 @@ KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry)
Get_PreLink();
isKernelcache = PrelinkTextSize > 0 && PrelinkInfoSize > 0;
DBG_RT(Entry, "isKernelcache: %s\n", isKernelcache ? L"Yes" : L"No");
DBG_RT(Entry, "isKernelcache: %ls\n", isKernelcache ? L"Yes" : L"No");
}
VOID
@ -2053,7 +2053,7 @@ KernelAndKextsPatcherStart(IN LOADER_ENTRY *Entry)
patchedOk = EnableExtCpuXCPM(KernelData, Entry, apply_idle_patch);
}
}
DBG_RT(Entry, "EnableExtCpuXCPM - %a!\n", patchedOk? "OK" : "FAILED");
DBG_RT(Entry, "EnableExtCpuXCPM - %s!\n", patchedOk? "OK" : "FAILED");
}
if (Entry->KernelAndKextPatches->KPDebug) {

View File

@ -17,7 +17,7 @@
#endif
// runtime debug
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { AsciiPrint(__VA_ARGS__); }
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { printf(__VA_ARGS__); }
////////////////////
@ -847,7 +847,7 @@ EFI_STATUS InjectKexts(/*IN EFI_MEMORY_DESCRIPTOR *Desc*/ IN UINT32 deviceTreeP,
drvPtr += sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer);
KextBase = RoundPage(KextBase + KextEntry->kext.length);
DBG_RT(Entry, " %d - %a\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr);
DBG_RT(Entry, " %llu - %s\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr);
if (gSettings.KextPatchesAllowed) {
INT32 i;
CHAR8 SavedValue;
@ -938,7 +938,7 @@ VOID EFIAPI KernelBooterExtensionsPatch(IN UINT8 *Kernel, LOADER_ENTRY *Entry)
if (NumSnow_i386_EXT + NumSnow_X64_EXT + NumLion_i386_EXT + NumLion_X64_EXT > 1) {
// more then one pattern found - we do not know what to do with it
// and we'll skipp it
AsciiPrint("\nERROR patching kernel for injected kexts:\nmultiple patterns found (Snowi386: %d, SnowX64: %d, Lioni386: %d, LionX64: %d) - skipping patching!\n", NumSnow_i386_EXT, NumSnow_X64_EXT, NumLion_i386_EXT, NumLion_X64_EXT);
printf("\nERROR patching kernel for injected kexts:\nmultiple patterns found (Snowi386: %llu, SnowX64: %llu, Lioni386: %llu, LionX64: %llu) - skipping patching!\n", NumSnow_i386_EXT, NumSnow_X64_EXT, NumLion_i386_EXT, NumLion_X64_EXT);
gBS->Stall(10000000);
return;
}
@ -947,10 +947,10 @@ VOID EFIAPI KernelBooterExtensionsPatch(IN UINT8 *Kernel, LOADER_ENTRY *Entry)
if (is64BitKernel) {
if (NumSnow_X64_EXT == 1) {
Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESnowSearchEXT_X64, sizeof(KBESnowSearchEXT_X64), KBESnowReplaceEXT_X64, 1);
DBG_RT(Entry, "==> kernel Snow Leopard X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> kernel Snow Leopard X64: %llu replaces done.\n", Num);
} else if (NumLion_X64_EXT == 1) {
Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBELionSearchEXT_X64, sizeof(KBELionSearchEXT_X64), KBELionReplaceEXT_X64, 1);
DBG_RT(Entry, "==> kernel Lion X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> kernel Lion X64: %llu replaces done.\n", Num);
} else {
// EXT - load extra kexts besides kernelcache.
for (i = 0; i < 0x1000000; i++) {
@ -1090,10 +1090,10 @@ VOID EFIAPI KernelBooterExtensionsPatch(IN UINT8 *Kernel, LOADER_ENTRY *Entry)
// i386
if (NumSnow_i386_EXT == 1) {
Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBESnowSearchEXT_i386, sizeof(KBESnowSearchEXT_i386), KBESnowReplaceEXT_i386, 1);
DBG_RT(Entry, "==> kernel Snow Leopard i386: %d replaces done.\n", Num);
DBG_RT(Entry, "==> kernel Snow Leopard i386: %llu replaces done.\n", Num);
} else if (NumLion_i386_EXT == 1) {
Num = SearchAndReplace(Kernel, KERNEL_MAX_SIZE, KBELionSearchEXT_i386, sizeof(KBELionSearchEXT_i386), KBELionReplaceEXT_i386, 1);
DBG_RT(Entry, "==> kernel Lion i386: %d replaces done.\n", Num);
DBG_RT(Entry, "==> kernel Lion i386: %llu replaces done.\n", Num);
} else {
DBG_RT(Entry, "==> ERROR: NOT patched - unknown kernel.\n");
}

View File

@ -23,7 +23,7 @@
#endif
// runtime debug
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { AsciiPrint(__VA_ARGS__); }
#define DBG_RT(entry, ...) if ((entry != NULL) && (entry->KernelAndKextPatches != NULL) && entry->KernelAndKextPatches->KPDebug) { printf(__VA_ARGS__); }
//
// Searches Source for Search pattern of size SearchSize
@ -158,7 +158,7 @@ UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN
if (*Source != *Pos) {
break;
}
// AsciiPrint("%c", *Source);
// printf("%c", *Source);
Source++;
Pos++;
}
@ -172,7 +172,7 @@ UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, UINT8 *Search, UINTN
Source = FirstMatch + 1;
/* if (Pos != Search) {
AsciiPrint("\n");
printf("\n");
} */
}
@ -338,10 +338,10 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT
UINTN Num = 0;
DBG_RT(Entry, "\nATIConnectorsPatch: driverAddr = %x, driverSize = %x\nController = %s\n",
DBG_RT(Entry, "\nATIConnectorsPatch: driverAddr = %s, driverSize = %x\nController = %ls\n",
Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsController);
ExtractKextBundleIdentifier(InfoPlist);
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
// number of occurences od Data should be 1
Num = SearchAndCount(Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsData, Entry->KernelAndKextPatches->KPATIConnectorsDataLen);
@ -361,7 +361,7 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT
1);
if (Entry->KernelAndKextPatches->KPDebug) {
if (Num > 0) {
DBG_RT(Entry, "==> patched %d times!\n", Num);
DBG_RT(Entry, "==> patched %llu times!\n", Num);
} else {
DBG_RT(Entry, "==> NOT patched!\n");
}
@ -393,11 +393,11 @@ VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UI
UINTN Index2;
UINTN Count = 0;
DBG_RT(Entry, "\nAppleIntelCPUPMPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
DBG_RT(Entry, "\nAppleIntelCPUPMPatch: driverAddr = %s, driverSize = %x\n", Driver, DriverSize);
if (Entry->KernelAndKextPatches->KPDebug) {
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
//TODO: we should scan only __text __TEXT
for (Index1 = 0; Index1 < DriverSize; Index1++) {
@ -410,7 +410,7 @@ VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UI
Count++;
Driver[Index2] = 0x90;
Driver[Index2 + 1] = 0x90;
DBG_RT(Entry, " %d. patched at 0x%x\n", Count, Index2);
DBG_RT(Entry, " %llu. patched at 0x%llx\n", Count, Index2);
break;
} else if ((Driver[Index2] == 0xC9 && Driver[Index2 + 1] == 0xC3) ||
(Driver[Index2] == 0x5D && Driver[Index2 + 1] == 0xC3) ||
@ -429,7 +429,7 @@ VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UI
Count++;
Driver[Index2] = 0x90;
Driver[Index2 + 1] = 0x90;
DBG_RT(Entry, " %d. patched at 0x%x\n", Count, Index2);
DBG_RT(Entry, " %llu. patched at 0x%llx\n", Count, Index2);
break;
} else if ((Driver[Index2] == 0xC9 && Driver[Index2 + 1] == 0xC3) ||
(Driver[Index2] == 0x5D && Driver[Index2 + 1] == 0xC3) ||
@ -442,7 +442,7 @@ VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UI
}
}
}
DBG_RT(Entry, "= %d patches\n", Count);
DBG_RT(Entry, "= %llu patches\n", Count);
if (Entry->KernelAndKextPatches->KPDebug) {
gBS->Stall(5000000);
}
@ -493,11 +493,11 @@ VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 In
UINTN NumMavMoj3 = 0;
UINTN NumMoj4 = 0;
DBG_RT(Entry, "\nAppleRTCPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
DBG_RT(Entry, "\nAppleRTCPatch: driverAddr = %s, driverSize = %x\n", Driver, DriverSize);
if (Entry->KernelAndKextPatches->KPDebug) {
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
if (is64BitKernel) {
NumLion_X64 = SearchAndCount(Driver, DriverSize, LionSearch_X64, sizeof(LionSearch_X64));
@ -519,19 +519,19 @@ VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 In
if (NumLion_X64 == 1) {
Num = SearchAndReplace(Driver, DriverSize, LionSearch_X64, sizeof(LionSearch_X64), LionReplace_X64, 1);
DBG_RT(Entry, "==> Lion X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> Lion X64: %llu replaces done.\n", Num);
} else if (NumLion_i386 == 1) {
Num = SearchAndReplace(Driver, DriverSize, LionSearch_i386, sizeof(LionSearch_i386), LionReplace_i386, 1);
DBG_RT(Entry, "==> Lion i386: %d replaces done.\n", Num);
DBG_RT(Entry, "==> Lion i386: %llu replaces done.\n", Num);
} else if (NumML == 1) {
Num = SearchAndReplace(Driver, DriverSize, MLSearch, sizeof(MLSearch), MLReplace, 1);
DBG_RT(Entry, "==> MountainLion X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> MountainLion X64: %llu replaces done.\n", Num);
} else if (NumMavMoj3 == 1) {
Num = SearchAndReplace(Driver, DriverSize, MavMoj3Search, sizeof(MavMoj3Search), MavMoj3Replace, 1);
DBG_RT(Entry, "==> Mav/Yos/El/Sie/HS/Moj3 X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> Mav/Yos/El/Sie/HS/Moj3 X64: %llu replaces done.\n", Num);
} else if (NumMoj4 == 1) {
Num = SearchAndReplace(Driver, DriverSize, Moj4CataSearch, sizeof(Moj4CataSearch), Moj4CataReplace, 1);
DBG_RT(Entry, "==> Mojave4 X64: %d replaces done.\n", Num);
DBG_RT(Entry, "==> Mojave4 X64: %llu replaces done.\n", Num);
} else {
DBG_RT(Entry, "==> Patterns not found - patching NOT done.\n");
}
@ -593,12 +593,12 @@ VOID DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
//
UINTN gPatchCount = 0;
DBG_RT(Entry, "\nDellSMBIOSPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
DBG_RT(Entry, "\nDellSMBIOSPatch: driverAddr = %s, driverSize = %x\n", Driver, DriverSize);
if (Entry->KernelAndKextPatches->KPDebug)
{
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
//
// now, let's patch it!
@ -607,7 +607,7 @@ VOID DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
if (gPatchCount == 1)
{
DBG_RT(Entry, "==> AppleSMBIOS: %d replaces done.\n", gPatchCount);
DBG_RT(Entry, "==> AppleSMBIOS: %llu replaces done.\n", gPatchCount);
}
else
{
@ -632,12 +632,12 @@ VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
UINT32 i;
UINT64 os_ver = AsciiOSVersionToUint64(Entry->OSVersion);
DBG_RT(Entry, "\nSNBE_AICPUPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
DBG_RT(Entry, "\nSNBE_AICPUPatch: driverAddr = %s, driverSize = %x\n", Driver, DriverSize);
if (Entry->KernelAndKextPatches->KPDebug) {
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
// now let's patch it
if (os_ver < AsciiOSVersionToUint64("10.9") || os_ver >= AsciiOSVersionToUint64("10.14")) {
@ -910,12 +910,12 @@ VOID BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
UINTN count = 0;
UINT64 os_ver = AsciiOSVersionToUint64(Entry->OSVersion);
DBG_RT(Entry, "\nBDWE_IOPCIPatch: driverAddr = %x, driverSize = %x\n", Driver, DriverSize);
DBG_RT(Entry, "\nBDWE_IOPCIPatch: driverAddr = %s, driverSize = %x\n", Driver, DriverSize);
if (Entry->KernelAndKextPatches->KPDebug) {
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
//
// now, let's patch it!
//
@ -929,7 +929,7 @@ VOID BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32
}
if (count) {
DBG_RT(Entry, "==> IOPCIFamily: %d replaces done.\n", count);
DBG_RT(Entry, "==> IOPCIFamily: %llu replaces done.\n", count);
} else {
DBG_RT(Entry, "==> Patterns not found - patching NOT done.\n");
}
@ -960,7 +960,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
UINTN Num = 0;
INTN Ind;
DBG_RT(Entry, "\nAnyKextPatch %d: driverAddr = %x, driverSize = %x\nAnyKext = %a\n",
DBG_RT(Entry, "\nAnyKextPatch %d: driverAddr = %s, driverSize = %x\nAnyKext = %s\n",
N, Driver, DriverSize, Entry->KernelAndKextPatches->KextPatches[N].Label);
if (!Entry->KernelAndKextPatches->KextPatches[N].MenuItem.BValue) {
@ -972,7 +972,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
ExtractKextBundleIdentifier(InfoPlist);
}
DBG_RT(Entry, "Kext: %a\n", gKextBundleIdentifier);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);
if (!Entry->KernelAndKextPatches->KextPatches[N].IsPlistPatch) {
// kext binary patch
@ -1008,7 +1008,7 @@ VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 Inf
if (Entry->KernelAndKextPatches->KPDebug) {
if (Num > 0) {
DBG_RT(Entry, "==> patched %d times!\n", Num);
DBG_RT(Entry, "==> patched %llu times!\n", Num);
} else {
DBG_RT(Entry, "==> NOT patched!\n");
}
@ -1112,7 +1112,7 @@ VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPl
if ((Entry->KernelAndKextPatches->KextPatches[i].DataLen > 0) &&
isBundle?(AsciiStrCmp(gKextBundleIdentifier, Name) == 0):(AsciiStrStr(gKextBundleIdentifier, Name) != NULL)) {
// (AsciiStrStr(InfoPlist, Entry->KernelAndKextPatches->KextPatches[i].Name) != NULL)) {
DBG_RT(Entry, "\n\nPatch kext: %a\n", Entry->KernelAndKextPatches->KextPatches[i].Name);
DBG_RT(Entry, "\n\nPatch kext: %s\n", Entry->KernelAndKextPatches->KextPatches[i].Name);
AnyKextPatch(Driver, DriverSize, InfoPlist, InfoPlistSize, i, Entry);
}
}