AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

ReadProcessMemory

Ein Thema von Sync · begonnen am 3. Nov 2013 · letzter Beitrag vom 4. Nov 2013
Antwort Antwort
Sync

Registriert seit: 3. Nov 2013
2 Beiträge
 
#1

ReadProcessMemory

  Alt 3. Nov 2013, 13:17
Guten Tag,

seit ungefähr 4 Monaten beschäftige ich mich mit Delphi. Ich habe bereits ein paar kleine Tools erstellt, was für mich keine Probleme darstellte. Doch nun bin ich an einem Punkt angelangt, wo ich nicht mehr weiter weiß. Seit zwei Tagen versuche ich das Problem zu lösen, was allerdings nicht klappt und mich hier her bringt.

Hier findet mal alle Adressen: Link

Ich möchte Werte aus dem RAM auslesen.

Zitat:
0xA49D54 - [dword] Timer for driving/flying missions (in ms)
0xA51974 - [dword] Timer for boat/bike missions (in ms)
0xA51A3C - Timer for Bloodring race
0xB7CE50 - [dword] Money
0xBAA420 - Wanted Level
0x8CDEE4 - [dword] Max wanted level
0xB79038 - [dword] How many days have passed in game
0xB70153 - [byte] Current Hour
0xB70152 - [byte] Current Minute
0x8D5104 - [byte] Current blur level
0xB7014E - [byte] Current Weekday (1 through 7)
0x8CB7A5 - [byte] Current Radiostation-ID
0xB700F0 - [dword] Current Car ID (from vehicles.ide) - not for bikes
Delphi-Quellcode:
function Get_Player_Position: String;
var
  ASize: Integer;
  h: DWORD;
  Val: NativeUInt;
  WinName, PId, WinHandle: Integer;
begin
  Result := '';

  WinName := FindWindow(nil,'GTA:SA:MP');
  GetWindowThreadProcessId(WinName,@PId);
  WinHandle:= OpenProcess(PROCESS_ALL_ACCESS,False,PId);
  if WinHandle <> 0 then
  begin
    p := 0;
    h := 0;
    Val := 0;
    ASize := 4;

    ReadProcessMemory(WinHandle, Pointer($B7CE50), @h, ASize, Val);

    Result := IntToStr(h);
  end;
  CloseHandle(WinHandle);
end;
Das funktioniert auch wunderbar.

Nun komme ich zu dem Punkt, an dem ich nicht mehr weiter weiß.

Zitat:
0xB6F5F0 - Player pointer (CPed)
0xB7CD98 - Player pointer, direct offset to the ped pool start (CPed)
0xB74498 - CPeds maximum number (normally 140)
0xB74490 - Contains a pointer to a main struct below
This struct:
+0 = Contains a pointer to the first element in the pool
+4 = Contains a pointer to a byte map indicating which elements are in use
+8 = [dword] Is the maximum number of elements in the pool
+12 = [dword] Is the current number of elements in the pool
Each ped object is 1988 (0x7C4) bytes.
For each ped in the pool:
In most cases, you can use even the dword of playeraddress as CPed value
CPed +0x14 = Pointer to XYZ position structure (and rotation)
(CPed+0x14) +0x0 to +0x2C = [dword] Is the rotation matrix
(CPed+0x14) +0x30 = [dword] XPos
(CPed+0x14) +0x34 = [dword] YPos
(CPed+0x14) +0x38 = [dword] ZPos
Delphi-Quellcode:
function Get_Player_Position: String;
var
  p, ASize: Integer;
  XPos, YPos, ZPos: DWORD;
  Val: NativeUInt;
  WinName, PId, WinHandle: Integer;
begin
  Result := '';

  WinName := FindWindow(nil,'GTA:SA:MP');
  GetWindowThreadProcessId(WinName,@PId);
  WinHandle:= OpenProcess(PROCESS_ALL_ACCESS,False,PId);
  if WinHandle <> 0 then
  begin
    p := 0;
    XPos := 0;
    YPos := 0;
    ZPos := 0;
    Val := 0;
    ASize := 4;

    ReadProcessMemory(HandleWindow, Pointer($B6F5F0), @p, ASize, Val);
    ReadProcessMemory(HandleWindow, Pointer(p + $14), @CPed, ASize, Val);
    ReadProcessMemory(HandleWindow, Pointer(CPed + $30), @XPos, ASize, Val);
    ReadProcessMemory(HandleWindow, Pointer(CPed + $34), @YPos, ASize, Val);
    ReadProcessMemory(HandleWindow, Pointer(CPed + $38), @ZPos, ASize, Val);

    Result := Format('X: %d, Y: %d, Z: %d', [XPos, YPos, ZPos]);
  end;
  CloseHandle(WinHandle);
end;

XPos, YPos, ZPos sollten Koordinaten enthalten. Sie enthalten auch Koordinaten, jedoch die falschen, wobei das Vorzeichen stimmt.
Ich habe mir auch schon andere etliche Threads, Hilfestellungen ect durchgelesen. Einer davon war beispielsweise dieser:
http://www.delphipraxis.net/152745-memory-adress-lesen.html Jedoch verstehe ich das von himitsu nicht so wirklich und es muss doch auch einen Weg geben nur an die Koordinaten
zu kommen.

Über Hilfe eurerseits würde ich mich sehr freuen.

Mit freundlichen Grüßen
Sync

PS: Win 7 64 Bit - Delphi XE2 Pro
Ich habe es auch schon auf einem 32 Bit System getestet.
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#2

AW: ReadProcessMemory

  Alt 3. Nov 2013, 22:33
Ich rate mal rein ins Blaue, dass deine Informationen falsch sind und es sich bei den Koordinaten um floats (Single) und keine DWords handelt.
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat
Sync

Registriert seit: 3. Nov 2013
2 Beiträge
 
#3

AW: ReadProcessMemory

  Alt 4. Nov 2013, 15:11
Oh man ja.. jetzt funktioniert es wunderbar.
Sowas als erster Beitrag.

Erschlagt mich.

Naja danke.

Mit freundlichen Grüßen
Sync
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz