From 3433041756afeadf52f1265df22a61734e794bb8 Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Sat, 11 Apr 2020 18:36:40 +0300 Subject: [PATCH] use char8 for KPATIConnectorsController Signed-off-by: Sergey Isakov --- CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist | 2 ++ rEFIt_UEFI/Platform/Settings.cpp | 6 +++--- rEFIt_UEFI/Platform/kext_patcher.cpp | 11 ++++++----- rEFIt_UEFI/libeg/libeg.h | 2 +- rEFIt_UEFI/refit/main.cpp | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist b/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist index d5525df8c..e8f4f183d 100644 --- a/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist +++ b/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist @@ -408,6 +408,8 @@ #LegacyBiosDefaultEntry 0 + CustomLogo + Apple KernelAndKextPatches diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index c5cb51924..fb08bf51f 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -774,7 +774,7 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst, Dst->KPPanicNoKextDump = Src->KPPanicNoKextDump; if (Src->KPATIConnectorsController != NULL) { - Dst->KPATIConnectorsController = EfiStrDuplicate (Src->KPATIConnectorsController); + Dst->KPATIConnectorsController = (__typeof__(Dst->KPATIConnectorsController))AllocateCopyPool (AsciiStrSize(Src->KPATIConnectorsController) ,Src->KPATIConnectorsController); } if ((Src->KPATIConnectorsDataLen > 0) && @@ -1000,8 +1000,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches, UINTN len = 0, i=0; // ATIConnectors patch - Patches->KPATIConnectorsController = (__typeof__(Patches->KPATIConnectorsController))AllocateZeroPool (AsciiStrSize(Prop->string) * sizeof(CHAR16)); - AsciiStrToUnicodeStrS (Prop->string, Patches->KPATIConnectorsController, AsciiStrSize(Prop->string)); + Patches->KPATIConnectorsController = (__typeof__(Patches->KPATIConnectorsController))AllocateCopyPool (AsciiStrSize(Prop->string), Prop->string); + // AsciiStrToUnicodeStrS (Prop->string, Patches->KPATIConnectorsController, AsciiStrSize(Prop->string)); Patches->KPATIConnectorsData = GetDataSetting (DictPointer, "ATIConnectorsData", &len); Patches->KPATIConnectorsDataLen = len; diff --git a/rEFIt_UEFI/Platform/kext_patcher.cpp b/rEFIt_UEFI/Platform/kext_patcher.cpp index b9bf40241..137690213 100644 --- a/rEFIt_UEFI/Platform/kext_patcher.cpp +++ b/rEFIt_UEFI/Platform/kext_patcher.cpp @@ -287,13 +287,14 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry) snprintf(ATIKextBundleId[0], sizeof(ATIKextBundleId[0]), "com.apple.kext.ATI%sController", // when it was AsciiSPrint, %a was used with KPATIConnectorsController which is CHAR16 ??? Result is printing stop at first char <= 255 - (CHAR8*)Entry->KernelAndKextPatches->KPATIConnectorsController // cast to CHAR8* to not change behavior. Looks like a bug though + //now it is CHAR8* + Entry->KernelAndKextPatches->KPATIConnectorsController ); // ML snprintf(ATIKextBundleId[1], sizeof(ATIKextBundleId[1]), "com.apple.kext.AMD%sController", // when it was AsciiSPrint, %a was used with KPATIConnectorsController which is CHAR16 ??? Result is printing stop at first char <= 255 - (CHAR8*)Entry->KernelAndKextPatches->KPATIConnectorsController // cast to CHAR8* to not change behavior. Looks like a bug though + Entry->KernelAndKextPatches->KPATIConnectorsController ); ATIConnectorsPatchInited = TRUE; @@ -311,11 +312,11 @@ VOID ATIConnectorsPatchRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_ // for future? FSInject->AddStringToList(ForceLoadKexts, - PoolPrint(L"\\AMD%sController.kext\\Contents\\Info.plist", Entry->KernelAndKextPatches->KPATIConnectorsController) + PoolPrint(L"\\AMD%aController.kext\\Contents\\Info.plist", Entry->KernelAndKextPatches->KPATIConnectorsController) ); // Lion, ML, SnowLeo 10.6.7 2011 MBP FSInject->AddStringToList(ForceLoadKexts, - PoolPrint(L"\\ATI%sController.kext\\Contents\\Info.plist", Entry->KernelAndKextPatches->KPATIConnectorsController) + PoolPrint(L"\\ATI%aController.kext\\Contents\\Info.plist", Entry->KernelAndKextPatches->KPATIConnectorsController) ); // SnowLeo FSInject->AddStringToList(ForceLoadKexts, L"\\ATIFramebuffer.kext\\Contents\\Info.plist"); @@ -338,7 +339,7 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT UINTN Num = 0; - DBG_RT(Entry, "\nATIConnectorsPatch: driverAddr = %s, driverSize = %x\nController = %ls\n", + DBG_RT(Entry, "\nATIConnectorsPatch: driverAddr = %s, driverSize = %x\nController = %s\n", Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsController); ExtractKextBundleIdentifier(InfoPlist); DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier); diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index 183f99233..3a867e5c6 100755 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -308,7 +308,7 @@ typedef struct KERNEL_AND_KEXT_PATCHES UINT8 pad[3]; UINT32 FakeCPUID; // UINT32 align0; - CHAR16 *KPATIConnectorsController; + CHAR8 *KPATIConnectorsController; #if defined(MDE_CPU_IA32) UINT32 align1; #endif diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 9469b7c72..d601ebefc 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -376,7 +376,7 @@ VOID DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches) // Dell smbios truncate fix DBG("\tDellSMBIOSPatch: %c\n", Patches->KPDELLSMBIOS ? 'y' : 'n'); DBG("\tFakeCPUID: 0x%X\n", Patches->FakeCPUID); - DBG("\tATIController: %ls\n", (Patches->KPATIConnectorsController == NULL) ? L"null": Patches->KPATIConnectorsController); + DBG("\tATIController: %s\n", (Patches->KPATIConnectorsController == NULL) ? "(null)": Patches->KPATIConnectorsController); DBG("\tATIDataLength: %d\n", Patches->KPATIConnectorsDataLen); DBG("\t%d Kexts to load\n", Patches->NrForceKexts); if (Patches->ForceKexts) {