Xtrap terminates thread created in DllMain
Well, as usual, i put CreateThread in DllMain like this:
The problem is: my thread had started for a while then got terminated. I know Xtrap did this because I tried with older version of Xtrap and the thread runs normally.
Could anyone help me with this problem? Thanks!
Code:
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
DisableThreadLibraryCalls(hModule);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(MainThread), NULL, 0, NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Could anyone help me with this problem? Thanks!