Solved How to find dynamic dll address?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

cruzz

Newbie
Sep 14, 2015
3
314
0
Hello guys ... I coded a bunnyhop scipt for CS:GO ... its working but not FUD cause i coded it just for learning purpose.

C++:
#include <iostream>
#include <Windows.h>
#include <stdio.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <stdlib.h>
#include <sstream>
#include <string>
using namespace std;
DWORD_PTR dwGetModuleBaseAddress(DWORD pId, TCHAR *szModuleName);

int inairoff = 0x100;
int jumpoff = 0x100;
int jump = 5;
int notjump = 4;
#define SPACE_BAR 0x20
DWORD clientdll;

int main()
{
HWND hWnd = FindWindow(NULL, "Counter-Strike: Global Offensive");
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);

dwGetModuleBaseAddress(pId, _T("client.dll"));

int inair = clientdll+0x04AC8A10;
int jumpnow = clientdll+0x294028;
DWORD inairadd1;
ReadProcessMemory(hProc,(LPVOID)inair, &inairadd1, (DWORD)sizeof(inairadd1), NULL);
DWORD inairadd2 = inairadd1 + inairoff;
DWORD inairadd3;
ReadProcessMemory(hProc,(LPVOID)inairadd2, &inairadd3, (DWORD)sizeof(inairadd3), NULL);
bool running = true;
bool bhop = false;
DWORD jumpadd1;
ReadProcessMemory(hProc,(LPVOID)jumpnow, &jumpadd1, (DWORD)sizeof(jumpadd1), NULL);
DWORD jumpadd2 = jumpadd1 + jumpoff;
while(running == true)
{
if(GetAsyncKeyState(SPACE_BAR)&0x1)
{
bhop = !bhop;
}
if(bhop == true && inairadd3 == 257)
{
DWORD inairadd3;
ReadProcessMemory(hProc,(LPVOID)inairadd2, &inairadd3, (DWORD)sizeof(inairadd3), NULL);
WriteProcessMemory(hProc,(LPVOID)jumpadd2, &jump, (DWORD)sizeof(jump), NULL);
Sleep(5);
WriteProcessMemory(hProc,(LPVOID)jumpadd2, &notjump, (DWORD)sizeof(jump), NULL);
Sleep(5);
}
}
}



//get the base clientdll address
DWORD_PTR dwGetModuleBaseAddress(DWORD pId, TCHAR *szModuleName)
{
    DWORD_PTR dwModuleBaseAddress = 0;
    HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pId);
    if (hSnapshot != INVALID_HANDLE_VALUE)
    {
        MODULEENTRY32 ModuleEntry32;
        ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
        if (Module32First(hSnapshot, &ModuleEntry32))
        {
            do
            {
                if (_tcsicmp(ModuleEntry32.szModule, szModuleName) == 0)
                {
                    clientdll = (DWORD_PTR)ModuleEntry32.modBaseAddr;
                    break;
                }
            } while (Module32Next(hSnapshot, &ModuleEntry32));
        }
        CloseHandle(hSnapshot);
    }
    return clientdll;
}
My problem is... The "client.dll" address is dynamic, it changes every time I restart CS:GO. I watched Fleeps tutorials. But he is using "hackprocess.h" or something like this.

My question is how to scan the game for the "client.dll" address in C++. (or if there is a simpler variant, which one?)

Cheerio!
cruzz_
 
Last edited by a moderator:

keybode

Newbie
Sep 19, 2012
2
329
2
or external:
C++:
#include <windows.h>
#include <tlhelp32.h>
#include <string>

uintptr_t GetModuleHandleEx( DWORD dwProcessId, const std::string& szName )
{
	HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId );
	
	if( hSnapshot == INVALID_HANDLE_VALUE )
		return 0;
	
	MODULEENTRY32 me32 = { 0 };
	
	me32.dwSize = sizeof( MODULEENTRY32 );
	
	if( !Module32First( hSnapshot, &me32 ) )
	{
		CloseHandle( hSnapshot );
		return 0;
	}
	
	do
	{
		if( szName.compare( me32.szModule ) == 0 )
		{
			CloseHandle( hSnapshot );
			return ( uintptr_t )me32.modBaseAddr;
		}
	}
	while( Module32Next( hSnapshot, &me32 ) );
	
	CloseHandle( hSnapshot );
	
	return 0;
}
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Internal:
C++:
DWORD dwClientBase = (DWORD) GetModuleHandleA((LPCSTR)"client.dll");
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
I use GetModuleHandle() for internal hacks and CreateToolhelp32Snapshot for external hacks
 
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