Dynamic code

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
Holus
Member
Member
Posts: 51
Joined: Thu Jan 27, 2011 5:57 pm

Dynamic code

Post by Holus »

Maybe a stupid question, but is there a way (in protected mode) to determine your the EIP?

I want to change some code based on the place I’m executing.
But this code is generated so it’s no option to make a label to determine it.

Is there an other way?
Computer says NOOOO
User avatar
XanClic
Member
Member
Posts: 138
Joined: Wed Feb 13, 2008 9:38 am

Re: Dynamic code

Post by XanClic »

Code: Select all

db 0xE8
dd 0x00000000
pop eax
This is a relative call with offset 0, so the EIP will effectively not be changed, however, it will be pushed onto the stack, so EAX will contain the address of the POP EAX instruction after executing it.
User avatar
Holus
Member
Member
Posts: 51
Joined: Thu Jan 27, 2011 5:57 pm

Re: Dynamic code

Post by Holus »

XanClic wrote:

Code: Select all

db 0xE8
dd 0x00000000
pop eax
Pfff sometimes a little code can make a big deference.

I tested it and EAX = Where code "0xE8" is + 3.
Now i can start calculating!!

Thanks!!!
Computer says NOOOO
Post Reply