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 


Debug Registers...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Tue Nov 11, 2008 11:16 am    Post subject: Debug Registers... Reply with quote

Whats the problem with this?

Code:
  tCONTEXT.ContextFlags:=CONTEXT_DEBUG_REGISTERS;
  tCONTEXT.Dr7:=set0 or set1 or set2 or set3;
  //Clear Registers
  tCONTEXT.Dr0:=0;
  tCONTEXT.Dr1:=0;
  tCONTEXT.Dr2:=0;
  tCONTEXT.Dr3:=0;
  If reg=0 then tCONTEXT.Dr0:=Address;
  If reg=1 then tCONTEXT.Dr1:=Address;
  If reg=2 then tCONTEXT.Dr2:=Address;
  If reg=3 then tCONTEXT.Dr3:=Address;
  suspendthread(threadid);
  setthreadcontext(threadid,tCONTEXT);
  resumethread(threadid);


So This is done to every thread that exists in a process. I tried getting the context first then putting it back in with the breakpoints but it doesn't work... Help? I probably made about 10 mistakes in working registers but oh well...
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Tue Nov 11, 2008 12:19 pm    Post subject: Reply with quote

a whole code section would make it far easier to debug for you Wink
Back to top
View user's profile Send private message MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Tue Nov 11, 2008 1:49 pm    Post subject: Reply with quote

I don't know if it matters, but you could try first doing:
GetThreadContext, and then modify the output, and then do SetThreadContext. Because maybe the thread has already got some flags on/off which you change by doing it this way.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Tue Nov 11, 2008 4:07 pm    Post subject: Reply with quote

i agree with Tombana but the methodology should be a bit different

Code:
SuspendThread()
GetThreadContext()
ModifyTheContext
SetThreadContext()
FlushInstructionCache()
ResumeThread()
Back to top
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Nov 11, 2008 5:27 pm    Post subject: Reply with quote

Other APIs you will probably need

Code:

OpenThread
CloseHandle
DebugActiveProcess
DebugActiveProcessStop
WaitForDebugEvent
ContinueDebugEvent

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Nov 12, 2008 6:36 pm    Post subject: Reply with quote

I tried those things... Including DebugActiveProcess, and getting the context then setting. But nothing works on the process cause I made a dummy program where clicking a button tells you the address of the function and another button activates the function. I set a breakpoint with cheatengine and it activates when I click the 2nd button but when I try it my self with get/setthreadcontext, it does nothing...
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Thu Nov 13, 2008 11:16 am    Post subject: Reply with quote

do you have SE_DEBUG_NAME privilege?
also a more robust snippet would greatly help me help you Shocked
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Nov 13, 2008 5:59 pm    Post subject: Reply with quote

Dang... I forgot to give my process debug privs...
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