Source Code Internal Assault Cube Hack

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

FloppyWhale

Jr.Coder
Full Member
Nobleman
Jan 12, 2015
65
308
0
Hi guys! Whilst learning how to hook, thanks to Rake for basically almost everything, I made a VERY SIMPLE hack. I'm releasing the source here so maybe others can learn? Anyhow, I hope y'all enjoy!

Source :
C++:
#include <Windows.h>
#include <iostream>

#pragma comment(lib, "lib\\detours.lib")
#include "include\detours.h"

struct Player
{
	DWORD baseAddress = 0x50F4F4;
	DWORD health = 0xF8;
	DWORD armour = 0xFC;
}myPlayer;


//T = Typedef/Template | O = original | H = Hacked/Hooked (We put our codenz here :3)
typedef BOOL(__stdcall * twglSwapBuffers) (_In_ HDC hDc);
twglSwapBuffers owglSwapBuffers;

BOOL __stdcall hwglSwapBuffers(_In_ HDC hDc)
{
	//Hack stuff in here
	*(DWORD*)(myPlayer.baseAddress + myPlayer.health) = 999;
	*(DWORD*)(myPlayer.baseAddress + myPlayer.armour) = 999;

	return owglSwapBuffers(hDc);
}

//Detours the OpenGL SwapBuffers function
void HookSwapBuffers()
{
	HMODULE hMod = GetModuleHandle(L"opengl32.dll");
	if (hMod)
	{
		owglSwapBuffers = (twglSwapBuffers)(DWORD)GetProcAddress(hMod, "wglSwapBuffers");
		DetourTransactionBegin();
		DetourUpdateThread(GetCurrentThread());
		DetourAttach(&(PVOID &)owglSwapBuffers, hwglSwapBuffers);
		DetourTransactionCommit();
	}
}

BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved)
{
	switch (fdwReason)
	{
	case DLL_PROCESS_ATTACH:
		HookSwapBuffers();
	}
	return TRUE;
}
Also, I'll take any suggestions, tips you may have for me!
Again, credit for 99% of this goes to rake for helping me with how to hook!
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,140
78,998
2,394
aaaawww hell yeah I'm glad you got it to work!
 
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