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 Memory Editing Help

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

Joined: 03 Mar 2008
Posts: 117

PostPosted: Fri Aug 15, 2008 6:59 pm    Post subject: Delphi Memory Editing Help Reply with quote

Can't find anything to read to start from scratch on my own, so I'm asking if someone could write the code in delphi so I could break it down and understand where everything goes etc etc.

Game : 3D Pinball for windows
Score Address: 00AA0C62


Change it to whatever number, I dont really care, I just wanna see how it would be written. If you can link me to a 30 page guide instead, I'd be happier.

**If you can put some comments in explaining a few lines explaining whats going on there I'd appreciate that even more**

+rep to anyone who helps me.
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Fri Aug 15, 2008 7:02 pm    Post subject: Reply with quote

Code:


############################################################
############################################################
####                                                    ####
####            Trainer +1 For MTC's Prog Test          ####
####            Source Code  (Delphi 4)                 ####
####            Copyright 1999 By CheatMagic            ####
####                                                    ####
############################################################
############################################################


Var WindowName : integer;
    ProcessId : integer;
    ThreadId : integer;
    buf : PChar;
    HandleWindow : Integer;
    write : cardinal;
   
Const WindowTitle = '3D Pinball for windows';
      Address = $00AA0C62;
      PokeValue = $FF;
      NumberOfBytes = 1;
 


###########################################################
# (Put the following code inside a command button routine)#
###########################################################


begin
  WindowName := FindWindow(nil,WindowTitle);
  If WindowName = 0 then
  begin
    MessageDlg('The game must be running in the background.
      Run it now, and then try again.', mtwarning,[mbOK],0);
  end;

  ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);

  GetMem(buf,1);
  buf^ := Chr(PokeValue);
  WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
  FreeMem(buf);
  closehandle(HandleWindow);
end;




if it doesn't work sorry i know no delphi at all.. but it should work idk.


above example should give you a score of 255

this example should give u a score with DWORD I think it would be 65,500 score something like that


Code:

Const WindowTitle = '3D Pinball for windows';    <-game caption (how it finds it like CE)
      Address = $00AA0C62;                              <-address
      PokeValue = $0000FFFF;                            <- value
      NumberOfBytes = 4;                     <-number bytes to write


1 byte = 255 max value
2 bytes is like 65,000 (255 times 255) (255^2)
3 bytes would be around 16 million (255 times 255 times 255) (255^3)
4 bytes would be around 4 billion and half of that is like 2,417,000,000 (255 times 255 times 255 times 255) or 255 to 4th power (255^4)

if you want to know how to convert numbers to hex.. just use google.

see PokeValue is 0000FFFF

add a 0x in front and type to decimal
0x0000FFFF to decimal

in google u get

0x0000FFFF = 65 535
More about calculator.

now if you want to find out how to make numbers into hex.. just do opposite

take a number like
12345

type in google
12345 to hex

12 345 = 0x3039
More about calculator.

now in program replace
PokeValue = $0000FFFF;
with
PokeValue = $00003039;
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 Aug 15, 2008 8:01 pm    Post subject: Reply with quote

pkedpker wrote:
Code:


############################################################
############################################################
####                                                    ####
####            Trainer +1 For MTC's Prog Test          ####
####            Source Code  (Delphi 4)                 ####
####            Copyright 1999 By CheatMagic            ####
####                                                    ####
############################################################
############################################################


Var WindowName : integer;
    ProcessId : integer;
    ThreadId : integer;
    buf : PChar;
    HandleWindow : Integer;
    write : cardinal;
   
Const WindowTitle = '3D Pinball for windows';
      Address = $00AA0C62;
      PokeValue = $FF;
      NumberOfBytes = 1;
 


###########################################################
# (Put the following code inside a command button routine)#
###########################################################


begin
  WindowName := FindWindow(nil,WindowTitle);
  If WindowName = 0 then
  begin
    MessageDlg('The game must be running in the background.
      Run it now, and then try again.', mtwarning,[mbOK],0);
  end;

  ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);

  GetMem(buf,1);
  buf^ := Chr(PokeValue);
  WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
  FreeMem(buf);
  closehandle(HandleWindow);
end;




if it doesn't work sorry i know no delphi at all.. but it should work idk.


above example should give you a score of 255

this example should give u a score with DWORD I think it would be 65,500 score something like that


Code:

Const WindowTitle = '3D Pinball for windows';    <-game caption (how it finds it like CE)
      Address = $00AA0C62;                              <-address
      PokeValue = $0000FFFF;                            <- value
      NumberOfBytes = 4;                     <-number bytes to write


1 byte = 255 max value
2 bytes is like 65,000 (255 times 255) (255^2)
3 bytes would be around 16 million (255 times 255 times 255) (255^3)
4 bytes would be around 4 billion and half of that is like 2,417,000,000 (255 times 255 times 255 times 255) or 255 to 4th power (255^4)

if you want to know how to convert numbers to hex.. just use google.

see PokeValue is 0000FFFF

add a 0x in front and type to decimal
0x0000FFFF to decimal

in google u get

0x0000FFFF = 65 535
More about calculator.

now if you want to find out how to make numbers into hex.. just do opposite

take a number like
12345

type in google
12345 to hex

12 345 = 0x3039
More about calculator.

now in program replace
PokeValue = $0000FFFF;
with
PokeValue = $00003039;


Google? lol. use calculator.
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Fri Aug 15, 2008 8:42 pm    Post subject: Reply with quote

yah thats true but google is faster for ppl with good internets like me Shocked
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sat Aug 16, 2008 5:37 am    Post subject: Reply with quote

Well.. but google cant go higher than
4 398 046 511 104 = 0x40000000000
Wink
Back to top
View user's profile Send private message
Kalookakoo
Expert Cheater
Reputation: 0

Joined: 03 Mar 2008
Posts: 117

PostPosted: Sat Aug 16, 2008 9:04 am    Post subject: Reply with quote

[quote="pkedpker"]
Code:


############################################################
############################################################
####                                                    ####
####            Trainer +1 For MTC's Prog Test          ####
####            Source Code  (Delphi 4)                 ####
####            Copyright 1999 By CheatMagic            ####
####                                                    ####
############################################################
############################################################


Var WindowName : integer;
    ProcessId : integer;
    ThreadId : integer;
    buf : PChar;
    HandleWindow : Integer;
    write : cardinal;
   
Const WindowTitle = '3D Pinball for windows';
      Address = $00AA0C62;
      PokeValue = $FF;
      NumberOfBytes = 1;
 


###########################################################
# (Put the following code inside a command button routine)#
###########################################################


begin
  WindowName := FindWindow(nil,WindowTitle);
  If WindowName = 0 then
  begin
    MessageDlg('The game must be running in the background.
      Run it now, and then try again.', mtwarning,[mbOK],0);
  end;

  ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);

  GetMem(buf,1);
  buf^ := Chr(PokeValue);
  WriteProcessMemory(HandleWindow,ptr(Address),buf,NumberOfBytes,write);
  FreeMem(buf);
  closehandle(HandleWindow);
end;


quote]


Not working, but I may not be replacing all I need to replace. Which words do I replace? I think I'm overlooking a few.
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Sat Aug 16, 2008 9:31 am    Post subject: Reply with quote

C++ Code:
Code:

#include <windows.h>

BOOL APIENTRY DllMain(HMODULE hModule, DWORD call, LPVOID lpReserved)
{
   if(call == DLL_PROCESS_ATTACH) {
      *(DWORD*)0x00AA0C62 = 9999999;
   }
   return TRUE;
}


Compile as a DLL and inject into the process.

Edit: Aww sorry you want delphi... Can't help.

_________________
Gone
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Sat Aug 16, 2008 2:04 pm    Post subject: Reply with quote

yah screw delphi learn C++ its much easier for memory trainer making etc

anyways you only replace the BOLD words

Code:

Const WindowTitle = '[b]3D Pinball for windows[b/]';
      Address = $[b]00AA0C62[/b];
      PokeValue = $[b]FF[/b];
      NumberOfBytes = [b]1[/b];


plus did you do this?

###########################################################
# (Put the following code inside a command button routine)#
###########################################################


you have to put the code below those ##########'s into a command button anything that clicks in your delphi program.

Maybe the address changed?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Aug 16, 2008 6:11 pm    Post subject: Reply with quote

GMZorita wrote:
C++ Code:
Code:

#include <windows.h>

BOOL APIENTRY DllMain(HMODULE hModule, DWORD call, LPVOID lpReserved)
{
   if(call == DLL_PROCESS_ATTACH) {
      *(DWORD*)0x00AA0C62 = 9999999;
   }
   return TRUE;
}


Compile as a DLL and inject into the process.

Edit: Aww sorry you want delphi... Can't help.


I'll port it to delphi:
Compile this as a dll
Code:

library Mydll;

begin
  PLongWord($00AA0C62)^:=9999999;
end.

Yeah, this is so much more difficult than in C

_________________
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
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Aug 16, 2008 6:23 pm    Post subject: Re: Delphi Memory Editing Help Reply with quote

Kalookakoo wrote:
Can't find anything to read to start from scratch on my own, so I'm asking if someone could write the code in delphi so I could break it down and understand where everything goes etc etc.

Game : 3D Pinball for windows
Score Address: 00AA0C62


Change it to whatever number, I dont really care, I just wanna see how it would be written. If you can link me to a 30 page guide instead, I'd be happier.

**If you can put some comments in explaining a few lines explaining whats going on there I'd appreciate that even more**

+rep to anyone who helps me.


Pinball uses pointers, just fyi. Make sure you find and get your address from it beforehand, or you'll likely find that address not working.
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Sat Aug 16, 2008 6:30 pm    Post subject: Reply with quote

Dark Byte wrote:
GMZorita wrote:
C++ Code:
Code:

#include <windows.h>

BOOL APIENTRY DllMain(HMODULE hModule, DWORD call, LPVOID lpReserved)
{
   if(call == DLL_PROCESS_ATTACH) {
      *(DWORD*)0x00AA0C62 = 9999999;
   }
   return TRUE;
}


Compile as a DLL and inject into the process.

Edit: Aww sorry you want delphi... Can't help.


I'll port it to delphi:
Compile this as a dll
Code:

library Mydll;

begin
  PLongWord($00AA0C62)^:=9999999;
end.

Yeah, this is so much more difficult than in C

I never write that C++ was better or easier then Delphi.

_________________
Gone
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