MCPcopy Create free account
hub / github.com/connorjaydunn/BinaryShield / fileOffsetToRva

Method fileOffsetToRva

src/pe.cpp:115–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115DWORD PE::fileOffsetToRva(DWORD offset)
116{
117 // find section rva lies within and calculate rva
118 for (int i = 0; i < pNtHeader->FileHeader.NumberOfSections; i++)
119 {
120 if (offset >= pSectionHeader[i].PointerToRawData &&
121 offset < pSectionHeader[i].PointerToRawData + (pSectionHeader[i].SizeOfRawData))
122 {
123 return (offset - pSectionHeader[i].PointerToRawData) + pSectionHeader[i].PointerToRawData;
124 }
125 }
126
127 // this should never happen
128 return 0x0;
129}
130
131bool PE::parseHeaders()
132{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected