Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hardware breakpoint

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
jamils1992
Newbie cheater
Reputation: 0

Joined: 21 Aug 2015
Posts: 10

PostPosted: Sun May 20, 2018 4:43 am    Post subject: Hardware breakpoint Reply with quote

I want to make a dll inject it into the game and use hardware breakpoint to change RIP at that address to my new code .

I was wondering do i have to suspend all of the threads in game and get their context and compare RIP to the address i want to change the RIP at or is it possible to trigger the breakpoint at a certain address ,Knowing i can't change game bytes because of anti-cheats.

Game i want to do this for is Assassin Creed Unity .
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun May 20, 2018 5:16 am    Post subject: Reply with quote

get an exception callback (e.g hook the exceptionhandler in windows dlls or use a vectoredexceptionhandler

then set breakpoints using setthreadcontext and when the breakpoint triggers an exception change rip in the context struct and resume the exception as handled

do check that the rip is what it should be as your exception handler will also get exceptions not caused by 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
View user's profile Send private message MSN Messenger
jamils1992
Newbie cheater
Reputation: 0

Joined: 21 Aug 2015
Posts: 10

PostPosted: Sun May 27, 2018 12:55 pm    Post subject: Reply with quote

Dark Byte wrote:
get an exception callback (e.g hook the exceptionhandler in windows dlls or use a vectoredexceptionhandler

then set breakpoints using setthreadcontext and when the breakpoint triggers an exception change rip in the context struct and resume the exception as handled

do check that the rip is what it should be as your exception handler will also get exceptions not caused by you


For some reason when i get dr7 on my testing program its set to 0xcccccccccccccccc and most registers are set to the same thing .

I can set the thread context without any issue and the exception handler is working properly , but getting the thread context doesn't seem to be working even though it returns 1 , any idea ? .

I checked with CE and its displaying the registers and my break point fine .



threadcontext.png
 Description:
 Filesize:  7.21 KB
 Viewed:  3428 Time(s)

threadcontext.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun May 27, 2018 1:39 pm    Post subject: Reply with quote

that means it's not returning anything and you've compiled your program in debugmode. visual studio initializes memory to 0xcc in debugmode

Also, what is returning 1 ? In your exception handler you do not call get/setthreadcontext, you access the exception record provided by the parameter your exception handler receives

_________________
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
View user's profile Send private message MSN Messenger
jamils1992
Newbie cheater
Reputation: 0

Joined: 21 Aug 2015
Posts: 10

PostPosted: Sun May 27, 2018 1:44 pm    Post subject: Reply with quote

Dark Byte wrote:
that means it's not returning anything and you've compiled your program in debugmode. visual studio initializes memory to 0xcc in debugmode

Also, what is returning 1 ? In your exception handler you do not call get/setthreadcontext, you access the exception record provided by the parameter your exception handler receives

I meant GetThreadContext returns 1
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun May 27, 2018 1:51 pm    Post subject: Reply with quote

Try zeroing out the context object before passing it to GetThreadContext

And do you set the correct fields of the context record before calling it? (e.g ContextFlags=CONTEXT_DEBUG_REGISTERS)



(you need to access ExceptionInfo->ContextRecord instead of using getthreadcontext in your exception handler)

_________________
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
View user's profile Send private message MSN Messenger
jamils1992
Newbie cheater
Reputation: 0

Joined: 21 Aug 2015
Posts: 10

PostPosted: Sun May 27, 2018 2:46 pm    Post subject: Reply with quote

Dark Byte wrote:
Try zeroing out the context object before passing it to GetThreadContext

And do you set the correct fields of the context record before calling it? (e.g ContextFlags=CONTEXT_DEBUG_REGISTERS)



(you need to access ExceptionInfo->ContextRecord instead of using getthreadcontext in your exception handler)


I did set the ContextFlags before SetThreadContext but forgot to do it before GetThreadContext and that was causing the bug .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites