Changeset 58460 in vbox for trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library
- Timestamp:
- Oct 28, 2015 8:34:41 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103763
- Location:
- trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
r58459 r58460 2420 2420 if (Handle != NULL) { 2421 2421 #ifdef VBOX /* We have more options to try out because of apple. */ 2422 //2423 // Try parse any config="folder-path/" stuff found in the optional2424 // section of the boot option and attempt to load boot.efi it.2425 //2426 if (Option->LoadOptionsSize) {2427 /*2422 // 2423 // Try parse any config="folder-path/" stuff found in the optional 2424 // section of the boot option and attempt to load boot.efi it. 2425 // 2426 if (Option->LoadOptionsSize) { 2427 /* 2428 2428 * First, see the there is a config=folder in the load options. We 2429 2429 * interpret it as a path to the folder containing boot.efi and go … … 2461 2461 */ 2462 2462 VBoxLogFlowFuncMarkVar(Option->LoadOptions, "%s"); 2463 if (StrnCmp(L"config=", (CHAR16 *)Option->LoadOptions, 7) == 0) { 2464 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume; 2465 CHAR16 *pszConfigValue = &((CHAR16 *)Option->LoadOptions)[7]; 2466 CHAR16 *pszFolder = NULL; 2467 CHAR16 *pszTemp0 = NULL; 2468 CHAR16 *pszTemp1 = NULL; 2469 BOOLEAN fQuoted = (pszConfigValue[0] == L'\"'); 2470 pszTemp0 = &pszConfigValue[fQuoted ? 2 : 1]; 2471 pszTemp1 = pszTemp0; 2472 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2473 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2474 pszFolder = AllocateZeroPool((StrLen(pszConfigValue) + StrLen(L"\\boot.efi") + 1) * sizeof(UINT16)); 2475 while (pszTemp0) { 2476 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2477 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2478 pszFolder = StrnCat(pszFolder, pszTemp1, StrLen(pszTemp1) - StrLen(pszTemp0)); 2479 pszTemp1 = pszTemp0; 2480 pszFolder = StrCat(pszFolder, L"\\"); 2481 VBoxLogFlowFuncMarkVar(pszFolder, "%s"); 2482 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2483 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2484 pszTemp0 = StrStr(&pszTemp0[1], L"\\"); 2485 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2486 } 2487 pszFolder = StrCat(pszFolder, L"boot.efi"); 2488 VBoxLogFlowFuncMarkVar(pszFolder,"%s"); 2489 2490 Status = gBS->HandleProtocol(Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume); 2491 VBoxLogFlowFuncMarkRC(Status); 2492 if (!EFI_ERROR(Status)) { 2493 FilePath = FileDevicePath((EFI_HANDLE)Handle, pszFolder); 2494 if (FilePath) { 2495 VBoxLogFlowFuncMarkVar(DevicePathToStr(FilePath), "%s"); 2496 REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32 (PcdProgressCodeOsLoaderLoad)); 2497 Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle ); 2498 VBoxLogFlowFuncMarkRC(Status); 2499 /** @todo Probably leaking memory here! */ 2463 if (StrnCmp(L"config=", (CHAR16 *)Option->LoadOptions, 7) == 0) { 2464 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume; 2465 CHAR16 *pszConfigValue = &((CHAR16 *)Option->LoadOptions)[7]; 2466 CHAR16 *pszFolder = NULL; 2467 CHAR16 *pszTemp0 = NULL; 2468 CHAR16 *pszTemp1 = NULL; 2469 BOOLEAN fQuoted = (pszConfigValue[0] == L'\"'); 2470 pszTemp0 = &pszConfigValue[fQuoted ? 2 : 1]; 2471 pszTemp1 = pszTemp0; 2472 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2473 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2474 pszFolder = AllocateZeroPool((StrLen(pszConfigValue) + StrLen(L"\\boot.efi") + 1) * sizeof(UINT16)); 2475 while (pszTemp0) { 2476 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2477 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2478 pszFolder = StrnCat(pszFolder, pszTemp1, StrLen(pszTemp1) - StrLen(pszTemp0)); 2479 pszTemp1 = pszTemp0; 2480 pszFolder = StrCat(pszFolder, L"\\"); 2481 VBoxLogFlowFuncMarkVar(pszFolder, "%s"); 2482 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2483 VBoxLogFlowFuncMarkVar(pszTemp1, "%s"); 2484 pszTemp0 = StrStr(&pszTemp0[1], L"\\"); 2485 VBoxLogFlowFuncMarkVar(pszTemp0, "%s"); 2486 } 2487 pszFolder = StrCat(pszFolder, L"boot.efi"); 2488 VBoxLogFlowFuncMarkVar(pszFolder,"%s"); 2489 2490 Status = gBS->HandleProtocol(Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume); 2491 VBoxLogFlowFuncMarkRC(Status); 2492 if (!EFI_ERROR(Status)) { 2493 FilePath = FileDevicePath((EFI_HANDLE)Handle, pszFolder); 2494 if (FilePath) { 2495 VBoxLogFlowFuncMarkVar(DevicePathToStr(FilePath), "%s"); 2496 REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32 (PcdProgressCodeOsLoaderLoad)); 2497 Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle ); 2498 VBoxLogFlowFuncMarkRC(Status); 2499 /** @todo Probably leaking memory here! */ 2500 } 2500 2501 } 2501 2502 } 2502 2503 } 2503 } 2504 2505 // 2506 // Try load any of the default boot files. 2507 // 2508 if (EFI_ERROR(Status)) { 2509 UINT32 IdxFile; 2510 for (IdxFile = 0; IdxFile < sizeof(maBdsLibBootFiles) / sizeof(maBdsLibBootFiles[0]); IdxFile++) { 2511 FilePath = FileDevicePath(Handle, maBdsLibBootFiles[IdxFile]); 2512 if (FilePath) { 2513 VBoxLog(("BdsLibBootViaBootOption: Trying to load '%s'...\n", DevicePathToStr(FilePath))); 2514 REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32(PcdProgressCodeOsLoaderLoad)); 2515 Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle ); 2516 if (!EFI_ERROR(Status)) { 2517 VBoxLog(("BdsLibBootViaBootOption: Successfully loaded boot file: %s\n", DevicePathToStr(FilePath))); 2518 break; 2504 2505 // 2506 // Try load any of the default boot files. 2507 // 2508 if (EFI_ERROR(Status)) { 2509 UINT32 IdxFile; 2510 for (IdxFile = 0; IdxFile < sizeof(maBdsLibBootFiles) / sizeof(maBdsLibBootFiles[0]); IdxFile++) { 2511 FilePath = FileDevicePath(Handle, maBdsLibBootFiles[IdxFile]); 2512 if (FilePath) { 2513 VBoxLog(("BdsLibBootViaBootOption: Trying to load '%s'...\n", DevicePathToStr(FilePath))); 2514 REPORT_STATUS_CODE(EFI_PROGRESS_CODE, PcdGet32(PcdProgressCodeOsLoaderLoad)); 2515 Status = gBS->LoadImage(TRUE, gImageHandle, FilePath, NULL, 0, &ImageHandle ); 2516 if (!EFI_ERROR(Status)) { 2517 VBoxLog(("BdsLibBootViaBootOption: Successfully loaded boot file: %s\n", DevicePathToStr(FilePath))); 2518 break; 2519 } 2520 VBoxLog(("BdsLibBootViaBootOption: Failed loading '%s': 0x%x(%r)\n", DevicePathToStr(FilePath), Status, Status)); 2521 FilePath = NULL; /** @todo Probably leaking memory here! */ 2519 2522 } 2520 VBoxLog(("BdsLibBootViaBootOption: Failed loading '%s': 0x%x(%r)\n", DevicePathToStr(FilePath), Status, Status));2521 FilePath = NULL; /** @todo Probably leaking memory here! */2522 2523 } 2523 2524 } 2524 }2525 2525 #else /* !VBOX */ 2526 2526 // … … 2541 2541 } 2542 2542 #endif /* !VBOX */ 2543 }2544 }2543 } 2544 } 2545 2545 } 2546 2546 // -
trunk/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
r58459 r58460 565 565 566 566 if (TempSize + FilePathSize + sizeof (UINT16) + sizeof (UINT32) > VariableSize) { 567 568 567 VBoxLogFlowFuncLeave(); 568 return FALSE; 569 569 } 570 570
Note:
See TracChangeset
for help on using the changeset viewer.