const PeSectionHeader section_table[],
UINTN n_table,
const char * const sections[],
- UINTN *addrs,
UINTN *offsets,
- UINTN *sizes) {
+ UINTN *sizes,
+ bool in_memory) {
assert(section_table);
assert(sections);
+ assert(offsets);
assert(sizes);
for (UINTN i = 0; i < n_table; i++) {
if (memcmp(sect->Name, sections[j], strlen8(sections[j])) != 0)
continue;
- if (addrs)
- addrs[j] = sect->VirtualAddress;
- if (offsets)
- offsets[j] = sect->PointerToRawData;
+ offsets[j] = in_memory ? sect->VirtualAddress : sect->PointerToRawData;
sizes[j] = sect->VirtualSize;
}
}
pe->FileHeader.NumberOfSections,
sections,
&addr,
- NULL,
- &size);
+ &size,
+ /*in_memory=*/true);
if (size == 0)
return 0;
pe->FileHeader.NumberOfSections,
sections,
addrs,
- NULL,
- sizes);
+ sizes,
+ /*in_memory=*/true);
return EFI_SUCCESS;
}
return EFI_LOAD_ERROR;
locate_sections(section_table, pe.FileHeader.NumberOfSections,
- sections, NULL, offsets, sizes);
+ sections, offsets, sizes, /*in_memory=*/false);
return EFI_SUCCESS;
}