[DELPHI] Dodanie pointerów.

0

Wszystko fajnie... Dodaje:
w głównym var:

const
EQ = $0021C022;

I chce aby nie odczytywał samego adresu np. $0021C022 tylko np. (pointeR) $warrock.exe+0021C022 + (offset) $2BC
Jak to zapisać? Bo w Const

function ReadMemInteger(Address: Cardinal): Cardinal; //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:integer;
begin
GetWindowThreadProcessId(FindWindow(Nil, 'WarRock'), @ProcId);
tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
ReadProcessMemory(tProc, Ptr(Address), @value, 4, NBR);
CloseHandle(tProc);
Result:=value;
end;

Pod timerem daje:

Edit3.Text:=inttostr(ReadMeminteger(EQ));

MYŚLĘ, ŻE KTOŚ ODPOWIE NA MOJE PYTANIE DAJE 5 i + za to!

0

Abstrahujac od tresci

GetWindowThreadProcessId(FindWindow(Nil, 'WarRock'), @ProcId);

tam chyba jest var param na koncu, zatem nie jest potrzebne @ProcId, wystarczy samo ProcId

function ReadMemInteger(const Address): Cardinal;       //Read adress:value

taka kosmetyka..tzn ja bym tak zrobil

A, jeszcze mozna sie zastanowic nad roznicami w typie cardinal a integer

value:Cardinal

lub po prostu

ReadProcessMemory(tProc, Pointer(Address), @Result, sizeof(Result), NBR);
0
I chce aby nie odczytywał samego adresu np. $0021C022 tylko np. (pointeR) $warrock.exe+0021C022 + (offset) $2BC
Jak to zapisać? Bo w Const

Nie odpowiedziałeś na moje pytanie.. Jak zrobić pod var
EQ = adres pointera (warrock.exe+$0021C022) + offset ($2BC)

0

Napisalem przeciez ze abstrahuje od tematu :) Jesli chcesz koniecznie obecny proces (twojej aplkacji) skorzystaj raczej z GetCurrentProcessId()

Domniemam ze chodzi o arytmetyke. W delphiaku nie widze innego sposobu anizeli...

function PtrAdd(const MemStart,Offset:Pointer):Pointer;
asm
  ADD EAX,EDX
end;
0

Powiedzmy, że znalazłem pointer i edit2 wskazuje. adres, jaki pointer+offset wskazuje. wszystko Ok, ale pojawia się pytanie. Jak chce odczytać stringa to pisze Edit1.Text := (MemReadString(edit2.text));, lecz to nie działa... A w głównym var po zapisaniu: const RES = edit2.text; nie działa ;/... Liczę na pomoc w zapisaniu tego wyrażenia ;).

0

Czyli chodzi o konwersje ze string na int??

int:=StrToInt(string)

const nie przyjmie wartosci funkcji, bo jak sama nazwa wskazuje - jest const. Ale mozna ominac ten szczegol.Badz co badz stala to tez zmienna. Poprzez wylaczenie sprawdzania wartosci stalych w kompilatorze {$J-}{J+}, ale czy to byly te literki w {$} to nie pamietam mozesz modyfikowac wartosci const. (przynajmniej tak mi sie kojarzy). Jak dla mnie przyjemniej jest stworzyc zmienna 'globalna', konwertowana na string a nie zmienna konwertowana ze stringa ;p

Ja chyba nie za bardzo rozumiem jaki efekt tworca chcial uzyskac...

0
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit3: TEdit;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
const
offset1 = $2BC;
POINTER1 = $265DE508;

implementation

{$R *.dfm}
function MemReadString(Address: Integer): String;
var
NB : LongWord;
Temp : ARRAY [1..255] OF Byte;
I : Byte;
IDProcess, proc_ID : Cardinal;
begin
GetWindowThreadProcessID(FindWindow(Nil, 'EasyMetin2_xCool'), @proc_ID);
IDProcess := OpenProcess(PROCESS_ALL_ACCESS, false, proc_ID);
Result := '';
ReadProcessMemory(IDProcess, Ptr(Address), @Temp[1], 255, NB);
for I := 1 to 255 do
begin
if ((Temp[i] = 0) or (Temp[i] = $0F)) then
Break;
Result := Result + Chr(Temp[i]);
end;
end;
function ReadMemInteger(Address: Cardinal): Cardinal;       //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:integer;
begin
    GetWindowThreadProcessId(FindWindow(Nil, 'Metin2'), @ProcId);
    tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
    ReadProcessMemory(tProc, Ptr(Address), @value, 4, NBR);
    CloseHandle(tProc);
    Result:=value;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var

begin
if FindWindow(Nil, 'Metin2') = 0 then else // pierwszy etap sprawdzanie : czy jest odpalony klient?
begin
Edit1.Text := '$'+inttohex(ReadMemInteger(POINTER1)+(offset1),8), Edit1.Text :=(MemReadString ;

end;
 end;
procedure TForm1.FormCreate(Sender: TObject);
var
  hM: HDC;
begin
  hM:=CreateFileMapping(THANDLE($FFFFFFFF),nil,
  PAGE_READONLY,0,32,'ApplicationTestMap');
  if GetLastError=ERROR_ALREADY_EXISTS then
  begin
    Application.Terminate;
    CloseHandle(hM);
end;

end;

I chcę, aby ReadMemString czytał z adresu w edit1. (adres jest zawarty w edit1) ;/ Lecz wyskakuje błąd. Proszę o pomoc URU

0

POPRAWKA:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit3: TEdit;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
const
offset1 = $2BC;
POINTER1 = $265DE508;

implementation

{$R *.dfm}
function MemReadString(Address: Integer): String;
var
NB : LongWord;
Temp : ARRAY [1..255] OF Byte;
I : Byte;
IDProcess, proc_ID : Cardinal;
begin
GetWindowThreadProcessID(FindWindow(Nil, 'Metin2'), @proc_ID);
IDProcess := OpenProcess(PROCESS_ALL_ACCESS, false, proc_ID);
Result := '';
ReadProcessMemory(IDProcess, Ptr(Address), @Temp[1], 255, NB);
for I := 1 to 255 do
begin
if ((Temp[i] = 0) or (Temp[i] = $0F)) then
Break;
Result := Result + Chr(Temp[i]);
end;
end;
function ReadMemInteger(Address: Cardinal): Cardinal;       //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:integer;
begin
    GetWindowThreadProcessId(FindWindow(Nil, 'Metin2'), @ProcId);
    tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
    ReadProcessMemory(tProc, Ptr(Address), @value, 4, NBR);
    CloseHandle(tProc);
    Result:=value;
end;
procedure TForm1.Timer1Timer(Sender: TObject);


begin
if FindWindow(Nil, 'Metin2') = 0 then else // pierwszy etap sprawdzanie : czy jest odpalony klient?
begin
Edit1.Text := '$'+inttohex(ReadMemInteger(POINTER1)+(offset1),8);

end;
 end;
procedure TForm1.FormCreate(Sender: TObject);
var
  hM: HDC;
begin
  hM:=CreateFileMapping(THANDLE($FFFFFFFF),nil,
  PAGE_READONLY,0,32,'ApplicationTestMap');
  if GetLastError=ERROR_ALREADY_EXISTS then
  begin
    Application.Terminate;
    CloseHandle(hM);
end;

end;

end.

... ALE TO NIE DZIAŁA :
Edit1.Text :=(MemReadString(edit1.text));
POWIE MI KTOŚ CZEMU?

0

tak na moj gust

function MemReadString(Address: Integer): String;
var
  NB : LongWord;
  p:PByte;
  len:integer;
  procId : Cardinal;
  hProcess:HWND;
begin
  Result := '';
  GetWindowProcessId(FindWindow(nil, 'Metin2'), procId);
  hProcess := OpenProcess(PROCESS_ALL_ACCESS, false, procId);
  if ReadProcessMemory(hProcess, Pointer(Address), Pointer(p), sizeof(p^), NB) then begin
    len:=0;
    while (p^<>0) and (p^<>$0F) and (len<255) do begin
      inc(len);
      inc(p);
    end;
    SetLength(Result,len);
    ReadProcessMemory(hProcess, Pointer(Address), @Result[1], len, NB);
  end;
end;

bocik?

//edit

procedure TForm1.Timer1Timer(Sender: TObject);
var
  addr:integer;
begin
  if FindWindow(Nil, 'Metin2') <> 0 then begin // pierwszy etap sprawdzanie : czy jest odpalony klient?
    addr:=ReadMemInteger(POINTER1)+offset1;
    Edit1.Text :='$'+inttohex(addr,8);
    Edit2.Text :=MemReadString(addr) ;
  end;
end

Naprawde nie rozumiem po co sie chcesz bawic z konwersja, skoro nie musisz...
Jest czasochlonna! Tak samo nie uzywaj

var
  Result:string
begin
...
Result:=Result+char(tmp);
...
end;

to wywoluje w twoim kodzie 255 razy

SetLength(Result,Length(Result)+1)

Tak sie jeszcze zastanawialem, co by sie porobilo, gdybys dal

p:char

i nastepnie zrobil ReadProcessMemory(hProcess,Pointer(Address),Pointer(p),1,NB)

Pomijajac fakt ze grzebie nie w swojej pamieci, to powinien konwertowac PChar na String przy 
```delphi
Result:=p

(ale nie wiem czy tworzy string od nowa) Poniewaz PChar jest null-terminated, powinien zakonczyc na #0 (no ale nie na $0F)

Czy to pomoglo? Czy wciaz chodzilo o cos innego?

0
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit3: TEdit;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
const
offset1 = $2BC;
POINTER1 = $265DE508;
offset2 = $2C;
POINTER2 = $2F14C190;
offset3 = $10;
POINTER3 = $2F107EC8;

implementation

{$R *.dfm}
function MemReadString(Address: Integer): String;
var
NB : LongWord;
Temp : ARRAY [1..255] OF Byte;
I : Byte;
IDProcess, proc_ID : Cardinal;
begin
GetWindowThreadProcessID(FindWindow(Nil, 'Metin2'), @proc_ID);
IDProcess := OpenProcess(PROCESS_ALL_ACCESS, false, proc_ID);
Result := '';
ReadProcessMemory(IDProcess, Ptr(Address), @Temp[1], 255, NB);
for I := 1 to 255 do
begin
if ((Temp[i] = 0) or (Temp[i] = $0F)) then
Break;
Result := Result + Chr(Temp[i]);
end;
end;

function ReadMemInteger(Address: Cardinal): Cardinal;       //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:integer;
begin
    GetWindowThreadProcessId(FindWindow(Nil, 'Metin2'), @ProcId);
    tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
    ReadProcessMemory(tProc, Ptr(Address), @value, 4, NBR);
    CloseHandle(tProc);
    Result:=value;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
  addr:integer;
begin
  if FindWindow(Nil, 'Metin2') <> 0 then
  begin
    addr:=ReadMemInteger(POINTER1)+offset1;
    Edit1.Text :='$'+inttohex(addr,8);
    label2.caption :=MemReadString(addr);
    begin

I JAK ZROBIĆ ABY TO WCZYTYWAŁO addr (aby było inne (addr2? Czy coś)

    addr:=ReadMemInteger(POINTER2)+offset2;
    Edit2.Text :='$'+inttohex(addr,8);
    label4.caption :=MemReadString(addr);
 end;
  end;
  end;

procedure TForm1.FormCreate(Sender: TObject);
var
  hM: HDC;
begin
  hM:=CreateFileMapping(THANDLE($FFFFFFFF),nil,
  PAGE_READONLY,0,32,'ApplicationTestMap');
  if GetLastError=ERROR_ALREADY_EXISTS then
  begin
    Application.Terminate;
    CloseHandle(hM);
end;

end;


end.
0

DZIĘKUJĘ ZA WSZYSTKIE ODPOWIEDZI PROBLEM WYJAŚNIONY (DZIĘKI URU)

1 użytkowników online, w tym zalogowanych: 0, gości: 1