-4

I've got a Win32 exe which I want to convert into an injectable Dll file. This is what I tried:

BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{   
   if (dwAttached == DLL_PROCESS_ATTACH) {
       CreateThread(NULL, 0, &WinMain, NULL, 0, NULL); //This doen't work...
   }
   return 1;
}

I don't know how to make it call WinMain on attach. How do I do it the right way. Thanks for your help.

nice
  • 17
  • 6

1 Answers1

-2

Try this :

BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
   if (dwAttached == DLL_PROCESS_ATTACH) {
    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WinMain, NULL, 0, NULL); //starts the routine in anew thread
   }
   return 1;
}
nice
  • 17
  • 6