Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-03-2005, 19:58
Dr.Golova
 
Posts: n/a
Code:
unsigned long delta = (current_base - image_base);
unsigned int fixup = *(unsigned short*)(table); table += 2;
unsigned int type = (fixup >> 12) & 0x0f;
unsigned int offs = (fixup & 0xfff);

switch( type )
{
case 0: /* IMAGE_REL_BASED_ABSOLUTE */
  break; /* ignore */
case 1: /* IMAGE_REL_BASED_HIGH */
  *(unsigned short*)(block_rva + offs) += (delta >> 16) & 0xffff;
  break;
case 2: /* IMAGE_REL_BASED_LOW */
  *(unsigned short*)(block_rva + offs) += (delta & 0xffff);
  break;
case 3: /* IMAGE_REL_BASED_ABSOLUTE */
  *(unsigned long*)(block_rva + offs) += delta;
  break;
default:
  say_error("WTF? Int's not Win32 PE fixupt type");
  exit(-1);
}
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to patch a dll with relocations? aijundi General Discussion 2 10-13-2022 03:08
Armadillo DLL Relocations.. xzz General Discussion 4 09-28-2004 02:17
pecompact, dll, relocations ftw General Discussion 2 07-25-2004 07:49


All times are GMT +8. The time now is 05:31.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )