C++ Problem

Posts 1–2 of 2 · Page 1 of 1
C++ Problem
Hey,
I made long time ago a project for hack in console.
I tried to update it,but it's doesn't work o.o

here source
Code:
#include <Windows.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <tlhelp32.h>
#include <string>
#include <fstream>
#include <Psapi.h>

#pragma comment(lib,"psapi.lib")

using namespace std;

DWORD GetProcessIdByName(WCHAR* szExeName);
bool isRunning(string pName);

DWORD addy = 0x00712801;

HANDLE hProcess = NULL;
DWORD dwProcessId = 0;
int infblock;

DWORD GetProcessIdByName(WCHAR* szExeName)
{
    PROCESSENTRY32 pe = { sizeof(PROCESSENTRY32) };
    HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

    if(Process32First(hSnapshot, &pe))
    {
        while(Process32Next(hSnapshot, &pe))
        { 
            if(!wcscmp(pe.szExeFile, szExeName))
            { 
                return pe.th32ProcessID;
            }
        }
    }

    return NULL;
}

bool isRunning(string pName)
{
 unsigned long aProcesses[1024], cbNeeded, cProcesses;
 if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
  return false;

  cProcesses = cbNeeded / sizeof(unsigned long);
   for(unsigned int i = 0; i < cProcesses; i++)
   {
    if(aProcesses[i] == 0)
   continue;

  HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);
  char buffer[50];
  GetModuleBaseNameA(hProcess, 0, buffer, 50);
  CloseHandle(hProcess);
  if(pName == string(buffer))
   return true;
  }
 return false;
}

int main()
{
	SetConsoleTitleA("xCeManx Hack");

	system("color a");

		cout <<	"Hackhackhackhack!"
			"1 = enable 0 = disable\n";

		printf("\n~Block hack ");
		scanf_s("%d", &infblock);

		cout << "\nOk, now wait for S4Client.exe ...";

  while(isRunning("S4Client.exe")==false){}

  if(infblock == 1)
  {
	  
		dwProcessId = GetProcessIdByName(L"S4Client.exe"); 

        if(dwProcessId == 0) { return 0; }

        hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwProcessId);

		DWORD Value1 = 4170025729;
		WriteProcessMemory(hProcess,(LPVOID)addy,(LPVOID)&Value1,sizeof(&Value1),NULL);


  } else if(infblock == 0){}
}
even if i delete those zero from addy
Well we would have to know which game and it sounds like you just need to get the new addresses. If you want to further your skills also try making a dll and inject it into the process so that you don't have to use WriteProcessMemory which is highly detectable and api's stick out in disassembly.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us