给你个例子:<br><br>// 这个是被 hook 的函数<br>function Test2(a1, a2, a3, a4: LongWord): LongWord; stdcall;<br>begin<br> Writeln('a1: ', a1, '; a2: ', a2, '; a3: ', a3, '; a4: ', a4);<br> Writeln('Test2 called.');<br> Result := 2;<br>end;<br><br>// 这个是 hook 的 event:回调<br>procedure Test3(a0, a1, a2, a3, a4: LongWord); cdecl;<br>begin<br> Writeln('a1: ', a1, '; a2: ', a2, '; a3: ', a3, '; a4: ', a4);<br> Writeln('Test3 called.');<br>end;<br><br>// 你插进去的处理 hook 的函数<br>procedure Test4(); stdcall;<br>begin<br> asm<br> pop callBack // callBack<br> push $1<br><br> call Test3 // event for hook, no change sp<br><br> pop eax // a0, call Test2 ?<br> call Test2<br> <br> push callBack // callBack<br> mov callBack, $0<br> end;<br>end;