Autor Beitrag
lukkee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mi 27.08.08 20:59 
Hallo
ich versuche verzweifelt die funktion VirtualAllocEx abzufangen

hook.dll
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var VAExNext : function (hProcess : Cardinal; lpAddress : Pointer; dwSize : Cardinal; flAllocationType : Cardinal; 
                         flProtect : Cardinal) : Pointer ; stdcall

function VAExHookProc(hProcess : Cardinal; lpAddress : Pointer; dwSize : Cardinal; flAllocationType : Cardinal; 
                      flProtect : Cardinal) : Pointer ; stdcall
begin 
  result := nil
end

begin 
  HookApi('kernel32.dll','VirtualAllocEx',@VAExHookProc,@VAExNext); 
end;



client

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormCreate(Sender: TObject); 
begin 
  InjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES,'hook.dll'); 
end

procedure TForm1.FormDestroy(Sender: TObject); 
begin 
  UnInjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES,'hook.dll'); 
end;


das Problem is da ich selbst zum injecten die VirtualAllocEx aufrufe verfängts sich das tool selbst in eine endlosschleife.. :(
wie kann ich das verhindern ?


lg
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mi 27.08.08 23:19 
Vorweg: Wenn es irgend eine sicherheitsrelevante Dll sein soll (AntiVirus, AntiMaleware, AntiCheat) vergiss es.

Anonsten musst du mit der ProzessID arbeiten, bzw solange der hook noch nicht ausgeführt ist (Also HookApi) die original Funktion weiter ausführen und danach eine globale Variable setzen die abgefragt wird und erst ab da NIL zurückliefern.

Zufällig kann ich etwas mit dem Code anfangen aber 99.999999% aller anderen User hier nicht. Du solltest schon sagen wo die HookApi Funktion etc. herkommen.

Und da wäre eindeutig das madshi Forum (die benutzt du ja anscheinend) besser.

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit