Solved Cheat Engine & C++

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
help me on this please.

there is a tool in Cheat Engine Memory View called "FILL MEMORY"

e.g
Fill Memory from "address1" to "address8000" and fill with "0"

so it makes life easier with that tool.

but how can i make it happen in C++?

i have made some math. what i want to happen is

edit all address from "address1" to "address1+3FFF" = 0 all at once

thank you in advance hoping that you understand problem :)
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
What I'd do is go with the regular writeprocessmemory patching and use a loop to fill all the addresses between. Hope it helps :D
 
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
What I'd do is go with the regular writeprocessmemory patching and use a loop to fill all the addresses between. Hope it helps :D
but it's thousand of them? =/

here are the offsets i want to patch in my game.
actually those are walls/structures addresses.
all of those are need to be set to "0"value for the WALLHACK to work
i managed to make them work with the help if FILL MEMORY of Cheat Engine.
approximately all offsets(wall address) are about 4000+

0x40814
0x40818
0x4081c
0x40820
0x40824
0x40828
0x4082c
0x40830
0x40834
0x40838
0x4083c
0x40840
0x40844
0x40848
0x4084c
0x40850
0x40854 upto 0x80813

i am thinking about memset? can you help me with that?
i have seen a code (leeched) but it's an AutoIT code

C++:
Func _setwallhack()
   $wh=_MemoryRead($GameName+0xC7BF80,$proc,"DWORD")+0x40814;
   $test=_MemoryRead($wh,$proc,"DWORD")
   For $i=$wh to $wh+0x3ffff step 4
   	  _MemoryWrite($i,$proc,0,"DWORD")
where "wh is 0x40814" and "wh+03ffff is 0x80813"

hope you understand my explanation. im pretty new at this things. i just learned C++ in your youtube video.
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Yes, I understand :)

C++:
bool patching = true;
addy = 0x40814;

while ( patching ) 
{
writeprocessmemory addy 0 // <- you know what I mean ( patch 0 on the address of addy
addy + 4;
if ( addy == 0x80813  )
{
patching = false;
}
}
I hope you understand what I mean :D That's the loop I mentioned earlier from the back of my head, ask if you nee more help or I explained badly, I don't have a compiler right now so I can't test anything
 
Last edited:
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
so this will edit all 4 bytes address from 0x40814 to 0x80813?
and set it all to "0"?
if yes. then i should hurry home and test it
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
so this will edit all 4 bytes address from 0x40814 to 0x80813?
and set it all to "0"?
if yes. then i should hurry home and test it
It should yes :) All you have to change is the writeprocessmemory function as I provided it with wrong syntax/parameters just to show what I mean :D
 
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
Yes, I understand :)

C++:
bool patching = true;
addy = 0x40814;

while ( patching ) 
{
writeprocessmemory addy 0 // <- you know what I mean ( patch 0 on the address of addy
addy + 4;
if ( addy == 0x80813  )
{
patching = false;
}
}
I hope you understand what I mean :D That's the loop I mentioned earlier from the back of my head, ask if you nee more help or I explained badly, I don't have a compiler right now so I can't test anything
i says writeprocessmemory is undefined? i think something is missing. sorry =/
 

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
By the way here is my Code. this is a DLL Trainer

C++:
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
{
    if (ulReason == DLL_PROCESS_ATTACH)
    {
        CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Start, 0, 0, 0);
    }
    return TRUE;
}

#define WHOFF1		0x40814
#define WHOFF8000      0x80813

void Start()
{
	if (GetKeyState(VK_F5) < 0) // Wallhack
	{
	DWORD WHBase = (DWORD) GetModuleHandleA("GAMENAME.exe");
	DWORD WHADDR1 = WHBase + 0xC7CF90; // nevermind this. its the base address

	*(DWORD*)(*(DWORD*)WHADDR1 + WHOFF1) = 0;

    // so it ends here if i will define all from WHOFF1 to WHOFF8000 it will takes forever =/
		}
}
 
Last edited:

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
thank you for the response.
another question?


here's my base pointer address
C++:
DWORD ClientBase = (DWORD) GetModuleHandleA("GameClient.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;
// so this makes GameClient+C7CF90 in CheatEngine Pointer.


i used to use this code when editing memory addresses
C++:
*(DWORD*)(*(DWORD*)ClientOffset + 0x40814 ) = 0;



how can i add this another Offset
C++:
0x40814



then make is as one so i can add this as my addy below. Thank you in advance
C++:
BYTE ZERO[1] = {0x00};
WriteProcessMemory(hProcess, (PBYTE) addy, &ZERO, 2, 0);
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
If I understand correctly then you want to do something like that:

C++:
BYTE ZERO[1] = {0x0};
DWORD ClientBase = (DWORD) GetModuleHandleA("GameClient.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;

int offset2 = 0x40814; // <- thats the offset you will be changing later with the while ( patching ) loop I provided you with earlier 
int addy = clientOffset + offset2;

WriteProcessMemory(hProcess, (PBYTE) addy, &ZERO, 2, 0);
I hope that's helpful :D And I hope I didn't mess something up or did any stupdi mistakes hehe
 
  • Like
Reactions: xkhay

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
So to sum it up, it should work like this:
C++:
BYTE ZERO[1] = {0x0};

////////////////////////////////////////////////////////////////////////////////

DWORD ClientBase = (DWORD) GetModuleHandleA("GameClient.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;

int offset2 = 0x40814; // <- thats the offset you will be changing later with the while ( patching ) loop I provided you with earlier 
int addy = clientOffset + offset2;

bool patching = true;

while ( patching ) 
{
WriteProcessMemory(hProcess, (PBYTE) addy, &ZERO, 2, 0);
addy + 4;
if ( addy == ( clientOffset + 0x80813 ))
{
patching = false;
}
}
Let me know if it won't work and we'll figure it out ;)
 
Last edited:
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
i received 2 errors
C++:
BYTE ZERO[1] = {0x0};

////////////////////////////////////////////////////////////////////////////////

DWORD ClientBase = (DWORD) GetModuleHandleA("GameClient.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;
int offset2 = 0x40814; // <- thats the offset you will be changing later with the while ( patching ) loop I provided you with earlier 
int addy = ClientOffset + offset2;
bool patching = true;

while ( patching ) 
{


WriteProcessMemory(hProcess, (PBYTE) addy, &ZERO, 2, 0);
[code=cpp]: error C2065: 'hProcess' : undeclared identifier
addy + 4;
C++:
: warning C4552: '+' : operator has no effect; expected operator with side-effect
if ( addy == ( ClientOffset + 0x80813 ))
{
patching = false;
}
}
[/code]



by the way this is a DLL injected Trainer i am making
again this is my previous code.Thank You

C++:
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
{
    if (ulReason == DLL_PROCESS_ATTACH)
    {
        CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Start, 0, 0, 0);
    }
    return TRUE;
}

#define WHOFF1		0x40814
#define WHOFF8000      0x80813

void Start()
{
	if (GetKeyState(VK_F5) < 0) // Wallhack
	{
	DWORD WHBase = (DWORD) GetModuleHandleA("GAMENAME.exe");
	DWORD WHADDR1 = WHBase + 0xC7CF90; // nevermind this. its the base address

	*(DWORD*)(*(DWORD*)WHADDR1 + WHOFF1) = 0;

    // so it ends here if i will define all from WHOFF1 to WHOFF8000 it will takes forever =/
		}
}
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
You get those errors because hProcess doesn't mean anything :)

Add this before while loop for example:

C++:
HWND hWnd;
DWORD dwID;
HANDLE hProcess

GetWindowThreadProcessId(hWnd, &dwID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, dwID);
It should give you the handle to the program it's injected into, again from the back of my head :S
 
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
HTML:
addy + 4;
: warning C4552: '+' : operator has no effect; expected operator with side-effect




C++:
GetWindowThreadProcessId(hWnd, &dwID);
: warning C4700: uninitialized local variable 'hWnd' used


sorry but i think my problem cannot be solved =/
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Everything can be solved, I just realized I messed up at some points to, I've got a compiler at my hand right now, I'll get you the code asap :)
 
  • Like
Reactions: xkhay

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
ok. have you seen the image i uploaded? it easy in C.E but i`m having a hard time in a DLL Trainer in C++
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Yeah i can see the image :) I know what you meant. Try this now, it should do, just replace the window/process names:

C++:
DWORD ClientBase = (DWORD) GetModuleHandleA("GameClient.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;

HWND hWnd;
DWORD dwID;
HANDLE hProcess;
hWnd = FindWindow(NULL, L"GameCliens windowname");


GetWindowThreadProcessId(hWnd, &dwID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, dwID);
	
int toPatch = 0;
int offset1 = 0x40814;
int addy = ClientOffset + offset1;

bool patching = true;

while ( patching ) 
{

WriteProcessMemory(hProcess,(LPVOID)(addy), &toPatch, 4, NULL);
addy = addy + 0x4;

if ( addy == ( ClientOffset + 0x80813 ))
	{
	patching = false;
	}

}
 

xkhay

Newbie
Full Member
Aug 31, 2012
13
242
0
it hooks but i guess we had a wrong base.

for the record i tried this base and it works, but changes only 1 address. like my original code

C++:
DWORD ClientBase = (DWORD) GetModuleHandleA("GAMENAME.exe");
DWORD ClientOffset = ClientBase + 0xC7CF90;
DWORD GAMEBase = *(DWORD*)(ClientOffset);
DWORD addy = (DWORD)(Base+0x40814);
can you incorporate it to your code?


bacause this line confuse me.
C++:
if ( addy == ( ClientOffset + 0x80813 ))
 
Status
Not open for further replies.
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