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 


WriteProcessMemory - using pointers - value changing ?

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

Joined: 29 Nov 2006
Posts: 449
Location: The yogurt country

PostPosted: Sun Nov 18, 2007 6:01 am    Post subject: WriteProcessMemory - using pointers - value changing ? Reply with quote

I've started making a simple trainer. But i don't know why exactly when i use pointer (i am not sure if it is) but it does not work.







I don't get compiling errors but whenever i press the button to inject the value it just does not change to 1000 (in step two CE tutorial) it does nothing Sad













But if i don't use pointer method and directly change the addres it just works fine...




So how to use pointers with writeprocessmemory in "the right way" ? Rolling Eyes

_________________

Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Nov 18, 2007 6:05 am    Post subject: Reply with quote

first do a readprocessmemory on 459138
and add the value 320 to it
then write the address you get as result with the value you like

_________________
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
h4c0r-BG
Master Cheater
Reputation: 0

Joined: 29 Nov 2006
Posts: 449
Location: The yogurt country

PostPosted: Sun Nov 18, 2007 6:11 am    Post subject: Reply with quote

Can you give me an example if I use this code:

Code:
Function GetAddyfrmpointer(baseaddress:dword;offset:dword):dword;
var a: dword;
    x: dword;
    i: integer;
    offsetcount: integer;
    offsets:array of dword;
    b:integer;
    maxid:integer;
begin
offsetcount:=1;
b:=0;
setlength(offsets,1);
offsets[b]:=offset;
  a:=baseaddress;
  i:=0;
  while (i<offsetcount) do
  begin
    if not readprocessmemory(processhandle,pointer(a),@a,4,x) then exit;

    inc(a,offsets[i]);
   inc(i);
result:=a
  end;
end;


I mean where to use "a" in writeprocessmemory (i think i need "a" which will be $xxxxxx+320)
Or i am wrong ? Rolling Eyes

_________________

Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Nov 18, 2007 9:53 am    Post subject: Reply with quote

Read the value of 00459138 into a buffer then + the offset to it. Then write your value to the address stored in the buffer.
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Nov 18, 2007 1:57 pm    Post subject: Reply with quote

if you use GetAddyfrmpointer then you call it like:

writeprocessmemory(processhandle,pointer(GetAddyfrmpointer($459138,$320)),@value,4,write);
of course, GetAddyfrmpointer only supports level1 pointers, so level2 you have to do manually

also, look at the add address window, it explains how it works:
459138 contains the value d62450
d62450+320=d62770

_________________
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
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Mon Nov 19, 2007 12:56 am    Post subject: Reply with quote

Technically, GetAddyfrmpointer can support as many level pointers as it likes, by simply being called again.

Code:
for i:=0 to length(offsets)-1 do
  address:=GetAddyfrmpointer(address,offsets[i]);

Smile

EDIT:
I guess I should add that GetAddyfrmpointer can be trimmed down to:
Code:
Function GetAddyfrmpointer(baseaddress:dword;offset:dword):dword;
var a: dword;
begin
  result:=0;
  if readprocessmemory(processhandle,pointer(baseaddress),@a,4,nil) then
    result:=a
end;
And if you can pass @result as a param instead of making a variable(not sure if Delphi will allow it), then there's another two lines down and some memory. I'd suggest using an if statement for the return of 0.
_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
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