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 


API for "modify register at address"?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
ducspam
Expert Cheater
Reputation: 0

Joined: 07 Oct 2005
Posts: 171

PostPosted: Fri Oct 14, 2005 6:58 am    Post subject: Reply with quote

Nope. I'm not even doing Set/GetThreadContext. All I was trying to see is what kind of events and exceptions was called.

This is what msdn say about EXCEPTION_INVALID_HANDLE:
Quote:
The thread used a handle to a kernel object that was invalid (probably because it had been closed.)

This value is defined as STATUS_INVALID_HANDLE.

STATUS_INVALID_HANDLE
The API call was passed a handle to a kernel object which was invalid -usually because that handle has already been closed.


Below is all I'm doing, you think WriteProcessMemory is somehow terminating the handle? Basically this was how I patched it. After that is done, I enter the debug loop.
Code:
int handle = LoadLibrary("kernel32");
int baseAddress = GetProcAddress(handle,"IsDebuggerPresent");
this.patchAddress = baseAddress+9;  // finding writeAddress

WriteProcessMemory(process.Handle, (IntPtr)this.patchAddress, this.patchBuffer, PATCH_BYTES, out bytesWrite);

// then go into debug event loop to wait for events and exceptions
Back to top
View user's profile Send private message
ducspam
Expert Cheater
Reputation: 0

Joined: 07 Oct 2005
Posts: 171

PostPosted: Fri Oct 14, 2005 7:02 pm    Post subject: Reply with quote

Ok, I think I got it working.

My solution was:
1) Open up the process and do the "patching". Then set the process to null after you're done.
2) Open up the process (again) and do the debug. This seem to work fine.

In addition, the modifying of the register works and I saw a shitload of "exception" (that I on purposely caused which is a good thing). Well there was so much that it crash. I haven't been running the debugger on another process yet, but I will now.

Question:
Since I can only put 4 hardware exceptions in there (Dr0, Dr1, Dr2, Dr3), how come CE only does 3? Would it be possible to create another debugger (2 of them) and this way double the hardware exceptions?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Fri Oct 14, 2005 7:16 pm    Post subject: Reply with quote

ce only has 3 because it uses the 4th for stuff like "stepping over" and "run till" commands while debugging.

And no, it doesn't increase the number of registers when you have more debuggers. Each thread can only have 4 debug regs. Both debuggers will be working with the same thread so that won't work .And not to mention you can't have 2 (usermode) debuggers running at the same time (kernel debuggers are a different thing especially when they chain eachother int handlers)

_________________
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
ducspam
Expert Cheater
Reputation: 0

Joined: 07 Oct 2005
Posts: 171

PostPosted: Fri Oct 14, 2005 9:44 pm    Post subject: Reply with quote

Off topic but I was wondering:

What's the API for changing the value at an address?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Oct 15, 2005 5:17 am    Post subject: Reply with quote

WriteProcessMemory
_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 3:05 am    Post subject: Reply with quote

i have some problems on my debugger

i have set an int3 breakpoint on a process that my debugger debugging, after the breakpoint reach, i call GetThreadContext to get the thread context, then i change the eax value, then i call the SetThreadContext to set the thread context back to the thread, then write back the original byte, after that i call ContinueDebugEvent to continue the thread, but it skip the instruction that i set breakpoint.

another problem is hardware breakpoint, after i call ContinueDebugEvent, it still break on the same instruction without continue the thread
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 26, 2006 3:29 am    Post subject: Reply with quote

for int3:
write back the original byte

getcontextthread
change eax
decrease eip with 1
set the single step flag in the eflags register
setcontextthread

continue.
in the next event set the byte back to int3 and continue

for hardware breakpoint:
on a break, remove the debug breakpoint, do a single step, and then set the breakpoint back. (Like above, but then without a int3 but with a debugregister and no decrease eip)

_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 7:21 am    Post subject: Reply with quote

how about if i want to change eip also?
did i need to decrease eip after change eip?
or i no need to decrease eip?
Back to top
View user's profile Send private message
CryptWizard
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2005
Posts: 79

PostPosted: Fri Oct 13, 2006 5:25 pm    Post subject: Reply with quote

I figured out this INT handler stuff, but how do you set a breakpoint?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Oct 14, 2006 1:16 am    Post subject: Reply with quote

change the debugregisters so they raise a int1 on execute, write or read/write
use a apc, setthreadcontext os pssetcontextthread

_________________
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
CryptWizard
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2005
Posts: 79

PostPosted: Mon Oct 16, 2006 5:07 am    Post subject: Reply with quote

What would I have to pass to NtSetContextThread() to do that? since I would perfer to do as much stuff from kernel mode as possible. If there is another kernel way to do it please tell me. Thanks for the help. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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