I'm trying to expand my C++ game hacking skills as when I was starting (2 years ago) I made a bad decision: continue in game hacking with vb.net instead of learning c++ (as I had some vb.net knowledge and 0 knowledge with other languages)
So, now as the very first steps I have to create my toolkit, where I will be using my own templates:
- Nathalib.h (my template with all common functions for game hacking).
#pragma once
#include <iostream>
#include <Windows.h>
#include <string>
#include <TlHelp32.h>
#include <stdio.h>
using namespace std;
DWORD ProcessID;
int FindProcessByName(string name)
{
    HWND hwnd = FindWindowA(0, name);
    GetWindowThreadProcessId(hwnd, &ProcessID);
    if (hwnd)
    {
        return ProcessID;
    }
    else
    {
        return 0;
    }
}
- Hack.cpp (obviously the cheat, will be different for every game).
#pragma once
#include "pch.h"
#include <iostream>
#include <Windows.h>
#include <string>
#include <Nathalib.h>
using namespace std;
int main()
{
  While(True)
  {    
    cout << FindProcessByName("Calculator") << endl;
    getchar();
    cout << "-----------------------------------" << endl << endl;
  }
  return 0;
}
- Target.cpp (as we're not bad boys, I must provide my own target).
#include "pch.h"
#include <iostream>
#include <Windows.h>
#include <string>
using namespace std;
#define CHAR_ARRAY_SIZE 128
int main()
{
    int varInt = 123456;
    string varString = "DefaultString";
    char arrChar[CHAR_ARRAY_SIZE] = "Long char array right there ->";
    int * ptr2int;
    ptr2int = &varInt;
    int ** ptr2ptr;
    ptr2ptr = &ptr2int;
    int *** ptr2ptr2;
    ptr2ptr2 = &ptr2ptr;
    while(True) {
        cout << "Process ID: " << GetCurrentProcessId() << endl;
        cout << "varInt (0x" << &varInt << ") = " << varInt << endl;
        cout << "varString (0x" << &varString << ") = " << varString << endl;
        cout << "varChar (0x" << &arrChar << ") = " << arrChar << endl;
        cout << "ptr2int (0x" << hex << &ptr2int << ") = " << ptr2int << endl;
        cout << "ptr2ptr (0x" << hex << &ptr2ptr << ") = " << ptr2ptr << endl;
        cout << "ptr2ptr2 (0x" << hex << &ptr2ptr2 << ") = " << ptr2ptr2 << endl;
        cout << "Press ENTER to print again." << endl;
        getchar();
        cout << "-----------------------------------" << endl << endl;
    }
    return 0;
}
I don't know why the header file is not being recognized.
- This is the correct way to include header files? Should I create a namespace/class/object for calling it?
- It's the correct way creating a header file? Or I should create another kind of project/resource for this purpose?
- How should I call my library methods? Like LibraryName.MethodName?
I just come from other languages and some ideas/features are not available in the other languages (that's why I'm interested in this one)
If there's something I forgot to add, please tell me and I will update
Thanks
 
     
     
     
    