Basic Dll Injection

02/25/2013 19:53 BeliveInNothing#1
Hello .... even if i'm injecting this dll to any process, it just doesn't execute the main frunction


PHP Code:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

void Hello ()
{
MessageBox (0"Hello from injected DLL!\n""Hi"MB_ICONINFORMATION);
}


BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (
reason)
{
case 
DLL_PROCESS_ATTACH:
Hello();
break;

case 
DLL_PROCESS_DETACH:
Hello();
break;

case 
DLL_THREAD_ATTACH:
Hello();
break;

case 
DLL_THREAD_DETACH:
Hello();
break;
}

/* Returns TRUE on success, FALSE on failure */
return TRUE;

02/25/2013 20:06 C!rcle#2
Code:
#include <windows.h>

void Hello()
{
	MessageBox (0, "Hello from injected DLL!\n", "Hi", MB_ICONINFORMATION);
}

DWORD WINAPI DllMain(HINSTANCE hInstance,DWORD dwReason,LPVOID lpReserved)
{
	switch(dwReason)
	{
		case DLL_PROCESS_ATTACH:
			Hello();
		break;
	}
	return 1;
}
That's just my way but it should work.
02/25/2013 20:10 bloodx#3
Code:
#include <windows.h>

void Hello()
{
	MessageBox( 0 , L"Hello dude" , L"Hi!" , MB_OK );
}
unsigned long __stdcall DllMain( HMODULE , unsigned long  ul_reason_for_call, LPVOID )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		Hello();
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}

	return 1;
}
02/25/2013 20:56 BeliveInNothing#4
I still don't get the MsgBox... if anyone is able to gelp me, add me on skype: theshadowscall

Thanks
02/25/2013 23:04 Delinquenz#5
Which injector do you use? Maybe you used the wrong injection way?
02/25/2013 23:13 BeliveInNothing#6
I'm using Kernel Detective to inject libraries to prcesses :D
02/25/2013 23:32 Delinquenz#7
Maybe you try something like WinJect? (Also an injector)
02/25/2013 23:48 BeliveInNothing#8
I tried many injectors... none work. If you have time, add me on skype " theshadowscall" and i could show you by team viewer...
02/28/2013 00:53 BeliveInNothing#9
Nobody can help me??? I tried every code found on the internet, but when injectng NOTHING HAPPENS
02/28/2013 01:22 Delinquenz#10
It should work guy. We can't understand your problem, sorry.
02/28/2013 01:39 BeliveInNothing#11
Maybe is because of my computer?

Can anyone inject this to any process and tell me if "calc.exe" is executed?thanks
03/01/2013 13:55 iCraziE#12
Not sure if this is necessary I know in order to use MessageBox you need to make sure you add the windows form resource.