4
0
mirror of https://github.com/QuasarApp/pe-parse.git synced 2025-05-04 16:09:33 +00:00

dumping relocations successfully now

This commit is contained in:
Andrew 2013-07-30 18:11:59 -04:00
parent e83e171b8c
commit 05f96a8a8b
2 changed files with 36 additions and 0 deletions
dump-prog
parser-library

@ -45,6 +45,35 @@ void printImports(void *N, RVA impAddr, string &modName, string &symName) {
}
void printRelocs(void *N, VA relocAddr, reloc_type type) {
cout << "TYPE: ";
switch(type) {
case ABSOLUTE:
cout << "ABSOLUTE";
break;
case HIGH:
cout << "HIGH";
break;
case LOW:
cout << "LOW";
break;
case HIGHLOW:
cout << "HIGHLOW";
break;
case HIGHADJ:
cout << "HIGHADJ";
break;
case MIPS_JMPADDR:
cout << "MIPS_JMPADDR";
break;
case MIPS_JMPADDR16:
cout << "MIPS_JMPADD16";
break;
case DIR64:
cout << "DIR64";
break;
}
cout << " VA: 0x" << to_string<VA>(relocAddr, hex) << endl;
return;
}

@ -568,11 +568,18 @@ void IterImpRVAString(parsed_pe *pe, iterRVAStr cb, void *cbd) {
importent i = *it;
cb(cbd, i.addr, i.moduleName, i.symbolName);
}
return;
}
//iterate over relocations in the PE file
void IterRelocs(parsed_pe *pe, iterReloc cb, void *cbd) {
list<reloc> &l = pe->internal->relocs;
for(list<reloc>::iterator it = l.begin(), e = l.end(); it != e; ++it) {
reloc r = *it;
cb(cbd, r.shiftedAddr, r.type);
}
return;
}