 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Stok3r Guest
|
Posted: Tue Dec 04, 2012 7:48 am Post subject: Problem with WriteProcessMemory |
|
|
Hi, I have a problem to create a trainer, this is the code:
| Code: | Var WindowName : integer;
ProcessId : integer;
ThreadId : integer;
buf : PChar;
HandleWindow : Integer;
write : cardinal;
Const WindowTitle = 'Spider Solitaire';
Address = $0011DAC4;
PokeValue = $1F4; //500
NumberOfBytes = 4;
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; |
I tried when spider solitaire, but the problem is that I can only put 255 in pokevalue, if I overcome the 255 starts to go backwards, I put NumberOfByte = 4, but the maximum is always 255, why? Thank you all.
Sorry for my bad English.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Dec 04, 2012 9:45 am Post subject: |
|
|
Your buffer type is PChar, use a type that can hold more data.
_________________
- Retired. |
|
| Back to top |
|
 |
Stok3r Guest
|
Posted: Wed Dec 05, 2012 8:06 am Post subject: |
|
|
| Wiccaan wrote: | | Your buffer type is PChar, use a type that can hold more data. |
I solved when using this code:
| Code: | var
value:dword
{...}
value:=100;
WriteProcessMemory(HandleWindow,ptr(Address),@value,NumberOfBytes,write); |
I have another problem, I found the pointer, but now how do I read the pointer address? Thanks!
|
|
| Back to top |
|
 |
Stok3r Guest
|
Posted: Thu Dec 06, 2012 6:42 pm Post subject: |
|
|
| up
|
|
| Back to top |
|
 |
Screitor Cheater
Reputation: 1
Joined: 26 Nov 2012 Posts: 33 Location: Venezuela
|
Posted: Thu Dec 06, 2012 7:14 pm Post subject: |
|
|
| Stok3r wrote: | | I have another problem, I found the pointer, but now how do I read the pointer address? Thanks! |
C'mon...
ReadProcessMemory.
_________________
Everybody lies. |
|
| Back to top |
|
 |
|
|
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
|
|