 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
broly7 Advanced Cheater
Reputation: 0
Joined: 13 Aug 2015 Posts: 60
|
Posted: Sun Sep 27, 2015 8:41 am Post subject: [DELPHI] INT3 Breakpoints on Injected DLL |
|
|
Hello fellows!
I have a question, i'm using a dll to get injected into the Host process.
This DLL must be able to breakpoint an address (With INT3 breakpoints, cuz i heard you can use infinite of these)
Is this possible?
PBYTE($10000000)^:=$CC
I think this is the same as writing INT3, however this would break the execution, how can i handle this breakpoint exception, to check registers such as EAX,EDX,ECX etc?
I read many stuff about doing such things with an external debugger, but i'm working internally
Please if somebody could help me, even with another programming language, to breakpoint and check registers to the address i want...
|
|
Back to top |
|
 |
ulysse31 Master Cheater
Reputation: 2
Joined: 19 Mar 2015 Posts: 324 Location: Paris
|
Posted: Sun Sep 27, 2015 1:49 pm Post subject: |
|
|
If all you intend to do is check register why don't you simply hook the function where you intended to break initially and store the register's values in different variables ?
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Sep 27, 2015 2:07 pm Post subject: |
|
|
If you are injected, you can use DebugActiveProcess to attach as a debugger to the current process. Afterward, you will need to manage the debug loop yourself. For that you will need to handle WaitForDebugEvent in a loop and process the debug events.
You cannot just write a 0xCC anywhere and expect it to do everything magically either. You need to save and restore the original data when the breakpoint is being handled in your debug loop. Otherwise, you are just going to crash the application.
As for reading the register data, you need to use:
- OpenThread
- SuspendThread
- GetThreadContext
- SetThreadContext (if you want to set things)
- ResumeThread
- CloseHandle
_________________
- Retired. |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Sun Sep 27, 2015 2:32 pm Post subject: |
|
|
only when not injected you can use the debug api as each event will freeze every thread, including the debuggerthread (no idea if the hidefromdebugger threadflag has an effect, but i doubt it)
when injected you're better off hijacking the exception (e.g exception handler hook, or a vectored exception handler)
cc breakpoints might sound easy, but there are some things to keep in mind like freezing all other threads, set the current thread to single step, resume and wait for the step and set the cc back , and resume the other threads (and not to mention multithreaded hell where two cpu's execute that instructions at the same time)
but, most importantly, what is the reason you're using breakpoints? If it is because editing the memory causes the game to terminate due to an integrity check, then cc breakpoints will be useless to you
_________________
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 |
|
 |
broly7 Advanced Cheater
Reputation: 0
Joined: 13 Aug 2015 Posts: 60
|
Posted: Sun Sep 27, 2015 4:03 pm Post subject: |
|
|
Dark Byte wrote: | only when not injected you can use the debug api as each event will freeze every thread, including the debuggerthread (no idea if the hidefromdebugger threadflag has an effect, but i doubt it)
when injected you're better off hijacking the exception (e.g exception handler hook, or a vectored exception handler)
cc breakpoints might sound easy, but there are some things to keep in mind like freezing all other threads, set the current thread to single step, resume and wait for the step and set the cc back , and resume the other threads (and not to mention multithreaded hell where two cpu's execute that instructions at the same time)
but, most importantly, what is the reason you're using breakpoints? If it is because editing the memory causes the game to terminate due to an integrity check, then cc breakpoints will be useless to you |
Yes, my goal is to scan mem for every function in a module, and apply a breakpint on execute of each address, then extract a log with results of registers.
atom0s way seems good to study. What do you think Darkbyte?
Also i'd like to see some short code of what you meanthioned: Vectored exception handling.
So i have something to study and to support on.
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|