Wrote this class tonight. Its like other TLS hooks with some important improvements:
- finds offsets automatically
- extended functionality to hook gl functions TLS doesn't contain (i.e. glViewport, glFinish etc.. 50-150+ funcs can't remember clearly)
- already built in functionality to remove hooks
other features:
- Undetected by all? anti-cheats.
- Will hook opengl in any application/game
Edit: made a change, no longer finds the main thread (wasn't a great method). You should call GLInit from inside the main game thread (e.g inside a hook thats being called by the game thread) not your own DllMain if you have injected with a thread method.
Example Usage - Code:
-
CGLHook glhook;
typedef void (__stdcall *glFinish_t)();
glFinish_t o_glFinish;
void __stdcall h_glFinish()
{
MessageBox(0, "glFinish hooked!", 0, 0);
o_glFinish();
}
// after the main game thread is created (leave 8seconds after your dllMain is called or more to be safe)
if(glhook.Init())
{
o_glFinish = (glFinish_t) glhook.Hook("glFinish", h_glFinish);
}
and to unhook:
- Code:
-
glhook.UnHook("glFinish", o_glFinish);
Click Here to Download