All right, Actually I am manually mapping a module into a process, actually my mapper calls DllEntryPoint from standard struct IMAGE_NT_HEADERS thus IMAGE_NT_HEADERS::OptionalHeader::AddressOfEntryPoint etc...
The problem: consider following code:
void Log(const char*, ...);
class Test
{
private:
struct List_t
{
const uint32_t x;
const uint32_t y;
} List;
public:
Test(List_t z) : List(z) { Log("Called event 0! \n"); }
~Test() {}
};
void Entry()
{
Test Instance
(
{
0x200,
0x400
}
);
Log("Called! \n");
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == 1)
Entry();
return TRUE;
}
so if the module entry point gets called through IMAGE_NT_HEADERS::OptionalHeader::AddressOfEntryPoint from mapper, the constructor Test() never gets executed, while that Entry() function gets executed successfully, now if the module it's loaded with standard LoadLibraryA(); so Test() constructor gets called successfully...
Where i would find some information about this?
I have heard something about CRT initializers, but i can't find anything deeply...