SolvedNeed Help Making my first Hack!!

Posts 1–6 of 6 · Page 1 of 1
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
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
Code:
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 ==========
Quote Originally Posted by Gam3r007 View Post
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
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
Code:
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 ==========
Erm, you sure you use right debugger ?
(Not Visual Studio etc)

I might look on it, when I'm done playing
Quote Originally Posted by Jorndel View Post


Erm, you sure you use right debugger ?
(Not Visual Studio etc)

I might look on it, when I'm done playing
Im using Microsoft Visual C++ 2010 Express, Can I add you in game?
Quote Originally Posted by Gam3r007 View Post
Im using Microsoft Visual C++ 2010 Express, Can I add you in game?
I used: Dec-C++
Here is the code that I used based on yours: (Works)
Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <stdio.h>

using namespace std;

int main(int argc, char *argv[])
{
    int Score = 3;
    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 {

            cerr<<"Set your Score: ";
            cin>>Score;
            int isSuccessful = WriteProcessMemory(hProc,(LPVOID)0x1DB8BD0,&Score,sizeof(Score),NULL);

 

            if (isSuccessful > 0) {

                clog << "Process memory written." << endl;

            } else {

                cerr << "Cannot write process memory." << endl;

            }

 

            CloseHandle(hProc);

        }

    }
    system("PAUSE");
    return EXIT_SUCCESS;
}


Mostly like that |Microsoft Visual C++ 2010 Express| caused the problems here :|
Quote Originally Posted by Jorndel View Post


I used: Dec-C++
Here is the code that I used based on yours: (Works)
Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <stdio.h>

using namespace std;

int main(int argc, char *argv[])
{
    int Score = 3;
    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 {

            cerr<<"Set your Score: ";
            cin>>Score;
            int isSuccessful = WriteProcessMemory(hProc,(LPVOID)0x1DB8BD0,&Score,sizeof(Score),NULL);

 

            if (isSuccessful > 0) {

                clog << "Process memory written." << endl;

            } else {

                cerr << "Cannot write process memory." << endl;

            }

 

            CloseHandle(hProc);

        }

    }
    system("PAUSE");
    return EXIT_SUCCESS;
}


Mostly like that |Microsoft Visual C++ 2010 Express| caused the problems here :|
Thnx man, It worked, your amazing!!!
Quote Originally Posted by Gam3r007 View Post
Thnx man, It worked, your amazing!!!
No Problem. ( I don't even code in C++ :|)

/Solved
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us