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] [Delphi] Writeprocessmemory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
YellowEye
How do I cheat?
Reputation: 0

Joined: 18 Dec 2008
Posts: 5

PostPosted: Mon Feb 09, 2009 9:29 am    Post subject: [Help] [Delphi] Writeprocessmemory Reply with quote

Quote:

unit a;

interface

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

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

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

Const WindowTitle = '3D Pinball for Windows - Space Cadet';
Address = $00A80C62;
PokeValue = $00003039;
NumberOfBytes = 4;

implementation

{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);
begin
//
end;

procedure TForm1.Button1Click(Sender: TObject);
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;


end.


OK, that's a very good example of writeprocessmemory which I found in this forum. It first searches for
Quote:
WindowTitle = '3D Pinball for Windows - Space Cadet';
That's good and it works for me, but can anyone tell me how to make it not to search for the windowtitle, but for the processname? [for example pinball.exe] ?
Please post source code if possible. Thanks for the help. Cool
Back to top
View user's profile Send private message
bartil
Advanced Cheater
Reputation: 0

Joined: 11 Jul 2006
Posts: 91

PostPosted: Mon Feb 09, 2009 10:13 am    Post subject: Reply with quote

Code:
CreateToolhelp32Snapshot
Process32First
Process32Next


The forum is filled up with examples Wink
Back to top
View user's profile Send private message MSN Messenger
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