Global function hook...

Posted on 2003-03-06
Medium Priority
Last Modified: 2010-04-18
My question is how to globally hook some function from any other dll (kernel32, user32, winsock). I watched madCodeHook but it allows me only to hook a function in one process only. And it would be fine if it worked on W2k/XP too ;-))

I offer +500 points for a complete solution...
Question by:Lukasz Lach
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 8084993
So you want to hook into the Windows API globally?  Sounds like a RootKit.  ;-)  Check out http://rootkit.com/ for some examples, with source code.  Not in Delphi, but the API's are the same.

Author Comment

by:Lukasz Lach
ID: 8091319
Madshi i know you can ;-)
LVL 20

Accepted Solution

Madshi earned 2000 total points
ID: 8097239
You can use the latest beta version of madCodeHook which supports system wide dll injection in both 9x and NT families. This way you can quite easily realize system wide API hooking. Here's the download:


Here are some demos which demonstrate how you can use madCodeHook to do system wide API hooking:


Regards, Madshi.

Author Comment

by:Lukasz Lach
ID: 8097271
It is realy cool, but I have one problem while compiling the dll:

  DllProc := @HandleEvents;
  DllProc(DLL_PROCESS_ATTACH); // -> Missing operator or semicolon

I'm using D5, in my case
var DllProc: Pointer
 in SysUtils
LVL 20

Expert Comment

ID: 8097313
Oh, interesting, thanks for the hint. Then please change it to:


I'll change it in my sources, too.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question