Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Perfect World
You last visited: Today at 07:34

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Memory Chain read in Delphi only ?

Discussion on Memory Chain read in Delphi only ? within the Perfect World forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2013
Posts: 17
Received Thanks: 3
Memory Chain read in Delphi only ?

Excuse the maybe nubish question
but can i ReadProcessMemory with Delphi on chains only or can i also read Pointer's ?

Im using for learning Bot coding the Prophet Bot autoit source.
The coder here set up a pointer struct first:
Quote:
Global $OFFSET_PLAYERBASE[4], $CFG_OFFSET_PLAYERBASE = "PlayerBase_OffSet", $CFG_OFFSET_PLAYERSTRUCT1 = "PLAYERSTRUCT1_OffSet", $CFG_OFFSET_PLAYERSTRUCT2 = "PLAYERSTRUCT2_OffSet"
$OFFSET_PLAYERBASE[1] = IniRead($SOFTWARE_OFFSET_CONFIG, $CFG_OFFSET_ROOT_KEY, $CFG_OFFSET_PLAYERSTRUCT1, "28")
$OFFSET_PLAYERBASE[2] = IniRead($SOFTWARE_OFFSET_CONFIG, $CFG_OFFSET_ROOT_KEY, $CFG_OFFSET_PLAYERSTRUCT2, "32")
$OFFSET_PLAYERBASE[3] = IniRead($SOFTWARE_OFFSET_CONFIG, $CFG_OFFSET_ROOT_KEY, $CFG_OFFSET_PLAYERBASE, "136")
and read out the Playerbase with a single pointer read:
Quote:
Global $PLAYER_DATA_BASE = _MemoryPointerRead($APP_BASE_ADDRESS, $PROCESS_INFORMATION, $OFFSET_PLAYERBASE)
In Delphi i use this ReadProcessMemory chain to get the Playerbase:
Quote:
// player database
ReadProcessMemory(GameHandle, ptr(BaseAdress), @eax, 4, Wert); //BASE
ReadProcessMemory(GameHandle, ptr(eax + 28), @eax, 4, Wert);
ReadProcessMemory(GameHandle, ptr(eax + 32), @eax, 4, Wert);
ReadProcessMemory(GameHandle, ptr(eax + 136), @PLBASE, 4, Wert); //Pointer global People Base
So four lines of Code in Delphi and one Line of Code in a poorer programming Language

Anybody can enlight me please
Afro-Head is offline  
Old 04/03/2013, 23:29   #2
 
Interest07's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 575
It's because you call a function in the 'poorer' language that does exactly that, read a chain of pointers.
Interest07 is offline  
Thanks
1 User
Old 04/04/2013, 09:19   #3
 
Sᴡoosh's Avatar
 
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 325
I somehow forgot to answer this, thanks interest for bumping...

This pointer chain reading stuff isn't what you want if you like speed. I did this at first also, until a wise old crazy man enlightend me. You want to read structwise, each time reading n bytes, n being the value of your highest offset. This way you can actually read, for example, complete character struct in 4 lines of code. After that, you'd simply reference offsets locally in your struct.

TL;DR : Chains suck for performance, use structs. If you really want, write a chain method that supports writing to struct at final offset.
Sᴡoosh is offline  
Thanks
1 User
Old 04/04/2013, 11:48   #4
 
Interest07's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 862
Received Thanks: 575
Quote:
Originally Posted by Sᴡoosh View Post
I somehow forgot to answer this, thanks interest for bumping...

This pointer chain reading stuff isn't what you want if you like speed. I did this at first also, until a wise old crazy man enlightend me. You want to read structwise, each time reading n bytes, n being the value of your highest offset. This way you can actually read, for example, complete character struct in 4 lines of code. After that, you'd simply reference offsets locally in your struct.

TL;DR : Chains suck for performance, use structs. If you really want, write a chain method that supports writing to struct at final offset.
Indeed, or in the very least when reading a lot of values from for example the player struct, only read in the player pointer once. Then read all the offsets from that pointer, instead of going through the entire chain every single time.
Interest07 is offline  
Thanks
1 User
Old 04/06/2013, 01:32   #5
 
elite*gold: 0
Join Date: Mar 2013
Posts: 17
Received Thanks: 3
Thank you two for the helpfull answers
I use now some functions to ChainReadInt, ChainReadInt32, ChainReadString...ChainWriteInt etc.

Like this one:
Code:
function ChainReadString(addr: DWORD; MaxCharCount: integer): string;
var
  BytesCountOfRead, Size: NativeUInt;
  sValue: array [0..255] of WideChar;
begin
  result := '';
  if (MaxCharCount > 0) and (addr+4 < $FFFFFFFF) then
  try
    Size := SizeOf(sValue);
    if Size > (MaxCharCount * 2) then
     Size := MaxCharCount * 2;
    ZeroMemory(@sValue[0], SizeOf(sValue));
    ReadProcessMemory(hProcess, ptr(addr), @sValue[0], Size, BytesCountOfRead);
    Result := Copy(WideCharToString(sValue), 1, MaxCharCount);
  except
    result := '';
  end;
end;
Works fine and the light shines bright
Afro-Head is offline  
Old 05/13/2013, 21:12   #6
 
elite*gold: 0
Join Date: Apr 2013
Posts: 6
Received Thanks: 5
Have a look on my source code , it's may be help you. To be more Specific on TPlayer (CPlayer.pas) class procedure.
Alikarbam is offline  
Reply


Similar Threads Similar Threads
read the names of the characters in delphi
05/10/2012 - PW Hacks, Bots, Cheats, Exploits - 11 Replies
function ReadPlayerName (hProcess, data: DWord): string; var i, rw: DWord; ch: WideChar; wch: array of WideChar; str: string; begin i:= 0; repeat ReadProcessMemory (hProcess, ptr (data),@ch,2,rw);
[VB]Write Memory bzw Read Memory
06/26/2010 - .NET Languages - 8 Replies
Hi Ich hab das TuT von *Guidman* benütz um einen hack zu machen. So aber nun hab ihc ein paar fragen könnte man memory teil kürzer machen und am besten wie kann man das selber machen weil ich will nihct immer C&P machen. Und zu Read Memory kann man das auch machen das ein Label immer die Bestimmte Ahnzahl angiebt von dem Pointer?.(Wenn das Read Memory ist ?) Bitte helf mir Danke
Memory Read
06/18/2010 - AutoIt - 0 Replies
wtf?? pls delete
View memory address values in delphi or c#
08/14/2007 - Conquer Online 2 - 2 Replies
Hello, does anyone know where i can find a good tutorial to print the value of a memory address with dephi code or c# code, if not maybe someone who knows how to do this could explain to me much appreciated.



All times are GMT +2. The time now is 07:34.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.