Hooking exit process
- From: "Bruce." <noone@xxxxxxxxxxx>
- Date: Wed, 19 Mar 2008 17:04:40 -0500
As a continuation of my other thread here, I am now trying to hook
ExitProcess() so a routine up in my dll will be called at the time the exe
is unloading BEFORE the DllMain is called with DLL_PROCESS_DETACH is called.
I used the example code from
http://www.jamajm.com/e-books/cpprichter/HTML/ch22j.htm
which shows how to hook ExitProcess. I pasted that code in a test exe and
it works very nicely. MyExitProcess() code is always called when the exe
exits. Perfect so far.
So I pasted the code in to my dll and MyExitProcess() is never called. The
registering of the hook seems to work perfectly, but it never gets called.
I have tried scanning for both the exe name and the dll name, and neither
works. In both cases it finds the right entry, installs the hook, but
MyExitProcess in the dll is never called when the exe exits.
Any idea what I'm doing wrong? Why would hooking ExitProcess in this code
work in an exe but not in a dll loaded by that exe?
Bruce.
.
- Follow-Ups:
- Re: Hooking exit process
- From: Alexander Grigoriev
- Re: Hooking exit process
- From: Bruce.
- Re: Hooking exit process
- Prev by Date: Re: Gracefully shutting down a thread in a DLL
- Next by Date: Re: Hooking exit process
- Previous by thread: Re: call GetModuleFileName() in GINA
- Next by thread: Re: Hooking exit process
- Index(es):
Relevant Pages
|