YellowEye How do I cheat?
Reputation: 0
Joined: 18 Dec 2008 Posts: 5
|
Posted: Mon Feb 09, 2009 9:29 am Post subject: [Help] [Delphi] Writeprocessmemory |
|
|
| 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.
|
|