Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CBaseRelocation::bindToModule(LPVOID dllBase, CMemory& memory, DWORD dwOriginalBase) {
- DWORD baseAddress = mReloc.VirtualAddress + (DWORD)dllBase;
- for(auto entry : mRelocations) {
- WORD relocationType = (entry & 0xF000) >> 12;
- if(relocationType == IMAGE_REL_BASED_ABSOLUTE)
- continue;
- if(relocationType == IMAGE_REL_BASED_HIGHLOW) {
- DWORD offset = baseAddress + (entry & 0xFFF);
- DWORD dwOldAddress = 0;
- memory.read(offset, dwOldAddress);
- dwOldAddress -= dwOriginalBase;
- dwOldAddress += (DWORD)dllBase;
- memory.write(offset, dwOldAddress);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment