1.Debug the MyNewDll project, try to know the calling style inwindows.
1. Calling stack
In SecMain.exe!SecNt32PeCoffRelocateImage, I call the LoadLibrary tocall the library.
In MyNewDll.dll!DllMain, it call the DllMain function in my MyNewDllproject.
2.Calling from _DllMainCRTStartup to __DllMainCRTStartup
3.Calling from __DllMainCRTStartup to DllMain
From the page 2-3, we can see the function name is hard code inwindows code, so you must use these names to make windows can find the functionit want to call when call LoadLibrary function.
In Our code, we just implement the _DllMainCRTStartup function andreturn TRUE to make the LoadLibrary function always return success.
4. PE header info (High light the entry point field)
Also in our test, when the function name is not _DllMainCRTStartupin PE's Entry Point field, it also canbe call in. so in windows, it not hard code about the entry point functionname. I think it get the entry point name from this filed, so we just registerthe entry function name here to make windows can call in.