Registriert seit: 15. Nov 2008
Ort: Darmstadt
106 Beiträge
|
Re: MemorySpeicher effektiv durchsuchen
24. Sep 2009, 15:58
Ich habe das mal ausprobiert aber ich bekomme irgendwie zu wenig Addressen raus
(Ich habs erstma nur mit Integerwerten gemacht)
Delphi-Quellcode:
procedure TForm1.Button3Click(Sender: TObject);
var ProcessHandle: THandle;
StartMem: DWord;
lpBuffer: TMemoryBasicInformation;
IntValue: Integer;
dwRead: DWord;
dwOld: DWord;
WindowName: integer;
pidi: integer;
begin
Listbox1.Clear;
WindowName := FindWindow(nil, PWideChar(Edit1.Text));
GetWindowThreadProcessId(WindowName, @pidi);
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, false, pidi);
if (ProcessHandle <> 0) then
begin
StartMem := 0;
while (StartMem < $80000000) do
begin
if VirtualQueryEx(ProcessHandle, Ptr(StartMem), lpBuffer, SizeOf(lpBuffer)) = SizeOf(lpBuffer) then
begin
if lpBuffer.State <> MEM_FREE then
begin
if ReadProcessMemory(ProcessHandle, lpBuffer.AllocationBase, @IntValue, 4, dwRead) = True then
begin
Listbox1.Items.Add('Address: ' + '$' + inttohex(Integer(lpBuffer.AllocationBase), 8) + ' Value: ' +inttostr(IntValue));
end;
end;
if (lpBuffer.RegionSize <> 0) then
inc(startMem, lpBuffer.RegionSize)
else
startMem := startMem + $00000100;
end
else
begin
startMem := startMem + $00000100;
end;
end;
end;
CloseHandle(ProcessHandle);
end;
|
|
Zitat
|