#include <Windows.h> #include <gdiplus.h> #include "resource.h" #include "Inject.h" #include <string> #include <fstream> #include <iostream> using namespace std; int a; int date; char Buf1[255] = ""; char buf[256] = "Re" ; static HWND Edit1; #pragma comment (lib, "gdiplus.lib") using namespace Gdiplus; GdiplusStartupInput gdi; ULONG_PTR gdi1; char* pName = ""; char* pName1 = ""; char* dll_name = ""; DWORD pID = 0; bool isGame = false; bool isInjected = false; HMODULE hDll; #define width 320 #define height 320 HINSTANCE hInst; static HWND hCombo; HRGN hRgn; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); void OnPaint(HDC hdc) { Graphics graphics(hdc); SolidBrush brush(Color(255, 0, 255, 0)); SolidBrush brush1(Color(255, 255, 255, 0)); FontFamily fontFamily(L"Times New Roman"); Font font(&fontFamily, 14, FontStyleRegular, UnitPixel); PointF pointF(10.0f, 20.0f); Bitmap* picture = Bitmap::FromResource(GetModuleHandle(NULL), MAKEINTRESOURCEW(101)); graphics.DrawImage(picture, 0, 0); delete [] picture; graphics.DrawString(L"Dll Injector!", -1, &font, pointF, &brush); if(isGame) { graphics.DrawString(L"\nИгра найдена", -1, &font, pointF, &brush1); } else { graphics.DrawString(L"\nИгра не найдена", -1, &font, pointF, &brush); } if(isInjected) { graphics.DrawString(L"\n\n\n\n\nИнжектировано", -1, &font, pointF, &brush1); } else { graphics.DrawString(L"\n\n\n\n\nНет Инжекта", -1, &font, pointF, &brush); } } int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWnd; MSG msg; WNDCLASS w; memset(&w,0,sizeof(w)); w.style = NULL; w.lpfnWndProc = WndProc; w.hIcon = LoadIcon(hInstance, IDI_WARNING); w.hInstance = hInstance; w.lpszClassName = "C Windows"; RegisterClass(&w); hWnd = CreateWindow("C Windows","Injector", WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX, 10, 10, height, width, NULL, NULL, hInstance, NULL); GdiplusStartup(&gdi1, &gdi, NULL); ShowWindow(hWnd,nCmdShow); SetTimer(hWnd, 0, 200, NULL); while(GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wparam,LPARAM lparam) { HDC hdc; PAINTSTRUCT ps; RECT rect; RECT rc; HDC hdcMem; HBITMAP hbeMem; HANDLE hOld; if (msg == WM_DESTROY ) { PostQuitMessage(0); return 0; } switch (msg) { case WM_CREATE: CreateWindow("BUTTON", "Open.dll ", WS_CHILD | WS_VISIBLE ,170, 190, 70 , 25,hWnd ,(HMENU) 1, NULL, NULL); Edit1 = CreateWindow("Edit","", WS_VISIBLE|WS_CHILD|WS_BORDER|ES_MULTILINE, 170, 40, 100, 20, hWnd,(HMENU) Edit1, hInst, NULL); //CreateWindow("BUTTON", ".... ", WS_CHILD | WS_VISIBLE ,270, 190, 70 , 25,hWnd ,(HMENU) 2, NULL, NULL); hCombo = CreateWindow("combobox", "", WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST|CBS_HASSTRINGS , 10, 190, 150, 350, hWnd, 0, hInst , NULL); HANDLE hSnap; hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnap == NULL) { MessageBox(NULL,"Process not found", MB_OK, MB_ICONERROR); } PROCESSENTRY32 proc; if (Process32First(hSnap, &proc)) { SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)proc.szExeFile); while (Process32Next(hSnap, &proc)) { SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)proc.szExeFile); } } CloseHandle(hSnap); break; case WM_COMMAND: switch (wparam) { case 1: { MessageBox(NULL, Buf1 , "Выбрано", MB_OK); } /*case 2: { } break;*/ } break; case WM_SIZE: GetWindowRect(hWnd, &rc); OffsetRect(&rc, - rc.left, - rc.top); DeleteObject(hRgn); hRgn = CreateRoundRectRgn(rc.left, rc.top, rc.right, rc.bottom, (rc.right - rc.left) / 20, (rc.bottom - rc.top) / 20); SetWindowRgn(hWnd, hRgn, TRUE); break; case WM_TIMER: date = SendMessage(hCombo, CB_GETCURSEL, 0, 0L); SendMessage(hCombo, CB_GETLBTEXT, (WPARAM)date, (LPARAM)Buf1); GetWindowText(Edit1, buf, 256); pName = Buf1 ; pName1 = buf ; GetClientRect(hWnd, &rect); GetProcessByName(pName, &pID); if(pID > 0 ) { isGame = true; if(!isInjected) { Inject(pID, dll_path); isInjected = true; } } else { isGame = false; isInjected = false; } InvalidateRect(hWnd, &rect, false); break; case WM_PAINT: { hdc = BeginPaint(hWnd, &ps); hdcMem = CreateCompatibleDC(hdc); hbeMem = CreateCompatibleBitmap(hdc, width, height); hOld = SelectObject(hdcMem, hbeMem); OnPaint(hdcMem); BitBlt(hdc, 0 , 0 , width, height, hdcMem, 0, 0, SRCCOPY); //width, height SelectObject(hdcMem, hOld); DeleteObject(hbeMem); DeleteDC(hdcMem); EndPaint(hWnd, &ps); } break; default: return DefWindowProc(hWnd, msg, wparam, lparam); } } Пишу инжектор