| 500 | } |
| 501 | |
| 502 | EFI_STATUS |
| 503 | LoadUserSettings ( |
| 504 | IN EFI_FILE *RootDir, |
| 505 | IN const XStringW& ConfName, |
| 506 | TagDict** Dict) |
| 507 | { |
| 508 | EFI_STATUS Status = EFI_NOT_FOUND; |
| 509 | UINTN Size = 0; |
| 510 | CHAR8* ConfigPtr = NULL; |
| 511 | XStringW ConfigPlistPath; |
| 512 | XStringW ConfigOemPath; |
| 513 | |
| 514 | // DbgHeader("LoadUserSettings"); |
| 515 | |
| 516 | // load config |
| 517 | if ( ConfName.isEmpty() || Dict == NULL ) { |
| 518 | return EFI_NOT_FOUND; |
| 519 | } |
| 520 | |
| 521 | ConfigPlistPath = SWPrintf("EFI\\CLOVER\\%ls.plist", ConfName.wc_str()); |
| 522 | ConfigOemPath = SWPrintf("%ls\\%ls.plist", OEMPath.wc_str(), ConfName.wc_str()); |
| 523 | if (FileExists (SelfRootDir, ConfigOemPath)) { |
| 524 | Status = egLoadFile(SelfRootDir, ConfigOemPath.wc_str(), (UINT8**)&ConfigPtr, &Size); |
| 525 | } |
| 526 | if (EFI_ERROR(Status)) { |
| 527 | if ((RootDir != NULL) && FileExists (RootDir, ConfigPlistPath)) { |
| 528 | Status = egLoadFile(RootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size); |
| 529 | } |
| 530 | if (!EFI_ERROR(Status)) { |
| 531 | DBG("Using %ls.plist at RootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str()); |
| 532 | } else { |
| 533 | Status = egLoadFile(SelfRootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size); |
| 534 | if (!EFI_ERROR(Status)) { |
| 535 | DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str()); |
| 536 | }else{ |
| 537 | DBG("Cannot find %ls.plist at path: '%ls' or '%ls'\n", ConfName.wc_str(), ConfigPlistPath.wc_str(), ConfigOemPath.wc_str()); |
| 538 | } |
| 539 | } |
| 540 | }else{ |
| 541 | DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigOemPath.wc_str()); |
| 542 | } |
| 543 | |
| 544 | if (!EFI_ERROR(Status) && ConfigPtr != NULL) { |
| 545 | Status = ParseXML((const CHAR8*)ConfigPtr, Dict, Size); |
| 546 | if (EFI_ERROR(Status)) { |
| 547 | // Dict = NULL; |
| 548 | DBG("config.plist parse error Status=%s\n", efiStrError(Status)); |
| 549 | return Status; |
| 550 | } |
| 551 | } |
| 552 | // free configPtr ? |
| 553 | return Status; |
| 554 | } |
| 555 | |
| 556 | STATIC BOOLEAN AddCustomLoaderEntry(IN CUSTOM_LOADER_ENTRY *Entry) |
| 557 | { |
no test coverage detected