| 3021 | } |
| 3022 | |
| 3023 | XStringW GetBundleVersion(const XStringW& FullName) |
| 3024 | { |
| 3025 | EFI_STATUS Status; |
| 3026 | XStringW CFBundleVersion; |
| 3027 | XStringW InfoPlistPath; |
| 3028 | CHAR8* InfoPlistPtr = NULL; |
| 3029 | TagDict* InfoPlistDict = NULL; |
| 3030 | const TagStruct* Prop = NULL; |
| 3031 | UINTN Size; |
| 3032 | InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Contents\\Info.plist"); |
| 3033 | Status = egLoadFile(SelfRootDir, InfoPlistPath.wc_str(), (UINT8**)&InfoPlistPtr, &Size); |
| 3034 | if (EFI_ERROR(Status)) { |
| 3035 | InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Info.plist"); |
| 3036 | Status = egLoadFile(SelfRootDir, FullName.wc_str(), (UINT8**)&InfoPlistPtr, &Size); |
| 3037 | } |
| 3038 | if(!EFI_ERROR(Status)) { |
| 3039 | //DBG("about to parse xml file %ls\n", InfoPlistPath.wc_str()); |
| 3040 | Status = ParseXML(InfoPlistPtr, &InfoPlistDict, Size); |
| 3041 | if(!EFI_ERROR(Status) && (InfoPlistDict != nullptr)) { |
| 3042 | Prop = InfoPlistDict->propertyForKey("CFBundleVersion"); |
| 3043 | if (Prop != NULL && Prop->isString() && Prop->getString()->stringValue().notEmpty()) { |
| 3044 | CFBundleVersion = SWPrintf("%s", Prop->getString()->stringValue().c_str()); |
| 3045 | } |
| 3046 | } |
| 3047 | } |
| 3048 | if (InfoPlistPtr) { |
| 3049 | FreePool(InfoPlistPtr); |
| 3050 | } |
| 3051 | if ( InfoPlistDict ) InfoPlistDict->FreeTag(); |
| 3052 | return CFBundleVersion; |
| 3053 | } |
| 3054 | |
| 3055 | VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath) |
| 3056 | { |
no test coverage detected