Solved Help with this Code

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

fiox

Newbie
Full Member
Oct 14, 2012
9
232
Visit site
0
Don't be harsh on me, I'm new to C++, I only learned C so far, so i tried to Adapt the AssaultCube code to another game though I'm having problems with LGameWindow.

C++:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>
void WriteToMemory(HANDLE hProcHandle);
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);

std::string GameName = "CABAL";
LPCSTR LGameWindow = "CABAL";
std::string GameStatus;

bool GameAvail;
bool UpdateOnNextRun;

//Combo Vars
bool ComboStatus;
BYTE ComboValue[] = {0x1, 0x1, 0x0, 0x0};
DWORD ComboBaseAdress = {0x065347E8};
DWORD ComboOffsets[] = {0x73B0};

int main()
{
	HWND hGameWindow = NULL;
	int timeSinceLastUpdate = clock();
	int GameAvailTMR = clock();
	int onePressTMR = clock();
	DWORD dwProcID = NULL;
	HANDLE hProcHandle = NULL;
	UpdateOnNextRun = true;
	std::string sComboStatus = "OFF";

	while(!GetAsyncKeyState(VK_INSERT))
	{
		if(clock() - GameAvailTMR > 100)
		{
			GameAvailTMR = clock();
			GameAvail = false;

			hGameWindow = FindWindow(NULL, LGameWindow);
and it gives me this error,
error C2664: 'FindWindowW' : cannot convert parameter 2 from 'LPCSTR' to 'LPCWSTR'
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
Australia
Visit site
1
Hey fiox, you have two choices you can either change the character settings in the project ("View" -> "Property Pages" -> "Configuration Properties" -> "General") and set the "Character Set" to "Use Multi-Byte Character Set"

or change

LPCSTR LGameWindow = "CABAL";
to
WCHAR LGameWindow[] = L"CAREL";

good luck =)
 
Last edited:

fiox

Newbie
Full Member
Oct 14, 2012
9
232
Visit site
0
Hey fiox, you have two choices you can either change the character settings in the project ("View" -> "Property Pages" -> "Configuration Properties" -> "General") and set the "Character Set" to "Use Multi-Byte Character Set"

or change

LPCSTR LGameWindow = "CABAL";
to
WCHAR LGameWindow[] = L"CAREL";

good luck =)
THanks a lot, it's working :D.
 

fiox

Newbie
Full Member
Oct 14, 2012
9
232
Visit site
0
Having a new problem though, this time with the Hex's I think,
I have the right code and offset since I used the same codes from a working CheatEngine Table,
However I'm supposed to be able to freeze it at value 0, Though I duno how I assign a 0 in Hex.

I tried in a few ways,
C++:
//Combo Vars
bool ComboStatus;
BYTE ComboValue[] = {0x0, 0x00, 0x00, 0x00};
DWORD ComboBaseAdress = {0x00B8BBF0};
DWORD ComboOffsets[] = {0x7384};
Crash
C++:
//Combo Vars
bool ComboStatus;
BYTE ComboValue[] = {0x13, 0x53, 0x53, 0x53};
DWORD ComboBaseAdress = {0x00B8BBF0};
DWORD ComboOffsets[] = {0x7384};
Doesn't Crash, but doesn't work either
C++:
//Combo Vars
bool ComboStatus;
BYTE ComboValue[] = {0xA3, 0x0, 0x0, 0x0};
DWORD ComboBaseAdress = {0x00B8BBF0};
DWORD ComboOffsets[] = {0x7384};
Crash


Full code below if it helps,

C++:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>
void WriteToMemory(HANDLE hProcHandle);
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);

std::string GameName = "CABAL";
LPCSTR LGameWindow = "CABAL";
std::string GameStatus;

bool GameAvail;
bool UpdateOnNextRun;

//Combo Vars
bool ComboStatus;
BYTE ComboValue[] = {0x13, 0x53, 0x53, 0x53};
DWORD ComboBaseAdress = {0x00B8BBF0};
DWORD ComboOffsets[] = {0x7384};

int main()
{
	HWND hGameWindow = NULL;
	int timeSinceLastUpdate = clock();
	int GameAvailTMR = clock();
	int onePressTMR = clock();
	DWORD dwProcID = NULL;
	HANDLE hProcHandle = NULL;
	UpdateOnNextRun = true;
	std::string sComboStatus = "OFF";

	while(!GetAsyncKeyState(VK_INSERT))
	{
		if(clock() - GameAvailTMR > 100)
		{
			GameAvailTMR = clock();
			GameAvail = false;

			hGameWindow = FindWindow(NULL, LGameWindow);
			if(hGameWindow)
			{
				GetWindowThreadProcessId( hGameWindow, &dwProcID);
				if(dwProcID != 0)
				{
					hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
					if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
					{
						GameStatus = " Failed to Open Process for valid handle";
					}
					else
					{
						GameStatus = " Cabal Ready To Hack";
						GameAvail = true;
					}
				}
				else
				{
						GameStatus = " Failed to get Process ID";

				}
			}
			else
			{
				 GameStatus = " CABAL NOT FOUND";
			}


			if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000)
			{
				system("cls");
				std::cout << "-----------------------------------------------------------" << std::endl;
				std::cout << "		Cabal Combo Hack" << std::endl;
				std::cout << "-----------------------------------------------------------" << std::endl << std::endl;
				std::cout << "GAME STATUS:" << GameStatus << std::endl << std::endl;
				std::cout << "[F1] Perfect Combo -> " << sComboStatus << " <- " << std::endl << std::endl;
				std::cout << "[INSTER] Exit" << std::endl;
				UpdateOnNextRun = false;
				timeSinceLastUpdate = clock();
			}

			if(GameAvail)
			{
				//Write to memory
				WriteToMemory(hProcHandle);
			}
		}

		if(clock() - onePressTMR > 400)
		{
			if(GameAvail)
			{
				//Ammo
				if(GetAsyncKeyState(VK_F1))
				{
					onePressTMR = clock();
					ComboStatus =! ComboStatus;
					UpdateOnNextRun = true;
					if(ComboStatus)sComboStatus = "ON";
					else sComboStatus = "OFF";
				}
			}
		}
	}
	return ERROR_SUCCESS;

}

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
	DWORD pointer = BaseAddress;
	DWORD pTemp;
	DWORD pointerAddr;
	for(int c = 0; c < PointerLevel; c++)
	{
		if(c == 0)
		{
			ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
		}
		pointerAddr = pTemp + Offsets[c];
		ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(pTemp), NULL);
	}
	return pointerAddr;
}

void WriteToMemory(HANDLE hProcHandle)
{
	DWORD AddressToWrite;
	if(ComboStatus)
	{
		AddressToWrite = FindDmaAddy(3,hProcHandle, ComboOffsets, ComboBaseAdress);
		WriteProcessMemory(hProcHandle,(BYTE*)AddressToWrite, &ComboValue,sizeof(ComboValue),NULL);
	}
}
 
Last edited:

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
Australia
Visit site
1
I think the problem is down in WriteToMemory

AddressToWrite = FindDmaAddy(3, hProcHandle, ComboOffsets, ComboBaseAdress);
should probably be
AddressToWrite = FindDmaAddy(1, hProcHandle, ComboOffsets, ComboBaseAdress); // you could also put sizeof(ComboOffsets)
because the pointer level is only one

the address and offsets should be

BYTE ComboValue[] = {0, 0, 0, 0};
DWORD ComboBaseAdress = 0x00B8BBF0;
DWORD ComboOffsets[] = {0x73A1};

if i read FindDmaAddy correctly
 

fiox

Newbie
Full Member
Oct 14, 2012
9
232
Visit site
0
I think the problem is down in WriteToMemory

AddressToWrite = FindDmaAddy(3, hProcHandle, ComboOffsets, ComboBaseAdress);
should probably be
AddressToWrite = FindDmaAddy(1, hProcHandle, ComboOffsets, ComboBaseAdress); // you could also put sizeof(ComboOffsets)
because the pointer level is only one

the address and offsets should be

BYTE ComboValue[] = {0, 0, 0, 0};
DWORD ComboBaseAdress = 0x00B8BBF0;
DWORD ComboOffsets[] = {0x73A1};

if i read FindDmaAddy correctly
Thanks working now :)
 

fiox

Newbie
Full Member
Oct 14, 2012
9
232
Visit site
0
I do have a questions though, its about the values, what if I wanted to freeze the value at 1629697 how would I do it in the Combo Value part?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts