A lot of people have written about things not to do in your DllMain. Like here, and here and here.
One other thing not to do in your DllMain is to call LoadLibraryEx. As others have written, DllMain’s a really special place to be. If you do anything more complicated than initializing critical sections, or allocating thread local storage blocks, or calling DisableThreadLibraryCalls, you’re potentially asking for trouble.
Sometimes, however the interaction is much more subtle. For example, if your DLL uses COM, you might be tempted to call CoInitializeEx in your DllMain. The problem is that that under certain circumstances, CoInitializeEx can call LoadLibraryEx. And calling LoadLibraryEx is one of the things that EXPLICITLY is forbidden during DllMain (You must not call LoadLibrary in the entry-point function).
PingBack from http://www.keyongtech.com/2560873-calling-outproc-server-from-a