Re: System-wide hooking, VB+ASM



On Sun, 5 Jun 2005 12:41:59 -0700, "Sam Hobbs"
<samuel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>"J French" <erewhon@xxxxxxxxxx> wrote in message
>news:42a2bf6e.3410656@xxxxxxxxxxxxxxxxxxx
>>
>>>I don't know if VB uses a DLL entry point (called DllMain, LibMain or
>>>whatever) but it probably does. We don't know what it is doing but it
>>>could
>>>be causing a problem somehow.
>>
>> My guess (and it is just a guess) is that all DLLs have this as a
>> standard entry point.

>That depends on what you mean by "standard". I think you mean that all DLLs
>have an entry point function, since it is a standard. Not all DLLs have a
>DLL entry point. I am not guessing, I know that the DLL entry point is not
>required.

>Perhaps you are thinking that when other languages, such as C++, are used to
>create a DLL, that the source code is generate with a DLL entry point
>function. When using VC 6 and a "Win32 Dynamic-Link Library" project is
>created, we have a choice of three options. One is to create a project
>without any source code generated, another is a project with a simple DLL,
>and another is a project for a DLL that exports symbols. The source code
>generated for the simple DLL does have a skeleton DllMain and that is all
>that is in the source code. The third type of project generates source code
>with a DllMain that also has a switch (select) statement and it has a sample
>class that exports a couple of functions.
>
>The DllMain can of course be deleted in a second from the generated source
>code if it is not needed.

I've left that unedited

It looks as if you are saying that a DLL need not have an entry point.

Somehow I doubt that, if an /explicit/ entry point is deleted then the
compiler (or maybe the linker) would supply an implicit entry point.

Or more likely the 'implicit' entry point looks for the 'explicit'
entry point and calls it if it is not Null.

Have a look at www.masm32.com
and download their programming kit

You'll find that the DLL example is actually an EXE and the last line
is:
End LibMain

Which is the standard way in which one determines the entry point of
an EXE or a COM

Remove that ( eg: End ; LibMain ) and the linker moans:

Creating library tstdll.lib and object tstdll.exp
LINK : error LNK2001: unresolved external symbol
__DllMainCRTStartup@12
tstdll.dll : fatal error LNK1120: 1 unresolved externals


.



Relevant Pages

  • Re: System-wide hooking, VB+ASM
    ... >returned by the SetWindowsHookEx function used to set the hook. ... The reason is that only the /first/ instance of the DLL ... >Look up DllMain in the SDK documentation. ... standard entry point. ...
    (microsoft.public.vb.winapi)
  • Re: Retrieve a DLL Handle
    ... VirtualQuery(&mbi, &mbi, sizeof(mbi)); ... > I would like to know how i can retrieve a DLL handle without a DllMain ...
    (microsoft.public.win32.programmer.kernel)
  • Re: using exe as dll
    ... Really dllmain is not obligatory because if you have dll without it windows ... >>It is possible to export functions out of exe and then use it as ... the initial entry point goes instead to main or ...
    (microsoft.public.win32.programmer.kernel)
  • Re: System-wide hooking, VB+ASM
    ... > It looks as if you are saying that a DLL need not have an entry point. ... I avoid saying "Wrong" like that and I seldom do. ... A DLL is just a bunch of functions. ... assembler did nearly a half century ago. ...
    (microsoft.public.vb.winapi)
  • RE: Web Part Unsafe
    ... DON'T strong name your assembly, remove the old dll from the GAC, ... I add an entry to the webconfig in the wwwroot. ... > on it so there may be configuration issues. ...
    (microsoft.public.sharepoint.portalserver.development)