This is the most simple version of DLL Injection
1. VC++ 2k5 (any version is ok), New Project -> Win32 Project
- Empty Project DLL
2. Add new C source file:
3. Build project in Release mode.
#include <windows.h>
BOOL APIENTRY DllMain( HINSTANCE hIns, DWORD reason, LPVOID reserved )
{
switch( reason )
{
case DLL_PROCESS_ATTACH:
MessageBoxA( NULL, "Process Attach", "MsgBox", 0 );
break;
case DLL_PROCESS_DETACH:
MessageBoxA( NULL, "Process Detach", "MsgBox", 0 );
break;
case DLL_THREAD_ATTACH:
MessageBoxA( NULL, "Thread Attack", "MsgBox", 0 );
break;
case DLL_THREAD_DETACH:
MessageBoxA( NULL, "Thread Detach", "MsgBox", 0 );
break;
}
return TRUE;
}
4. Use a DLL Injector to inject this DLL into any process.
- You can use this Injector: Winject (by mcMike)
[*] I will mention about writing injector later on.
Have fun!@