Einzelnen Beitrag anzeigen

Lord Shadow

Registriert seit: 10. Okt 2007
15 Beiträge
 
#8

Re: Problem mit ProcessMemory

  Alt 21. Feb 2008, 18:23
Ok Sirius danke Das habe ich leider nicht gecheckt Ich werde das Programm jetzt nochmal umbaun und die zurückgelieferten Addressen verwenden

Ok ich hab jetzt ein paar Stunden dran gesessen. Das auslesen geht an sich. Mein Linkfilter funktioniert eigentlich auch wunderbar. aber was der mir da an Speicher zurückliefert ist Katastrophal. Die Links sind total durcheinander und abgehackt. Irgendwas kann da noch net funzen ^^

Delphi-Quellcode:
function IntToString (Byt : Array of Byte) : String;
var i : integer;
    res : string;
begin
for i:=0 to high(Byt) do if (((Integer(Byt[i])>31) and (Integer(Byt[i])<127))) then res:=res+CHR(Integer(Byt[i]))
else res:='';
result:=res;
end;

...

function GetLinks (text : string):TStringList;
var List : TStringList;
    x,y,i : integer;
    rest,tmp : string;
begin
List:=TStringList.Create;
while pos('http://xxx.com/xxx',text)>0 do
 begin
  x:=pos('http://xxx.com/xxx',text);
  y:=pos('.rar',text);
  tmp:='';
  for i:=x to y+3 do tmp:=tmp+text[i];
  rest:=text;
  text:='';
  for i:=y+2 to length(rest) do text:=text+rest[i];
  List.Add(tmp);
 end;
result:=List;
end;

...

procedure TForm1.getmemInfo(HHwnd : Hwnd);
var mbi:memory_basic_information;
    si:system_info;
    pos:cardinal;
begin
  getsysteminfo(si);
  pos:=cardinal(si.lpMinimumApplicationAddress);
  while pos<cardinal(si.lpMaximumApplicationAddress) do begin
    virtualqueryEx(HHwnd,pointer(pos),mbi,sizeof(mbi));
    if ((mbi.State and mem_commit)>0) then
    begin
      setlength(Address,high(Address)+2);
      Address[high(Address)].Offset:=Integer(mbi.BaseAddress);
      Address[high(Address)].Size:=mbi.RegionSize;
    end;
    inc(pos,mbi.regionsize);
  end;
end;

...

GetWindowThreadProcessId(XHwnd,@RSDProID);
XHwnd:=OpenProcess(Process_All_Access,False,RSDProID);
getmeminfo(XHwnd);
for x:=0 to high(Address) do
 begin
  Application.ProcessMessages;
  Count:=Address[x].Offset;
  while Count<(Address[x].Offset+Address[x].Size) do
   begin
    ReadProcessMemory(XHwnd,Pointer(Count),@Buffer,100,rread);
    Content:=content+IntToString(Buffer);
    Inc(Count,100);
   end;
 end;
Links.AddStrings(getLinks(Content));
Memo1.Lines.Clear;
Memo1.Lines.Text:=Links.Text;
Das erste ist die Umwandel funktion hierbei betrachte ich nur bytes welche bestimmten ASCII Codes entsprechen damit ich ordentlichen Text filtere. Das 3. ist mein Linkfilter der auf die Endung .rar anspricht. Das 3. ist deine getMem Funktion so das sie mir die Werte die ich brauch in ein Array speichert. Das 4. ist dann die Auslese Funktion die eigentlich den Gesamten Speicher in den Offsetberreichen ausliest. Raus kommt aber wie gesagt abgehacktes zeug so wie:

Code:
[url]http://xxx.com/xxx/pts.dvd1.part01http://rhttp://xxx.com/xxxhttp://xxx.cohttp://xxx.com/xxx/pts.dvd1.pahttphttp://xxx.com/xxhttp://xhttp://xxx.com/xxx/pts.dvdhttp://xxx.com/files/http://xxx.com/xxx/pts.dvd1.part19.rar[/url]
Verzweiflung ist nahe
  Mit Zitat antworten Zitat