| View previous topic :: View next topic |
| Author |
Message |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Sat Jan 16, 2016 9:18 am Post subject: CONTEXT_RECORD structure question |
|
|
Hey together,
If I install a VEH for example and the handler gets triggered, it receives an EXCEPTION_POINTERS structure which also contains a CONTEXT_RECORD structure.
This context record structrue contains the basic state (so all the registers, stack, etc.) of the processor (resp. the application) at the moment the exception occured. So far so good.
If I'd now want to make the program continue on another spot, I'd have to change the EIP register of course. My question now is if it'd be enough to do a command like
| Code: | | ContextRecord.Eip := cTargetAddress; |
or if the "ContextRecord.Eip" variable is just a copy and it'd need a seperate ASM command like
| Code: | asm
mov eip,cTargetAddress
end; |
to achieve that the application continues at "cTargetAddress"?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Jan 16, 2016 12:49 pm Post subject: |
|
|
You would need to be sure the other registers and stack are adjusted accordingly to the new location that you are trying to force the target to. Otherwise you are going to land up crashing due to an unbalanced stack or due to invalid register data.
For example if you want to set the Eip to execute a class function after the exception happens, you will need to be sure that ECX is set properly along with any other values and stack data that the call may be expecting.
_________________
- Retired. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25814 Location: The netherlands
|
Posted: Sat Jan 16, 2016 2:19 pm Post subject: |
|
|
contextrecord.eip is what you need to change
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Sat Jan 16, 2016 2:44 pm Post subject: |
|
|
| Ok, thanks the both of you.
|
|
| Back to top |
|
 |
|