Solved

system wide hook

Posted on 2001-06-03
4
216 Views
Last Modified: 2010-04-06
I am using a system wide hook (CBT, Keyboard, and mouse), and therefore I had to write a DLL. When I first wrote this DLL I was having all kind of problems in Windows 95 (that was 3 years ago) until someone told me to compile the DLL with Delphi 2 (instead of Delphi 3 at the time).

I tried this again in Delphi 5 and still the same problem - some MPREXE violation occurs.

I wiuld continue to compile the DLL with D2, but now I have a different error that occurs with the DLL compiled with D2, but not with D5.

When compiling the DLL with D5, is there anything special I need to set for a DLL used as a hook?
0
Comment
Question by:sharons
4 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 6150851
Delphi compiled DLLs do some things during the initialization, which may not be good for hooking. I have written a little utility which can modify the entry point of a DLL, so that it points to your first own exported function (index 1) instead of to Delphi's initialization. This might cure your problems. However, this kills the initialization of all the units. So it makes sense only for ultra-short hooking dlls, which don't need any unit initialization. The utility is available here:

www.madshi.net/hackDll.zip

Perhaps it's worth a try (if your dll is not too complicated)...

Regards, Madshi.
0
 

Expert Comment

by:moonrise
ID: 6150937
Thank you - I have found the solution with

  Set8087cw($133f);

0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 8891054
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/refund of points

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Robert Marquardt
EE Cleanup Volunteer
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 8978800
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now