Multiple instances of DLL in memory.

From: Ihor Bobak (ibobak_at_ukrpost.net)
Date: 11/28/03


Date: 28 Nov 2003 07:53:55 -0700


I created a dll which sets a global WH_SHELL hook,
and .exe which uses this dll.

This dll sends messages to a window in my .exe when
the global hook procedure is called by some process.

The problem is next: this dll is loaded for each process
separately. Process Viewer shows 10 or more copies of my
dll in memory (used by each process which called my
hook procedure).

I cannot understand why my dll is not loaded just once?
I saw many examples (written on C++) which set the
same hook in the same way, but their dll is loaded
only once and used by many processes simultaneously.

Can anybody tell me, how to make the dll really shared ?

Thanks in advance.



Relevant Pages

  • Re: Ending all DLL instances
    ... According to MSDN, the ... >> I have a DLL which has a Hook function. ... > containing the hook procedure. ...
    (microsoft.public.vc.language)
  • Hooking exit process
    ... 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 ... So I pasted the code in to my dll and MyExitProcessis never called. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Using Visual Basic to Write System-Wide Hooks
    ... >I've spent about an hour looking into writing a system-wide hook using only ... a system-wide callback function must be located within a DLL. ... >system-wide hook DLL. ... The reason is that Visual Basic has some large runtime ...
    (microsoft.public.vb.winapi)
  • Re: Hooking Keyboard
    ... remove the hook DLL from their app basically by replacing several system ... they attempted to hide the fact by naming the hook DLL "COED11.DAT". ... Basically the NT service I'm writing needs to trap a keystroke, ... The hook procedure can be in the state of being called by another thread ...
    (microsoft.public.vc.language)
  • Re: Hooking Keyboard
    ... btw, I'm using the lowlevel keyboard hook, and from the doc they say it ... they attempted to hide the fact by naming the hook DLL "COED11.DAT". ... Basically the NT service I'm writing needs to trap a keystroke, ... The hook procedure can be in the state of being called by another thread ...
    (microsoft.public.vc.language)