use char8 for KPATIConnectorsController

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-04-11 18:36:40 +03:00
parent 9440b56a61
commit 3433041756
5 changed files with 13 additions and 10 deletions

View File

@ -408,6 +408,8 @@
<false/> <false/>
<key>#LegacyBiosDefaultEntry</key> <key>#LegacyBiosDefaultEntry</key>
<integer>0</integer> <integer>0</integer>
<key>CustomLogo</key>
<string>Apple</string>
</dict> </dict>
<key>KernelAndKextPatches</key> <key>KernelAndKextPatches</key>
<dict> <dict>

View File

@ -774,7 +774,7 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst,
Dst->KPPanicNoKextDump = Src->KPPanicNoKextDump; Dst->KPPanicNoKextDump = Src->KPPanicNoKextDump;
if (Src->KPATIConnectorsController != NULL) { if (Src->KPATIConnectorsController != NULL) {
Dst->KPATIConnectorsController = EfiStrDuplicate (Src->KPATIConnectorsController); Dst->KPATIConnectorsController = (__typeof__(Dst->KPATIConnectorsController))AllocateCopyPool (AsciiStrSize(Src->KPATIConnectorsController) ,Src->KPATIConnectorsController);
} }
if ((Src->KPATIConnectorsDataLen > 0) && if ((Src->KPATIConnectorsDataLen > 0) &&
@ -1000,8 +1000,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
UINTN len = 0, i=0; UINTN len = 0, i=0;
// ATIConnectors patch // ATIConnectors patch
Patches->KPATIConnectorsController = (__typeof__(Patches->KPATIConnectorsController))AllocateZeroPool (AsciiStrSize(Prop->string) * sizeof(CHAR16)); Patches->KPATIConnectorsController = (__typeof__(Patches->KPATIConnectorsController))AllocateCopyPool (AsciiStrSize(Prop->string), Prop->string);
AsciiStrToUnicodeStrS (Prop->string, Patches->KPATIConnectorsController, AsciiStrSize(Prop->string)); // AsciiStrToUnicodeStrS (Prop->string, Patches->KPATIConnectorsController, AsciiStrSize(Prop->string));
Patches->KPATIConnectorsData = GetDataSetting (DictPointer, "ATIConnectorsData", &len); Patches->KPATIConnectorsData = GetDataSetting (DictPointer, "ATIConnectorsData", &len);
Patches->KPATIConnectorsDataLen = len; Patches->KPATIConnectorsDataLen = len;

View File

@ -287,13 +287,14 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
snprintf(ATIKextBundleId[0], snprintf(ATIKextBundleId[0],
sizeof(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 "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 // ML
snprintf(ATIKextBundleId[1], snprintf(ATIKextBundleId[1],
sizeof(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 "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; ATIConnectorsPatchInited = TRUE;
@ -311,11 +312,11 @@ VOID ATIConnectorsPatchRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_
// for future? // for future?
FSInject->AddStringToList(ForceLoadKexts, 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 // Lion, ML, SnowLeo 10.6.7 2011 MBP
FSInject->AddStringToList(ForceLoadKexts, 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 // SnowLeo
FSInject->AddStringToList(ForceLoadKexts, L"\\ATIFramebuffer.kext\\Contents\\Info.plist"); 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; 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); Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsController);
ExtractKextBundleIdentifier(InfoPlist); ExtractKextBundleIdentifier(InfoPlist);
DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier); DBG_RT(Entry, "Kext: %s\n", gKextBundleIdentifier);

View File

@ -308,7 +308,7 @@ typedef struct KERNEL_AND_KEXT_PATCHES
UINT8 pad[3]; UINT8 pad[3];
UINT32 FakeCPUID; UINT32 FakeCPUID;
// UINT32 align0; // UINT32 align0;
CHAR16 *KPATIConnectorsController; CHAR8 *KPATIConnectorsController;
#if defined(MDE_CPU_IA32) #if defined(MDE_CPU_IA32)
UINT32 align1; UINT32 align1;
#endif #endif

View File

@ -376,7 +376,7 @@ VOID DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches)
// Dell smbios truncate fix // Dell smbios truncate fix
DBG("\tDellSMBIOSPatch: %c\n", Patches->KPDELLSMBIOS ? 'y' : 'n'); DBG("\tDellSMBIOSPatch: %c\n", Patches->KPDELLSMBIOS ? 'y' : 'n');
DBG("\tFakeCPUID: 0x%X\n", Patches->FakeCPUID); 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("\tATIDataLength: %d\n", Patches->KPATIConnectorsDataLen);
DBG("\t%d Kexts to load\n", Patches->NrForceKexts); DBG("\t%d Kexts to load\n", Patches->NrForceKexts);
if (Patches->ForceKexts) { if (Patches->ForceKexts) {