The good thing about blogging is

It makes you think. I find that when I’ve done a brain dump post like last night’s “loader lock” posting, all of the issues are fresh in my mind. Posting just before bed means that by the time I wake up I’ve usually come up with lots of new ideas about the thing I just posted about…

So this morning I find myself adjusting my Dll hooking code so that I call back into DllMain() just before unloading the Dll and realising that since I’ve told the loader that this Dll doesn’t have an entry point it’s not going to bother making any calls into the Dll when I create new threads…

This isn’t actually much of a problem for me at the moment. The project that needs this code doesn’t rely on being able to hook before DllMain() so it can be made an optional extra for Dlls that need to get called with DLL_THREAD_ATTACH and DLL_THREAD_DETACH messages. I can also hook DisableThreadLibraryCalls() so that I know if I should warn the user that the Dll I’m working on might not work correctly any more…