Solved DLL injection read/write memory

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Hey guys,

I am really new to game hacking and I only made external ones so far. Now I tryed to create an internal trainier for Little Fighter 2.

I found this static adress for my health:
00458C94 + 2fc


This is the code I came up with. I think the problem is that I missunderstood basics off dll injection :/
The code does literally nothing..

C++:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>


BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
switch (reason)
    {
      case DLL_PROCESS_ATTACH:
			
			//WriteMemory (Set Life to 5)
			*(int*)(0x458C94 + 0x2fc = 5;
			
			//Just check to see if its working **WORKS**
			//MessageBox (0, "Work!", "Semms like I", MB_ICONINFORMATION);
		break;

    } 
    return TRUE;
}
I am pretty sure, that there acutally is an easy answer to my quesiton and I'm sorry for asking so stupid..
Excuse me for confusing myself that much.

Looking forward to any help :)
 
Last edited:

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Tryed both of ur solutions. First of all they will not compile :D

C++:
*(int)(((0x458C94) + 0x2fc) = 5;
besided that was one bracket to much/less, it says error C2100: illegal indirection and error C2106: '=' : left operand must be l-value.
I tryed to play arround with it, made it compile, but it didn't do anything..


C++:
DWORD TMP = *(DWORD*)(0x458C94);
*(int*)(DWORD + 0x2FC) = 5;
Same goes for this one.. :(
Any idea why this is happening?

Thanks for trying to help me :)


i Meant to say the following[sorry still half asleep when i wrote last message it was all wrong :L]:
C++:
DWORD TMP = *(DWORD*)(0x458C94);
*(int*)(TMP + 0x2FC) = 5;
TMP isntead of DWORD :L

C++:
*(int*)(0x458C94 + 0x2fc) = 5;
C++:
*(int*)((0x458C94) + 0x2fc) = 5;
heres some of my old work internal: https://guidedhacking.com/showthread.php?4750-CS-GO-Internal-Triggerbot
 
Last edited:

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Hey guys,

I am really new to game hacking and I only made external ones so far. Now I tryed to create an internal trainier for Little Fighter 2.

I found this static adress for my health:
00458C94 + 2fc


This is the code I came up with. I think the problem is that I missunderstood basics off dll injection :/
The code does literally nothing..

C++:
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>


BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
{
switch (reason)
    {
      case DLL_PROCESS_ATTACH:
			
			//WriteMemory (Set Life to 5)
			*(int*)(0x458C94 + 0x2fc = 5;
			
			//Just check to see if its working **WORKS**
			//MessageBox (0, "Work!", "Semms like I", MB_ICONINFORMATION);
		break;

    } 
    return TRUE;
}
I am pretty sure, that there acutally is an easy answer to my quesiton and I'm sorry for asking so stupid..
Excuse me for confusing myself that much.

Looking forward to any help :)
Close.

try:

C++:
*(int)(((0x458C94) + 0x2fc) = 5;
or

C++:
DWORD TMP = *(DWORD)(0x458C94);
*(int)(DWORD + 0x2FC) = 5;
been awhile since i worked on anything internally but one of those should work :)
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Tryed both of ur solutions. First of all they will not compile :D

C++:
*(int)(((0x458C94) + 0x2fc) = 5;
besided that was one bracket to much/less, it says error C2100: illegal indirection and error C2106: '=' : left operand must be l-value.
I tryed to play arround with it, made it compile, but it didn't do anything..


C++:
DWORD TMP = *(DWORD)(0x458C94);
*(int)(DWORD + 0x2FC) = 5;
Same goes for this one.. :(
Any idea why this is happening?

Thanks for trying to help me :)
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
i Meant to say the following[sorry still half asleep when i wrote last message it was all wrong :L]:
C++:
DWORD TMP = *(DWORD*)(0x458C94);
*(int*)(TMP + 0x2FC) = 5;
TMP isntead of DWORD :L
Saw the TMP mistake myself, thats what I meant with playign arround :p Works like a charm now.
I also took a look at your internal Triggerbot before :D
Nether you're da real MVP :cool:
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Turns out I accidently have two accounts for this site :/ you can delete "Komisch" if you like to..

Im trying it now on League Of Legends. I want to read te process memory after I injected my dll to it.


C++:
This is my attempt:

//Offsets for Health
//Offset 1: 0xfc
//Offset 2: 0x54

//Base: League of Legends.exe"+ 0x2A27B94


			DWORD BASE = *(DWORD*)("League of Legends.exe"+ 0x2A27B94); 
			DWORD TMP = *(DWORD*)(BASE + 0xfc);
			int Health = *(int*)(TMP2 + 0x54) ;
It only crashes the game. I tryed to play arround with it.. the best I could make it was 0 as a resoult. Everything else crashes.
The Addresses are correct.

Can anyone solve my problem? :)
 
Last edited:

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
"League of Legends.exe" doesn't work as an address in a C++ source.
Start Cheat Engine and attach it to LoL. Then click "Add Address Manually" and type in "League of Legends.exe" as address.
Click "OK" and look at the new entry in the addresslist. There you can see the base address of the process.
Let's say the base is 0x400000.
Then your code would be:
C++:
DWORD dwBase=0x400000+0x2A27B94;
DWORD dwOffset[]={0xfc,0x54};
int Health=*(int*)(*(DWORD*)(*(DWORD*)Base+dwOffset[0])+dwOffset[1]);
Add Adress Manually -> League of Legends.exe -> TYPE 4 Bytes ?? And then show as hexademical?
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Yes, a DWORD. The address is in HEX automatically.
Okay so I found 9460301

->

DWORD dwBase=0x9460301+0x2A27B94;
DWORD dwOffset[]={0xfc,0x54};
int Health=*(int*)(*(DWORD*)(*(DWORD*)dwBase+dwOffset[0])+dwOffset[1]);

Crashes :(
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Are you sure 9460301 is the thing it says in the column "Address"? The base of the process is the number in the column "Address".
Also this code is ugly coded.

C++:
DWORD dwBase=ProcessBase+0x2A27B94;
DWORD dwOffset[]={0xfc,0x54};
DWORD buffer=*(DWORD*)dwBase;
int HP;
if(buffer){
     buffer=*(DWORD*)(buffer+dwOffset[0]);
     if(buffer){
          HP=*(int*)(buffer+dwOffset[1]);
     }
}
Step 1 (I used the LolLauncher.exe for example):
https://puu.sh/ad0UH/e4622344fb.png
Step 2:
https://puu.sh/ad145/ae493616cd.png
Thanks for the mini tutorial :) Got that now. Do I have to do this every time, since it changes each time i restart the game.
Also it does not crash anymore, but the value is wrong. This is ur code with my output. (Just want to make sure, that its not my output ruining everything.



C++:
DWORD WINAPI MainLoop(LPVOID lpParam)
{
	bool datei_geschrieben = false;


    while (true)
    {
		if (GetAsyncKeyState(0x20))
		{

			DWORD dwBase=0xE40000+0x2A27B94;
			DWORD dwOffset[]={0xfc,0x54};
			DWORD buffer=*(DWORD*)dwBase;
			
			int HP;
			
			if(buffer)
			{
				buffer=*(DWORD*)(buffer+dwOffset[0]);
				
				if(buffer)
				{
					HP=*(int*)(buffer+dwOffset[1]);
				}
			}

			std::fstream file;
			file.open("Health.txt", std::ios::out);
			file << HP;
			file.close();
			datei_geschrieben = true;
		  }
            Sleep(1000);
		}
	return TRUE;
	}
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
C++:
#include <Windows.h>
#include <process.h>
#include <iostream>

void GetHP(void*);

int __stdcall DllMain(HINSTANCE hDll,DWORD dwReason,LPVOID lpReserved)
{
	DisableThreadLibraryCalls(hDll);
	if(dwReason==DLL_PROCESS_ATTACH){
		AllocConsole();
		freopen("CONOUT$","w",stdout);
		_beginthread(&GetHP,sizeof(&GetHP),NULL);
	}
	return 1;
}

void GetHP(void*)
{
	while(true){
		DWORD dwProcessBase=(DWORD)GetModuleHandle(NULL);
		DWORD dwBaseAddress=dwProcessBase+0x2A27B94;
		DWORD buffer=*(DWORD*)dwBaseAddress;
		DWORD dwOffsets[]={0xfc,0x54};
		int HP=0;
		if(buffer){
			buffer=*(DWORD*)(buffer+dwOffsets[0]);
			if(buffer){
				HP=*(int*)(buffer+dwOffsets[1]);
			}
		}
		std::cout<<HP<<std::endl;
	}
}
Here you go. I made a simple console version since it's easy to debug.

Thanks mate! :) Works perfect now. :D
 

Nether

The Angel Of Verdun
Meme Tier VIP
Dank Tier Donator
Dec 11, 2013
293
3,738
16
Thanks mate! :) Works perfect now. :D
you would be much better off in the long run using my external C++ memory class it has everything you could possibly ever need : https://guidedhacking.com/showthread.php?5093-Nether-s-C-Memory-Class-V1-6-10 and more check it out.

I wish more people would spread the word of my memory class around it really is useful and can be upgraded with basic polymorphism to be undetected in so many ways!

All you would need to do would be this:

C++:
#include "ProcMem.h"

using namespace std;

int main(){

ProcMem Object;

Object.Process("GameName.exe");
DWORD Base = Object.Module("GameName.exe");

Object.Write<int>(Base+Offset, Value); // this is equivlent of Game.exe+0ffset



return 0;
}
 
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