Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: So 29.11.09 20:30 
ICh möchte von einem Prozess den speicher nach einer bestimmten stelle scannen.
Ich könnte zwar einfach alles von 0-$7FFFFFFF scannen, aber das ist ja i.d.R. unnötig, da es mir nur um den Speicher der Main-Exe geht.
Das handle (Imagebase) bekomme ich ja über EnumProcessModules()
Die Frage ist jetzt, wie bekomme ich eine vernünftige Größe?

Mit VirtualQueryEx auf die ImageBase kriege ich viel zu wenig (1245199 {$13000F})
Ich weiß, es beginnt bei $400000 und geht noch über $C00000

wie mache ich das sinnvoll?

PS: das ganze soll möglichst universal gehalten sein und auch bei packern (UPX...) oder protectoren (armadillo...) funktionieren.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 30.11.09 16:57 
Wenn du nur auf die Image-Base ne Abfrage machst, erhältst du auch nur das Code-Segment. Für alles weitere musst du insgesamt den Speicher auslesen und dann entsprechend anhand der Modul-Informationen und Speicher-Attribute zuordnen.
VirtualQueryEx liefert nur Blöcke mit gleichen Speicher-Attributen als zusammenhängend. Möchte man das anders, muss man das entsprechend zusammenklauben.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.