Codice:
#include <windows.h>
#include <iostream>
int main()
{
if (HWND hWnd = FindWindow(0, "METIN2"))
{
MessageBox(0, "Devi prima aprire il gioco Noob", "Error!", MB_OK + MB_ICONERROR);
}
else
{
DWORD proc_id;
GetWindowThreadProcessId(hWnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
if(!hProcess)
{
MessageBox(NULL, "Non e' possibile attacare il processo", "Error!", MB_OK + MB_ICONERROR);
}
else
{
BYTE newdata[]={0x89, 0x81, 0xdc, 0x03, 0x00, 0x00};
DWORD newdatasize = sizeof(newdata);
if(WriteProcessMemory(hProcess, (LPVOID)0x004eb193, &newdata, newdatasize, NULL))
{
MessageBox(NULL, "Memoria scritta con successo!", "Successo!", MB_OK + MB_ICONINFORMATION);
}
else
{
MessageBox(NULL, "Scrittura fallita!", "Error!", MB_OK + MB_ICONERROR);
}
CloseHandle(hProcess);
}
}
}
L'ho fatto con Dev-c++ 4.9.9.2
Il problema è che anche se la finestra di metin2 è aperta, non me la rileva, e non rivela manco il proc_id.
Chi mi aiuta?