/** * @brief Converts a relative virtual address to file offset. * * @param base A pointer to the memory mapped PE-file. * @param rva The relative virtual-address. * * @return The address in file mapping corresponding to `rva` or `ZYAN_NULL`. */ const void* RVAToFileOffset(const void* base, ZyanU64 rva) { ZYAN_ASSERT(base); const IMAGE_SECTION_HEADER* section = GetSectionByRVA(base, rva); if (!section) { return ZYAN_NULL; } return (void*)((ZyanU8*)base + section->PointerToRawData + (rva - section->VirtualAddress)); }
HRESULT PEFileT<T>::GetSectionByVA(PEAddress nVA, IPESection **ppSection) { return GetSectionByRVA(GetRVAFromVA(nVA), ppSection); }