MCPcopy Create free account
hub / github.com/LongSoft/UEFITool / rebasePeiFiles

Method rebasePeiFiles

ffsengine.cpp:2478–2524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2476}
2477
2478void FfsEngine::rebasePeiFiles(const QModelIndex & index)
2479{
2480 // Rebase all PE32 and TE sections in PEI-files after modified file
2481 for (int i = index.row(); i < model->rowCount(index.parent()); i++) {
2482 // PEI-file
2483 QModelIndex currentFileIndex = index.parent().child(i, 0);
2484 if (model->subtype(currentFileIndex) == EFI_FV_FILETYPE_PEI_CORE ||
2485 model->subtype(currentFileIndex) == EFI_FV_FILETYPE_PEIM ||
2486 model->subtype(currentFileIndex) == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER) {
2487 for (int j = 0; j < model->rowCount(currentFileIndex); j++) {
2488 // Section in that file
2489 QModelIndex currentSectionIndex = currentFileIndex.child(j, 0);
2490 // If section stores PE32 or TE image
2491 if (model->subtype(currentSectionIndex) == EFI_SECTION_PE32 || model->subtype(currentSectionIndex) == EFI_SECTION_TE)
2492 // Set rebase action
2493 if (model->action(currentSectionIndex) != Actions::Remove)
2494 model->setAction(currentSectionIndex, Actions::Rebase);
2495 }
2496 }
2497 }
2498
2499 // Rebase VTF in subsequent volumes.
2500 QModelIndex parent = index.parent();
2501 while (parent.isValid() && model->type(parent) != Types::Volume)
2502 parent = parent.parent();
2503 if (parent.isValid()) {
2504 QModelIndex volumeContainer = parent.parent();
2505 // Iterate over volumes starting from the one after.
2506 for (int i = parent.row() + 1; i < model->rowCount(volumeContainer); i++) {
2507 QModelIndex currentVolumeIndex = volumeContainer.child(i, 0);
2508 // Iterate over files within each volume after the current one.
2509 for (int j = 0; j < model->rowCount(currentVolumeIndex); j++) {
2510 QModelIndex currentFileIndex = currentVolumeIndex.child(j, 0);
2511 if (model->header(currentFileIndex).left(sizeof(EFI_GUID)) == EFI_FFS_VOLUME_TOP_FILE_GUID) {
2512 for (int k = 0; k < model->rowCount(currentFileIndex); k++) {
2513 QModelIndex currentSectionIndex = currentFileIndex.child(k, 0);
2514 // If section stores PE32 or TE image
2515 if (model->subtype(currentSectionIndex) == EFI_SECTION_PE32 || model->subtype(currentSectionIndex) == EFI_SECTION_TE)
2516 // Set rebase action
2517 if (model->action(currentSectionIndex) != Actions::Remove)
2518 model->setAction(currentSectionIndex, Actions::Rebase);
2519 }
2520 }
2521 }
2522 }
2523 }
2524}
2525
2526UINT8 FfsEngine::insert(const QModelIndex & index, const QByteArray & object, const UINT8 mode)
2527{

Callers

nothing calls this directly

Calls 9

rowMethod · 0.80
rowCountMethod · 0.80
childMethod · 0.80
parentMethod · 0.45
subtypeMethod · 0.45
actionMethod · 0.45
setActionMethod · 0.45
typeMethod · 0.45
headerMethod · 0.45

Tested by

no test coverage detected