Error Creating Threads

Posts 1–7 of 7 · Page 1 of 1
Error Creating Threads
I'm getting a fking error when creating a thread in the base:
Code:
BOOL APIENTRY DllMain( HMODULE hMod,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    //MessageBox(NULL, _T("DLL Injetada!"),_T("H4CK34D0"),MB_OK|MB_SYSTEMMODAL);
    CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)principal(), NULL, NULL, NULL);
    DisableThreadLibraryCalls(hMod);
    return true;
}

BOOL WINAPI principal() {
	Sleep(9800);
	try {
		DWORD dllfile = (DWORD)GetModuleHandleA("CShell.dll");
		if(dllfile == false) {
			throw 1;
		}
	}
	catch (int error) {
		switch(error) {
		case 1:
			CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)principal, NULL, NULL, NULL);
			return false;
		default:
			//Unkown error!
			return false;
		}
	}
	CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)princ, NULL, NULL, NULL);
	return true;
}

On the first and last CreateThread it's giving: principal was not declared in this scope and princ was not declared in this scope.

Do you know the solution?
Code:
void Akane() {
       	for (;;)
		{
			if (GetModuleHandle("CShell.dll") != NULL)
				break;
			Sleep(100);
		}
//do what you want here...
}


extern "C" __declspec (dllexport) BOOL __stdcall DllMain(HINSTANCE myDLL, DWORD myReason, LPVOID myReserved)
{

		if (myReason == 1)
		{
				CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Akane, 0, 0, 0);
		}

		return TRUE;
}
i don't know why your doing it in such way but if your trying to do something after CShell.dll is loaded , then you can do it in this way ...
Your principal function is declared after the first usage. Move it to the beginning of the file. And the second error is because princ does not exist. You called it principal. Also, you don't need to throw an exception just to catch it right after throwing it... Btw. you should learn to read the errors you're getting instead of creating a thread for that.
Quote Originally Posted by Biesi View Post
Your principal function is declared after the first usage. Move it to the beginning of the file. And the second error is because princ does not exist. You called it principal. Also, you don't need to throw an exception just to catch it right after throwing it... Btw. you should learn to read the errors you're getting instead of creating a thread for that.
Actually I have a princ function, just didn't put it there. Thanks for your help!

- - - Updated - - -

Thanks for who helped, my question have been answered
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us