Solved I need help on OpenGL hook

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

BadCoder

Newbie
Full Member
Oct 29, 2015
11
118
0
Hey guys !

Basicaly, for my first project i'm making an Assault Cube hack. The main logic is quite done now but i still dont have a nice menu for it. So i was thinking about hooking OpenGL to draw my menu.
First, i used WiTH's OpenGL Hook, supposed to be used for CS. Here is the result : https://youtu.be/rmS7V4xAs14 As you can see, i get the right white rectangle, but there are more rectangles drawn ( in black this time ? ), for example for each player on the minimap. So i thought "Hey ! glEnable must be called multiple times" After that, i tried to hook to swapbuffers ( after looking at RektCube source ) and at this point the game dont even start , it crash.

So finaly, if anyone have an idea, or something i can get start with, i would be happy :p
Sorry for my poor English and thx for futur help ?
 
Last edited:

speedy

Newbie
May 10, 2015
4
97
1
..After that, i tried to hook to swapbuffers ( after looking at RektCube source ) and at this point the game dont even start , it crash.
Maybe it crashed because you used a fixed detours length/wrong value? Try ms detours swapbuffers hook:
C++:
#include <windows.h>
#include <gl/gl.h> 
#include "detours/detours.h" //detours 3.0
#pragma comment(lib, "detours/detours.lib")


typedef BOOL(__stdcall * twglSwapBuffers) (_In_ HDC hDc);
twglSwapBuffers owglSwapBuffers;

BOOL __stdcall hwglSwapBuffers(_In_ HDC hDc)
{
	//draw menu
	return owglSwapBuffers(hDc);
}

void HookOGL()
{
	HMODULE hMod = GetModuleHandle(L"opengl32.dll");

	if (hMod)
	{
		owglSwapBuffers = (twglSwapBuffers)(DWORD)GetProcAddress(hMod, "wglSwapBuffers");

		DetourTransactionBegin();
		DetourUpdateThread(GetCurrentThread());
		DetourAttach(&(PVOID &)owglSwapBuffers, hwglSwapBuffers);
		DetourTransactionCommit();
	}
}

BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, _In_opt_ LPVOID Reserved)
{
	switch (Reason)
	{
		case DLL_PROCESS_ATTACH:
			DisableThreadLibraryCalls(hInstance);
			CreateThread(0, 0, (LPTHREAD_START_ROUTINE)HookOGL, 0, 0, 0);
			break;
		case DLL_THREAD_ATTACH:
			break;
		case DLL_PROCESS_DETACH:
			break;
		case DLL_THREAD_DETACH:
			break;
	}
	return TRUE;
}
 
Last edited:
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