Re: Creating DLL Entry Point



FFrozTT <tech@xxxxxxxxxxxxxxxx> wrote:
I have a small project that works fine as an EXE. Now I want to make
it into a DLL. I've created a DllMain routine and set it as the entry
point (code below). Then from DllMain I try to initialize my main
routine called ThreadProc. I've tryed this several different ways and
can't get it to work. It compiles fine but when I go rundll32 mydll.dll
nothing happenes (works in exe form.)

A few problems:

It's generally not a good idea to call CreateThread in your DllMain You.
do mention you're handling the problems this will raise elsewhere .

RunDll32 is likely not even loading your DLL. Your using incorrect
syntax, as RunDll32 expects an exported function that it can call.

Even if RunDll32 was loading your DLL, it's extremely likely the
RunDll32 process would exit long before your spawned thread could do
anything remotely interesting.

If you want to test your DLL, it's probably best to write a simple test
app that will call LoadLibrary, and then either wait for you to close
it, or waits some specified time.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
They who would give up an essential liberty for temporary security,
deserve neither liberty or security.
-- Ben Franklin
.



Relevant Pages

  • Re: Creating DLL Entry Point
    ... I've created a DllMain routine and set it as the ... You pass incorrect parameters to rundll32. ... even loading your DLL. ... rundll32 will unload the DLL and terminate as soon as your entry point ...
    (microsoft.public.vc.language)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)
  • Re: OTOH, you folks are smart ...
    ... for DllMain or any code to be executed before DoSomethingis called. ... to make a DLL ... I am the SDK user. ... *appears* to me to be because of the order the libraries get processed. ...
    (microsoft.public.vc.mfc)