Re: System-wide hooking, VB+ASM
- From: erewhon@xxxxxxxxxx (J French)
- Date: Sat, 4 Jun 2005 10:51:21 +0000 (UTC)
On Fri, 3 Jun 2005 09:02:57 -0600, "Jonathan Wood"
<jwood@xxxxxxxxxxxxxxxx> wrote:
>J French,
>
>> Just thinking out loud, the DLL must be capable of initializing the
>> run time itself, as one can use a VB DLL happily from another
>> language, my guess is that is done by the LibMain routine
>It can? According to a link someone posted the other day, the key to calling
>exports from a VB DLL is to perform a couple of tricks when loading the DLL:
>http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=54682&lngWId=1
I find it odd that it should not be able to do so, as I've imported VB
OCXes into Delphi and they work just fine
I'm also pretty sure that I've run VB DLLs from Delphi
Yes - I've just checked
V := CreateOleObject('VBDLL.Class1');
Where V is an OleVariant
Tested on both VB4 and VB5
>I was having a little problem with some test code though. I really would
>like to see a small demo that installs a WH_KEYBOARD hook and crashes when a
>key is hit in another project.
Sure - it is just a lashup job - I'm not proud of it
www.jerryfrench.co.uk/hooktest.zip
>> I can't quite get my head around the initialization sequence, but I am
>> certain that LibMain is called both on normal LoadLibrary and when it
>> is being mapped into another process. I've seen that in Delphi.
>I was wondering about that as well. It's not clear to me if Sub Main in a
>DLL corresponds to a call to LibMain or what exactly.
I don't think it does, as LibMain is expected to return pretty
promptly with a success/failure result
I have just been reading this article :
http://www.windowsdevcenter.com/pub/a/windows/2005/04/26/create_dll.html
He says that:
<quote>
A DLL also includes an optional entry point, which is called when a
process or thread loads or unloads the DLL. Windows calls this entry
point when a process loads and unloads the DLL.
<quote>
He calls it DllMain #0
The key is that it is /optional/ - something I did not realize
However if it really is optional, then it should not be needed for a
system wide hook.
In the Delphi Hook DLL it does use it or something like it, but it
does not need to.
Alhough delving deeper, Delphi has something called _InitLib that does
the same.
I just wonder whether that DllMain that he talks about is a red
herring.
This is getting quite interesting.
.
- Follow-Ups:
- Re: System-wide hooking, VB+ASM
- From: Jonathan Wood
- Re: System-wide hooking, VB+ASM
- From: Sam Hobbs
- Re: System-wide hooking, VB+ASM
- References:
- Re: System-wide hooking, VB+ASM
- From: J French
- Re: System-wide hooking, VB+ASM
- From: Sam Hobbs
- Re: System-wide hooking, VB+ASM
- From: J French
- Re: System-wide hooking, VB+ASM
- From: Karl E. Peterson
- Re: System-wide hooking, VB+ASM
- From: J French
- Re: System-wide hooking, VB+ASM
- From: Jonathan Wood
- Re: System-wide hooking, VB+ASM
- Prev by Date: how to find app termination event?
- Next by Date: Re: Can't copy/rename file using CreateProcessWithLogonW, ImpersonateLoggedOnUser and LogonUser
- Previous by thread: Re: System-wide hooking, VB+ASM
- Next by thread: Re: System-wide hooking, VB+ASM
- Index(es):
Relevant Pages
|
Loading