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] Trainer Creation...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Sun May 24, 2009 3:26 pm    Post subject: [Delphi] Trainer Creation... Reply with quote

Hello,

I'm trying to code a trainer in Delphi, I've found a Tutorial (in German) but I stuck at the point to freezing the Address (static).
My Address is 0069bc34 with Offset 84C do I have to add the Address with the Offset (=69C480)?!

Thats my part of the Code to freeze the address:

Code:
WriteProcessMemory(HandleWindow,ptr($69C480),buf,3,write);


I don't know what I should do with this code Evil or Very Mad I'm very new to Delphi and have no idea...

Here's my the hole Source Code:

Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  WindowName  :  integer;
  ProcessId  :  integer;
  ThreadId  :  integer;
  buf  :  PChar;
  HandleWindow  :  Integer;
  write  :  cardinal;

  Const  WindowTitle  =  'MANHUNT';

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
const v1 = $90;
begin
 WindowName  :=  FindWindow(nil,WindowTitle);
          If  WindowName  =  0  then MessageDlg('...erst spiel starten...dann trainer starten =)',  mtwarning,[mbOK],0);
    ThreadId  :=  GetWindowThreadProcessId(WindowName,@ProcessId);
    HandleWindow  :=  OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
    GetMem(buf,1);
    buf^  :=  Chr(v1);
    WriteProcessMemory(HandleWindow,ptr($69C480),buf,3,write);
    FreeMem(buf);
    closehandle(HandleWindow);
end;

end.


I hope anybody can help me Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 473

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

PostPosted: Sun May 24, 2009 4:55 pm    Post subject: Reply with quote

First you have to Read(processmemory) the address at 0069bc34 as a 4 byte value
Then add the offset to that value (+84C)
Then typecast that value to a pointer and write(processmemory) the value you want to that pointer

Also, 3 isn't 1

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Mon May 25, 2009 1:24 am    Post subject: Reply with quote

Can you give me a Code example, please?
As I said: I'm very new to Delphi Embarassed Smile
Back to top
View user's profile Send private message
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Mon May 25, 2009 4:42 am    Post subject: Re: [Delphi] Trainer Creation... Reply with quote

As said by the previous person, the following is a contradiction.
psYchomantis wrote:
the Address (static).

psYchomantis wrote:
Address is 0069bc34 with Offset 84C
The actual information you've given us suggests a dynamic address.
I'm not familiar with Delphi so I'll just list what you need to do in order:
1. Value of pointer: ReadProcessMemory at 0069bc34 (4 bytes on 32 bit machine).
2. Address of what you want: Add 84C to this value.
3. Value of what you want: ReadProcessMemory again on this new value.
4. Refresh Value: Now WriteProcessMemory of the value of what you want to the address of what you want.

Now, after you've done this once, if the address changes frequently (the address, not the value), you have to do the following steps in a loop to 'freeze' the value: 1, 2, 4.
If it only changes once, i.e. on startup, then you only need to loop step 4.
Back to top
View user's profile Send private message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Mon May 25, 2009 7:34 am    Post subject: Reply with quote

I don't know what you mean Evil or Very Mad
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Mon May 25, 2009 8:34 am    Post subject: Reply with quote

first read the address (save the value)
than write on value + offset

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Mon May 25, 2009 8:43 am    Post subject: Reply with quote

Ok, but can anybody give me a Code Example Embarassed
I don't know how to make a Code with this function...
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Mon May 25, 2009 11:45 am    Post subject: Reply with quote

quick sketch. do the rest yourself

read(handle,0069bc34,out)
out += 84C

then write it from there

_________________
Back to top
View user's profile Send private message AIM Address
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Mon May 25, 2009 12:25 pm    Post subject: Reply with quote

Very good Rolling Eyes I have to code something when I don't know the language Evil or Very Mad I said I'm new to Delphi and I've never worked with ReadProcessMemory or WriteProcessMemory.
I searched in Google since yesterday evening, that didn't helped me. I've found 1 Tutorial where everybody says "Thanks It works fine for me" and in this code (see 1. Post) is nothing to see from ReadProcessMemory they only use WriteProcessMemory.
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Mon May 25, 2009 3:03 pm    Post subject: Reply with quote

then don't start with a trainer. learn your basics first.
_________________
Back to top
View user's profile Send private message AIM Address
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon May 25, 2009 4:17 pm    Post subject: Reply with quote

Here's C++ version, go and convert it.
Code:
#define BASE_ADDRESS   0x0069bc34
#define OFFSET      0x84C
#define FREEZE_VALUE   0x01

BYTE   NewValue[] = {FREEZE_VALUE};
DWORD   dwBuffer = 0;

ReadProcessMemory(hProcess, BASE_ADDRESS, dwBuffer, sizeof(dwBuffer), 0);
ReadProcessMemory(hProcess, (dwBuffer + OFFSET), dwBuffer, sizeof(dwBuffer), 0);
while(ReadProcessMemory(hProcess, (dwBuffer + OFFSET), dwBuffer, sizeof(dwBuffer), 0))
   if(dwBuffer != FREEZE_VALUE)
      WriteProcessMemory(hProcess, (dwBuffer + OFFSET), NewValue, sizeof(NewValue), 0);
Back to top
View user's profile Send private message Visit poster's website
Pot.Smoking.Terrorist
Expert Cheater
Reputation: 0

Joined: 15 Jun 2008
Posts: 175
Location: Germany

PostPosted: Mon May 25, 2009 4:34 pm    Post subject: Reply with quote

Very good... but: I can neighter Delphi nor C++ Confused
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon May 25, 2009 4:53 pm    Post subject: Reply with quote

psYchomantis wrote:
Very good... but: I can neighter Delphi nor C++ Confused


Your biting off more than you can chew. Try learning a programing language first. Start with those lame hello worlds. After you have a foundation then try coding trainers.
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Mon May 25, 2009 10:31 pm    Post subject: Reply with quote

god damn it, saying that you don't know what to do isn't going to get you anywhere. learn something else first.

ex:
BASICS.

_________________
Back to top
View user's profile Send private message AIM Address
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Tue May 26, 2009 9:49 am    Post subject: Reply with quote

Try reading the following links in order.
Code:
http://www.delphibasics.co.uk/Article.asp?Name=FirstPgm
http://www.delphibasics.co.uk/RTL.asp?Name=While
http://www.delphipages.com/threads/thread.cfm?ID=185732&G=185722
http://www.elitepvpers.de/forum/co2-programming/181201-help-delphi-readprocessmemory.html
That will cover how to make an app with a button, how to do a loop, how to find a PID and how to use an API.
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