Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

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

Re: Globaler API-Hook funktioniert nicht

  Alt 17. Mai 2008, 11:10
Hi,

Also bei mir siehts im Moment so aus:

Delphi-Quellcode:
// beim Hooken:
WriteProcessMemory(hProc,Pointer(Integer(@FindNextHooked)+17),Sicherung,5,br);

procedure FindNextHooked;
asm
  push [esp+8]
  push [esp+8]
  call @@GetReturnAdress
  @@GetReturnAdress:
  add [esp], 14 //4 Byte: Opcode, ModR/M, SIB, Immediate
  nop
  nop
  nop
  nop
  nop
  add FindNextOld, 5
  jmp FindNextOld // *
  jmp AfterFindNext
end;
*) jmp offset FindNextOld + 5 compiliert nicht:

[Error] Unit1.pas(66): Invalid combination of opcode and operands

deswegen habe ich es durch

Zitat:
add FindNextOld, 5
jmp FindNextOld
Allerdings verstehe ich diese Zeile nicht:

add [esp], 14 // wird da die Adresse von esp um 14 erhöht? wenn ja warum? Hat bis eben so nicht funktioniert, weil ich nicht wusste (und immernoch nicht genau weiß, was diese Zeile bewirkt, aber ich habe herausgefunden das ich die 14 durch eine 17 ersetzten muss damit es funktioniert...

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