unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 =
class(TForm)
Button1: TButton;
ListBox1: TListBox;
Label1: TLabel;
BitBtn1: TBitBtn;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ProcessHandle,WindowHandle: THandle;
StartMem: DWord;
lpBuffer: TMemoryBasicInformation;
myMem: Pointer;
dwRead: DWord;
dwOld: DWord;
processID,pidi : Integer;
begin
WindowHandle :=FindWindow(
nil,'
Guild Wars');
ProcessID:= GetWindowThreadProcessId(WindowHandle ,@Pidi);
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, false, pidi);
if (ProcessHandle <> 0)
then
begin
StartMem := $00400000;
while (StartMem <> $7FFFFFFF)
do
begin
if VirtualQueryEx(ProcessHandle, Pointer(StartMem), lpBuffer, SizeOf(lpBuffer)) = SizeOf(lpBuffer)
then
begin
if VirtualProtectEx(ProcessHandle, lpBuffer.AllocationBase, lpBuffer.RegionSize, PAGE_EXECUTE_READWRITE, dwOld)
then
begin
myMem := VirtualAlloc(
nil, lpBuffer.RegionSize, MEM_COMMIT
or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (myMem <>
nil)
then
begin
if ReadProcessMemory(ProcessHandle, lpBuffer.AllocationBase, myMem, lpBuffer.RegionSize, dwRead)
and (lpBuffer.RegionSize = dwRead)
then
begin
Form1.ListBox1.Items.Add('
Speicher gelesen: '+IntTohex(DWord(lpBuffer.AllocationBase),8)+'
, '+
'
Größe: '+IntToHex(lpBuffer.RegionSize,8)+'
, '+
'
gespeichert in: '+InttoHex(DWord(myMem),8));
end;
VirtualFree(myMem, 0, MEM_RELEASE);
end;
VirtualProtectEx(ProcessHandle, lpBuffer.AllocationBase, lpBuffer.RegionSize, dwOld, dwOld);
end;
if (lpBuffer.RegionSize <> 0)
then
inc(startMem, lpBuffer.RegionSize)
else
startMem := startMem+$1000;
end else
inc(StartMem,$1000);
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
listbox1.Clear;
end;
end.