- DLLInjection.zip
- DLLInjection
- Injectee
- Injection
- Injector
- x86
- Debug
- Injection.dll
- Release
- Injection.dll
|
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <windowsx.h>
#include <tchar.h>
LONG_PTR oldWindowProc;
//*******************************************************************************************************
void DrawRect(HDC hDC, int x, int y )
{
::Rectangle( hDC,x,y,(x+50),(y+50) );
}
//*******************************************************************************************************
void DrawText( HDC hDC, int x, int y )
{
TCHAR str[] = TEXT("UR HACKED!!!!");
RECT r;
r.left = x;
r.top = y;
r.right = x+150;
r.bottom = y+30;
::DrawText( hDC,str,_tcslen(str),&r,DT_CENTER );
}
//*******************************************************************************************************
LRESULT CALLBACK HackingWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message )
{
case WM_LBUTTONDOWN:
{
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
HDC hDC = ::GetDC( hWnd );
//::Rectangle( hDC,x,y,(x+50),(y+50) );
DrawText( hDC,x,y);
break;
}
case WM_RBUTTONDOWN:
{
int x = GET_X_LPARAM(lParam);
int y = GET_Y_LPARAM(lParam);
HDC hDC = ::GetDC( hWnd );
::Ellipse( hDC,x,y,(x+50),(y+50));
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
//*******************************************************************************************************
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
//Get the main window of the client
HWND hwnd = ::FindWindow(NULL,TEXT("Injectee") );
//If the window found, then it's window proc
if( hwnd )
{
oldWindowProc = ::SetWindowLongPtr( hwnd, GWL_WNDPROC, (LONG_PTR) HackingWndProc );
}
break;
}
case DLL_THREAD_ATTACH:
{
break;
}
case DLL_THREAD_DETACH:
{
break;
}
case DLL_PROCESS_DETACH:
{
break;
}
}
return TRUE;
}
//*******************************************************************************************************
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm working as Senior software Engineer since 7 years and interested in MFC and COM programming.