Need Help Making my first Hack!!
Hello MPGH,
I watched a tutorial on Youtube about memory hacking using c++ . I tried making a hack for MW3, but get alot of errors in cout, cerr, clog and some other stuff, Please help me @Jorndel @master131 and anyone who can help. Thanks Im waiting for your reply ppl.
Source Code
#include <iostream>
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
// FindWindow();
// GetWindowThreadProcessId();
// OpenProcess();
// WriteProcessMemory();
// CloseHandle();
using namespace std;
int main()
{
int Score;
cout<<"Welcome to oTrainer v1 @MPGH.net \n";
cout<<"Features: \n";
cout<<"Score Hack \n";
cout<<"Enter the Score you want: ";
cin>> Score;
cin.ignore();
HWND hWnd = FindWindow(0, "Call of Duty®: Modern Warfare® 3 Multiplayer");
if (hWnd == 0) {
cerr << "Cannot find window." << endl;
} else {
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
if (!hProc) {
cerr << "Cannot open process." << endl;
} else {
int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x000AFCC4, &Score, (DWORD)sizeof(Score), NULL);
if (isSuccessful > 0) {
clog << "Process memory written." << endl;
} else {
cerr << "Cannot write process memory." << endl;
}
CloseHandle(hProc);
}
}
return 0;
}
OUTPUT
1>------ Build started: Project: Mw3, Configuration: Release Win32 ------
1> Mw3.cpp
1>Mw3.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>Mw3.cpp(25): error C2065: 'cout' : undeclared identifier
1>Mw3.cpp(27): error C2065: 'cout' : undeclared identifier
1>Mw3.cpp(28): error C2065: 'cout' : undeclared identifier
1>Mw3.cpp(29): error C2065: 'cout' : undeclared identifier
1>Mw3.cpp(30): error C2065: 'cout' : undeclared identifier
1>Mw3.cpp(32): error C2065: 'cin' : undeclared identifier
1>Mw3.cpp(33): error C2065: 'cin' : undeclared identifier
1>Mw3.cpp(33): error C2228: left of '.ignore' must have class/struct/union
1> type is ''unknown-type''
1>Mw3.cpp(35): error C2664: 'FindWindowW' : cannot convert parameter 2 from 'const char [45]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Mw3.cpp(41): error C2065: 'cerr' : undeclared identifier
1>Mw3.cpp(41): error C2065: 'endl' : undeclared identifier
1>Mw3.cpp(55): error C2065: 'cerr' : undeclared identifier
1>Mw3.cpp(55): error C2065: 'endl' : undeclared identifier
1>Mw3.cpp(65): error C2065: 'clog' : undeclared identifier
1>Mw3.cpp(65): error C2065: 'endl' : undeclared identifier
1>Mw3.cpp(69): error C2065: 'cerr' : undeclared identifier
1>Mw3.cpp(69): error C2065: 'endl' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========