Code:
BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
HANDLE v4; // eax@3
HANDLE v5; // eax@4
if ( fdwReason )
{
if ( fdwReason == 1 )
{
DetourTransactionBegin();
v4 = GetCurrentThread();
sub_1002B2C0(v4);
beginthread(SQLSetup, 0, 0);
beginthread(ThreadWithSleep1k, 0, 0);
DetourAttach(&Server__Menu, Dragon__Server__Menu);
DetourAttach(&CPlayerObject__OnTimer, Dragon__CPlayerObject__OnTimer);
// Dangerous Sleep(1000u) in there
DetourAttach(&CPlayer__LevelUp, Dragon__CPlayer__LevelUp);
DetourTransactionCommit();
return 1;
}
}
else
{
DetourTransactionBegin();
v5 = GetCurrentThread();
sub_1002B2C0(v5);
DetourTransactionCommit();
}
return 1;
}
You do some little risky things :P
First of all you did not Detach your Functions (DetourDetach), so you will not have an clean Server Close without this.
Second thing is you made a Sleep in CPlayerObject__OnTimer!
1000B6D0 push 1000
1000B6D5 call Sleep
I think the CPlayerObject__OnTimer is now reduced by its half.
And why do you start 2 Threads in DLL Attach when you want to use OnTimer instead of Threads?
The SQL Statments can be done i one single function without Thread.
I could help if you would show me the code ^^