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 


[Delphi] Hooking to a process and WPM!!!! [TuT]

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

Joined: 19 Nov 2007
Posts: 255

PostPosted: Wed Dec 17, 2008 7:56 pm    Post subject: [Delphi] Hooking to a process and WPM!!!! [TuT] Reply with quote

Both parts credited to ~Spencer~ at FPSKillerz please report questions to the posts there or to his MSN.

He says in the post he wants a referel link : http://www.fpskillerz.net/delphi-f23/tut-hooking-to-a-process-in-delphi-7-p1-t139.htm
and
http://www.fpskillerz.net/delphi-f23/tut-writing-process-memory-game-hacks-p2-t133.htm

Part 1

I got how to do this from looking at a source code from an old trainer.

Things needed:
Delphi 7
Common Knowledge of Delphi 7

1. Open Delphi 7

2. Create a new project or open a current one

3. Create a new form and name it plist

4. Rename the form to
Quote:
Process List


5. Now change the ClientHeight to 510 and the ClientWidth 284

6. In the Toolbox click the Standard Controls tab, and click ListBox, then drag it accross all of the form. Keep the name ListBox1

7. Okay now we need to make the process's load by using GPL (GetProcessList)
We will make it load on when this form opens. So put this in your code
Code:
procedure Tplist.FormShow(Sender: TObject);
begin

end;


8. Everything in there happens when the form loads. So now we need to put GPL in there.

procedure Tplist.FormShow(Sender: TObject);
begin
GetProcessList(listbox1,NULL);
end;

9. You only have to worry about the colored words. The red is GPL, and the Orange is where the process's load, now Save and Run your project and you will see the process's but you can do anything to them.

10. We now need to make it so when you double click a process your project attaches to it. You do this by using the DblClick function instead of Click. Double click on ListBox1 and you will see this code
Code:
procedure Tplist.ListBox1Click(Sender: TObject);
begin

end;


10. That code is for a single click though, you need to change the Tplist.ListBox1Click to Tplist.ListBox1DblClick. So it will look like this
Code:
procedure Tplist.ListBox1DblClick(Sender: TObject);
begin

end;


11. We now need to change this code so that it hooks to the process.
Code:
procedure Tplist.ListBox1DblClick(Sender: TObject);
var i:integer;
begin
  if listbox1.ItemIndex<>-1 then
  begin
    val('$'+listbox1.items[listbox1.ItemIndex],processid,i);
    Open_Process;
    close;
end;
end;


This code is what hooks to the process, its hard to explain but what it does is it hooks to the Process you double clicked in listbox1 and it gets the Process ID and puts it in your form caption.

12. Now on your first form (Form1 most likely) make a button on make the caption "Select Process" and then make the code do this
Code:
plist.showmodal;

That code shows the plist form.

Now try running your program and selection a process, it should work, but if it doesnt let me know.

Part 2

All credits go to me.

Please do not leech unless you link back to this topic and you give the credits to ~Spencer~

Things needed:
-Delphi 7
-Cheat Engine 5.x
-Common Delphi knowledge

Okay so for this tutorial I'm going to use the address 00400000.

To get this address i have made a simple script that does nothing, but it uses this address

Code:
[enable]
00400000:
fld st(5)
[disable]


Since the address is 00400000, thats what i would be using in this tutorial.

1. Open up Delphi 7

2. Create a Checkbox

3. Name it
Quote:
hacks


4. Double click it so you go to the code

5. We now need to declare some integers, click right before the word "begin" and hit Enter.

6. That will break the line, now on the empty line we need to declare "Activate" and "UnActivate" to do this you must put this code in on the empty line
Code:
var
Activate,UnActivate:integer;


That code shows that it is a variable (var) and that Activate and UnActivate are integers.

7. Now in the normal code spot (Under 'begin') we need to assign those values.
Since im using the address 00400000 I would add this to my CT on Cheat Engine.


See how in the picture the value is 200?

The value 200 is when the script is disabled for that address so that would be the value for UnActivate.

8. Now right under "begin" type this in
Code:
Activate:=;
UnActivate:=200;


9. Now you need to activate the script that edits that address while attached to your games process.
Since the script im using is
Code:
[enable]
00400000:
fld st(5)
[disable]


I would AA that to my CT on Cheat Engine.

10. Your CT should look SOMETHING like this :


11. Attach to the games process that you are hacking with CE

12. Enable your script

13. The value of your address SHOULD change, not all scripts change the value, which doesnt make sense to me, but it SHOULD.


As you can see, the value of MY address changed from 200 to 50649.

14. The new value (50649) is the value for Activate in delphi.
So your code right now should be:
Code:
procedure TForm1.hacksClick(Sender: TObject);
var
Activate,UnActivate:integer;
begin
Activate:=50649;
UnActivate:=200;


15. Now we need to make it so the hacks enable when you tick the checkbox, and disable when you untick it.
the code for this would be:
Code:
if hacks.checked = true then


Put that 2 lines under UnActivate

16. Now we actualy are writing the memory, we are going to use WPM (Write Process Memory) as the title says.
to do this, put this code under what step 15 did

writeprocessmemory(processhandle,pointer($00400000),@Activate,4,NULL)

The colored areas are the only areas you need to worry about.

17. The bright red area is what were doing to the address (WPM/RPM/Etc.)
The orange area is the address you've been using throughout this tutoiral (For me 00400000)
And the Dark Red area is where you would usually put the value but since we've used integers, we just put the name of the integer we want there (With an @ before it)

18. Replace the orange with your address.

19. For disable it is pretty much the same but instead of @Activate its @UnActivate.
Code:
else
writeprocessmemory(processhandle,pointer($00400000),@UnActivate,4,NULL);


You need to put the "else" before it because the first WPM says if it is ticked, and else, is if it isnt (Enabling/Disabling) For this, also put your address where mine is.

20. You are almost finished! Now you just need to end it with an
Code:
end;


21. Congratulations, now that you have your process attacher, and your hacks, you can make your first trainer!!!!!!

22. Your finished project should look LIKE this:
Code:
procedure TForm1.hacksClick(Sender: TObject);
var
Activate,UnActivate:integer;
begin
Activate:=50649;
UnActivate:=200;

if hacks.checked = true then
writeprocessmemory(processhandle,pointer($00400000),@Activate,4,NULL)
else
writeprocessmemory(processhandle,pointer($00400000),@UnActivate,4,NULL);
end;


If you need more elaboration, just let ~Spencer~ at FPSK knwo.

_________________


Go check it out. Good Hacks
Back to top
View user's profile Send private message AIM Address
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Wed Dec 17, 2008 8:19 pm    Post subject: Reply with quote

First of all, GetProcessList is not an API in windows..you'll have to define the function. See the definition at torry's page !

http://www.swissdelphicenter.ch/torry/showcode.php?id=616

(you'll have to use this differently than how he shows it..there is an example at the bottom)


Next, Open_Process is not an API. If you are going to be using these functions, please post the definitions in the thread or people will get compiler errors.


Finally, why are you setting the decimal value? Although it works..it's much easier to just show people how it is actually changing bytes..you can just do the same thing as you are doing, but make the values hexadecimal and include the $ symbol to make it hex.



Btw, don't bullshit. You are Spencer from FPSKillerz. Unless you are a freak who talks in 3rd person, don't put "He wants referral links" this is clearly advertising.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Dec 18, 2008 3:14 am    Post subject: Reply with quote

Quote:
18. Replace the orange with your address.

Instead of telling people what to do, couldn't you just explain what parameters WriteProcessMemory gets and they would know how to do it themselves?

Quote:
And the Dark Red area is where you would usually put the value but since we've used integers, we just put the name of the integer we want there (With an @ before it)

And why is that? explain.
WriteProcessMemory gets an array of bytes as a parameter, that's why you gotta use the '@' operator to get the address of the integer.

Quote:
21. Congratulations, now that you have your process attacher, and your hacks, you can make your first trainer!!!!!!

Umm, no...
Quote:
21. Congratulations, now that you have copy pasted these codes without understanding anything, you can make an exact copy of this trainer!!!!!!


Quote:
22. Your finished project should look LIKE this:

Noooo..... Rolling Eyes

By the way, it's Deactivate.
Back to top
View user's profile Send private message
torpin005
Master Cheater
Reputation: 0

Joined: 19 Nov 2007
Posts: 255

PostPosted: Thu Dec 18, 2008 11:24 am    Post subject: Reply with quote

Symbol it doesnt matter what the word is.
_________________


Go check it out. Good Hacks
Back to top
View user's profile Send private message AIM Address
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Thu Dec 18, 2008 11:27 am    Post subject: Reply with quote

torpin005 wrote:
Symbol it doesnt matter what the word is.


Sure but he's right with the rest.
This "Tutorial" is worse.
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Dec 18, 2008 12:44 pm    Post subject: Reply with quote

Symbol wrote:

Quote:
And the Dark Red area is where you would usually put the value but since we've used integers, we just put the name of the integer we want there (With an @ before it)

And why is that? explain.
WriteProcessMemory gets an array of bytes as a parameter, that's why you gotta use the '@' operator to get the address of the integer.



He doesn't know what the @ operator is. That's why he's not explaining it. He copied and pasted all his code, and has no idea what it does.
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