AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Globaler API-Hook funktioniert nicht

Ein Thema von Neutral General · begonnen am 10. Mai 2008 · letzter Beitrag vom 26. Mär 2009
 
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#18

Re: Globaler API-Hook funktioniert nicht

  Alt 17. Mai 2008, 12:28
Hi brechi,

Ok ich habe es mal so gemacht:

Delphi-Quellcode:
procedure NextHook;
asm
  nop
  nop
  nop
  nop
  nop
  add FindNextOld,5
  call FindNextOld
end;

procedure FindNextHooked;
asm
  push [esp+8] // Sonst kommen die falschen parameter in FindNextOld an
  push [esp+8] // ...
  call nexthook
  sub FindNextOld,5
  ret
end;
mein TestCode sieht so aus:

Delphi-Quellcode:
procedure TForm1.Button3Click(Sender: TObject);
var sr: TSearchRec;
begin
  FindFirst('C:\*.*',faAnyFile,sr);
  FindNext(sr);
end;
FindNext sieht so aus:

Delphi-Quellcode:
push ebx
mov ebx,eax
lea eax,[ebx+$18]
push eax
mov eax,[ebx+$14]
push eax
call FindNextFile // <--- springt zu FindNextFileA, ist gehooked
// hier macht er weiter wenn das ret aus FindNextHooked aufgerufen wird
test eax,eax
jz +$09
mov eax,ebx
call FindMatchingFile
pop ebx
ret // <--- hier,
call GetLastError
pop ebx
ret // oder hier müsste er wieder in Button3Click springen, er springt aber (soweit ich das beurteilen kann) irgendwo in die pampa
... und das gibt dann eine AV.

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:37 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz