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 - write pointer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
e!ns7e!n
Cheater
Reputation: 0

Joined: 06 Sep 2007
Posts: 30

PostPosted: Mon Jan 26, 2009 8:07 am    Post subject: Delphi - write pointer Reply with quote

how to write some value in pointer adress with this functions:

Code:
function WriteByteString(offset : Cardinal; value : String) : Cardinal;
var
   byteArray     : TByteArray;
begin
    if GetID(process,Pid) then
      begin
          Pidhandle:= OpenProcess(PROCESS_ALL_ACCESS, false, pId);
          ByteStringToByteArray(value, byteArray);
          WriteProcessMemory(Pidhandle, Pointer(offset), byteArray, length(byteArray), bytesWritten);
          CloseHandle(Pidhandle);
     end;
     result:= bytesWritten;
end;


if address is static - like that :
Code:
WriteByteString($00223344, '62 5C 6F 6F');


but if address is pointer like :



pointer address.PNG
 Description:
pointer
 Filesize:  1.78 KB
 Viewed:  6670 Time(s)

pointer address.PNG


Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Jan 26, 2009 5:45 pm    Post subject: Reply with quote

getmodulehandle+offset
or for function:
getprocaddress+offset.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Mon Jan 26, 2009 7:51 pm    Post subject: Reply with quote

in case of my.dll+304c offsetcount=1 offset[0]: 44 :

getmodulehandle for my.dll
add 304c to that base address
read the 4 byte value stored at that location

add 44 to that value and then reador write the address that the new value represents

_________________
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
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Jan 26, 2009 7:54 pm    Post subject: Reply with quote

Dark Byte wrote:
in case of my.dll+304c offsetcount=1 offset[0]: 44 :

getmodulehandle for my.dll
add 304c to that base address
read the 4 byte value stored at that location

add 44 to that value and then reador write the address that the new value represents


isn't this what I just said O.o...
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Jan 26, 2009 8:06 pm    Post subject: Reply with quote

no you showed you don't know what a pointer is
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Mon Jan 26, 2009 8:28 pm    Post subject: Reply with quote

whoops didn't see the part about the pointer X.X...
Back to top
View user's profile Send private message
e!ns7e!n
Cheater
Reputation: 0

Joined: 06 Sep 2007
Posts: 30

PostPosted: Tue Jan 27, 2009 7:32 am    Post subject: Reply with quote

Dark Byte wrote:
in case of my.dll+304c offsetcount=1 offset[0]: 44 :

getmodulehandle for my.dll
add 304c to that base address
read the 4 byte value stored at that location

add 44 to that value and then reador write the address that the new value represents


ok i try but i'm not sure that i'm right...

Code:
procedure TfrmMain.btnPatchClick(Sender: TObject);
var
  dwModuleHandle : dword;
  address7       : pbyte;
  buffer2        : dword;
begin
    if GetID(process,Pid) then
      begin
        Pidhandle := OpenProcess(PROCESS_ALL_ACCESS, false, dwModuleHandle);
        dwModuleHandle := GetModuleHandle('my.dll'); //getmodulehandle for my.dll
        address7  :=  PBYTE(dwModuleHandle + $304c); //add 304c to that base address

        //read
        ReadProcessMemory(Pidhandle,Pointer(address7), @buffer2 ,4,bytesWritten);  //read the 4 byte value stored at that location
        address7 := PBYTE(address7 + $44);  //here is error!

        //write
        WriteProcessMemory(Pidhandle,Pointer(address7), @buffer2 ,4,bytesWritten); 
      end;

end;

i'm not sure about the code and i've an error:
Quote:
Operator not applicable to this operand type


p.p.

oops i saw my error

Code:
 buffer2 := buffer2 + 44;
must be

but i have other questin because the pointer doesn't work....

the adress wich i want to hack isn't static and i scan for a pointer.

yesterday the address was 12345678 now he is 33345678 and the pointer is empty Shocked

what i have to do ?

whre is my mistake ?????
Back to top
View user's profile Send private message
robedino
Cheater
Reputation: 0

Joined: 03 Sep 2008
Posts: 48

PostPosted: Wed Jan 28, 2009 12:33 pm    Post subject: Reply with quote

maybe it's a multi-level pointer?
Dunno, I'm not very in to hacking withg Delphi, I want to learn it tho...
Back to top
View user's profile Send private message
e!ns7e!n
Cheater
Reputation: 0

Joined: 06 Sep 2007
Posts: 30

PostPosted: Fri Jan 30, 2009 6:07 am    Post subject: Reply with quote

i find the problem - code-shifting... but i really don't know how to change value of the address if i can't find the address :[

can somebody give me a code in delphi with wich i can find address or pointer wich work ? confuseddd Sad
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