4

I'm looking for Delphi samples, but I can find only the C++ sample codes.

For example, how to define the below hook in Delphi?

DETOUR_TRAMPOLINE(int   WINAPI SetScrollInfoT(HWND, int, LPCSCROLLINFO, BOOL), SetScrollInfo)
Kromster
  • 7,181
  • 7
  • 63
  • 111
Leo.W
  • 299
  • 1
  • 7
  • 21
  • 1
    Why not use a native Delphi hooking library? – David Heffernan Mar 02 '13 at 07:45
  • Like this one: [`madCodeHook`](http://help.madshi.net/madCodeHook.htm). – LU RD Mar 02 '13 at 07:48
  • Thanks @David, but can you suggest one for me? – Leo.W Mar 02 '13 at 09:49
  • madCodeHook is superb and I think there are free ones that will also do trampolines, if that's what you are looking for. – David Heffernan Mar 02 '13 at 09:50
  • When I used it I think it was free for non-commercial. But now you have to buy it and its not cheap. He will also not just sell it to anyone because he had a lot of problems with people abusing his library for malware etc... You have to prove your intentions and he will do a background check of who you are. But all that aside its one of the most professional pieces of code I have ever used. – Runner Mar 02 '13 at 11:03
  • MadCodeHook and other products from Madshi.net are fantastic. It's worth it if you're a serious, good guy. If you're a bad person, then begone, or we shall taunt you a second time. – Warren P Mar 02 '13 at 20:23
  • Thanks @Warren, i need the hook to help me skin my component. I found some Delphi Hook API, but either they're not work, or shield by the Anti-Virus, such as the MagicApiHook. Besides the MadCodeHook, any other suggestion? – Leo.W Mar 03 '13 at 02:53
  • Do you need to hook this in other processes, or in your own? – Runner Mar 03 '13 at 08:22

2 Answers2

5

If you only need to hook inside your own process the you can look at Detours library. I recently included it in my Cromis library with the consent of the author.

You can find it here. Just download the whole lib and use Cromis.Detours. It works on 32 and 64 bit and is very well written.

Runner
  • 6,073
  • 26
  • 38
3

Thanks you all guys, finally i got this Ring3HookLibrary

Leo.W
  • 299
  • 1
  • 7
  • 21