Skip to content

Commit e288a05

Browse files
committed
fix several mistakes
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
1 parent 508397d commit e288a05

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

Library/OcAppleKernelLib/CachelessContext.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,8 @@ CachelessContextAddKext (
808808
IN CONST CHAR8 *InfoPlist,
809809
IN UINT32 InfoPlistSize,
810810
IN CONST UINT8 *Executable OPTIONAL,
811-
IN UINT32 ExecutableSize OPTIONAL
811+
IN UINT32 ExecutableSize OPTIONAL,
812+
OUT CONST CHAR8 **BundleVersion OPTIONAL
812813
)
813814
{
814815
EFI_STATUS Status;
@@ -834,6 +835,13 @@ CachelessContextAddKext (
834835
ASSERT (InfoPlist != NULL);
835836
ASSERT (InfoPlistSize > 0);
836837

838+
//
839+
// Assume no bundle version from the beginning.
840+
//
841+
if (BundleVersion != NULL) {
842+
*BundleVersion = NULL;
843+
}
844+
837845
IsLoadable = FALSE;
838846
PlistHasChanges = FALSE;
839847

@@ -945,6 +953,21 @@ CachelessContextAddKext (
945953
if (!Context->Is32Bit) {
946954
InfoPlistLibraries = InfoPlistLibraries64;
947955
}
956+
} else {
957+
DEBUG_CODE_BEGIN ();
958+
if ((BundleVersion != NULL) && (AsciiStrCmp (TmpKeyValue, INFO_BUNDLE_VERSION_KEY) == 0)) {
959+
if (PlistNodeCast (InfoPlistValue, PLIST_NODE_TYPE_STRING) == NULL) {
960+
XmlDocumentFree (InfoPlistDocument);
961+
FreePool (TmpInfoPlist);
962+
FreePool (NewKext->PlistData);
963+
FreePool (NewKext);
964+
return EFI_INVALID_PARAMETER;
965+
}
966+
967+
*BundleVersion = XmlNodeContent (InfoPlistValue);
968+
}
969+
970+
DEBUG_CODE_END ();
948971
}
949972
}
950973
}

Library/OcMainLib/OpenCoreKernel.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ OcKernelInjectKext (
581581
CHAR8 FullPath[OC_STORAGE_SAFE_PATH_MAX];
582582
UINT32 MaxKernel;
583583
UINT32 MinKernel;
584+
CONST CHAR8 *BundleVersion;
584585

585586
if (!Kext->Enabled || (Kext->PlistData == NULL)) {
586587
return;
@@ -633,7 +634,8 @@ OcKernelInjectKext (
633634
Kext->PlistData,
634635
Kext->PlistDataSize,
635636
Kext->ImageData,
636-
Kext->ImageDataSize
637+
Kext->ImageDataSize,
638+
&BundleVersion
637639
);
638640
}
639641
} else if (CacheType == CacheTypeMkext) {
@@ -644,7 +646,8 @@ OcKernelInjectKext (
644646
Kext->PlistData,
645647
Kext->PlistDataSize,
646648
Kext->ImageData,
647-
Kext->ImageDataSize
649+
Kext->ImageDataSize,
650+
&BundleVersion
648651
);
649652
} else if (CacheType == CacheTypePrelinked) {
650653
Status = PrelinkedInjectKext (
@@ -655,7 +658,8 @@ OcKernelInjectKext (
655658
Kext->PlistDataSize,
656659
ExecutablePath,
657660
Kext->ImageData,
658-
Kext->ImageDataSize
661+
Kext->ImageDataSize,
662+
&BundleVersion
659663
);
660664
} else {
661665
Status = EFI_UNSUPPORTED;

0 commit comments

Comments
 (0)