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 


[help]SetThreadContext

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
natanreis1
Cheater
Reputation: 1

Joined: 01 Apr 2008
Posts: 44
Location: Somewhere over the rainbow

PostPosted: Fri Dec 12, 2008 12:09 pm    Post subject: [help]SetThreadContext Reply with quote

im using this script to edit memory but i want to Hack using SetThreadContext or Hardware Breakpoints

Procedure InjectPinTyper(Address:Cardinal; nCase:ShortInt); export;
const aInject:Array [0..2] of byte = ($0F, $83, $6C);//Modifies 1 BYTE, 85 to 83
aEject:Array [0..2] of byte = ($0F, $86, $6C);
Access = PROCESS_VM_WRITE or PROCESS_VM_OPERATION;
Begin
hWindow:=FindWindow('Class',Nil);
if hWindow=0 then
showmessage('Start the "Game"');
if hWindow<>0 then
case nCase of
1: //Inject PT
Try
GetWindowThreadProcessId(hWindow, @PID);
hProcess:=OpenProcess(Access, FALSE, PID);
WriteProcessMemory(hProcess, Ptr(Address), @aInject, sizeof(aInject), lpBytes);
CloseHandle(hProcess);
except
ShowMessageFmt('GetLastError Code: %.d', [IntToStr(GetLastError())]);
End;
2: //Eject PT
Try
GetWindowThreadProcessId(hWindow, @PID);
hProcess:=OpenProcess(Access, FALSE, PID);
WriteProcessMemory(hProcess, Ptr(Address), @aEject, sizeof(aEject), lpBytes);
CloseHandle(hProcess);
except
ShowMessageFmt('GetLastError Code: %.d', [IntToStr(GetLastError())]);
End;
End;
End;


Last edited by natanreis1 on Sun Jan 30, 2011 7:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
Xeleron
Grandmaster Cheater
Reputation: 0

Joined: 05 Jan 2008
Posts: 652

PostPosted: Fri Dec 12, 2008 12:48 pm    Post subject: Reply with quote

maybe this can help you Razz
http://www.microsoft.com/programming-tutorials/70185-tut-how-make-search-loop-any-game-delphi-7-a.html

_________________
why Hitler? why did you had to pm me that child porn?
btw Hitler, Shave your pubic hair

PM Me for Hitler's Nude pics
Back to top
View user's profile Send private message MSN Messenger
natanreis1
Cheater
Reputation: 1

Joined: 01 Apr 2008
Posts: 44
Location: Somewhere over the rainbow

PostPosted: Fri Dec 12, 2008 12:58 pm    Post subject: Reply with quote

matthew2010 wrote:
maybe this can help you Razz

i already searched Confused
Back to top
View user's profile Send private message
p99
Master Cheater
Reputation: 0

Joined: 21 Jan 2007
Posts: 271

PostPosted: Fri Dec 12, 2008 1:08 pm    Post subject: Reply with quote

How about looking at the CE source...
_________________
Back to top
View user's profile Send private message
natanreis1
Cheater
Reputation: 1

Joined: 01 Apr 2008
Posts: 44
Location: Somewhere over the rainbow

PostPosted: Fri Dec 12, 2008 1:13 pm    Post subject: Reply with quote

setthreadcontext is very complicated.
can someone give me a example?
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri Dec 12, 2008 4:52 pm    Post subject: Reply with quote

Use SuspendThread to suspend all threads.
Use GetTHreadContext To Retrieve the context from a thread.
Modify the debug registers (DR0-DR3) to the address of violation.
Set DR7 to to on access.
Replace the context into the thread using SetThreadContext.

Watch for the access command when the command runs through.
Set the zf flag to 1.
Resume the thread that has accessed.

I got the first parts but I can't really get a listener for detecting access. How you do that has something to do with DR6... But Idk...
Back to top
View user's profile Send private message
natanreis1
Cheater
Reputation: 1

Joined: 01 Apr 2008
Posts: 44
Location: Somewhere over the rainbow

PostPosted: Fri Dec 12, 2008 8:35 pm    Post subject: Reply with quote

dnsi0 wrote:
Use SuspendThread to suspend all threads.
Use GetTHreadContext To Retrieve the context from a thread.
Modify the debug registers (DR0-DR3) to the address of violation.
Set DR7 to to on access.
Replace the context into the thread using SetThreadContext.

Watch for the access command when the command runs through.
Set the zf flag to 1.
Resume the thread that has accessed.

I got the first parts but I can't really get a listener for detecting access. How you do that has something to do with DR6... But Idk...

thanks man u helped me a lot Very Happy
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