Solved Clear anticheat screenshot

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
I'm trying to clear the screenshot of an anticheat, the anticheat uses the glReadPixels function, the visual functions only close after the print

C++:
void WINAPI hook_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
{
clearss:
		g_AntiScreen.DrawVisuals = false;
		g_AntiScreen.bBlocked = true;
			
		if (!g_AntiScreen.DrawVisuals)
			return oReadPixels(x, y, width, height, format, type, pixels);
		else
			goto clearss;
}
in my main:
C++:
if(!g_AntiScreen.time_scr)
	g_AntiScreen.time_scr = GetTickCount();

if (g_AntiScreen.bBlocked && GetTickCount() - g_AntiScreen.time_scr > 500)
{
	g_AntiScreen.DrawVisuals = true;
	g_AntiScreen.bBlocked = false;
        g_AntiScreen.time_scr = 0;
}
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
Your DrawVisuals() code is in a hook like glEnd() or glSwapBuffers()? Is your DrawVisuals() and the glReadPixels() executed synchronously in the same thread?

If the glReadPixels occurs after your DrawVisuals(), it's already been drawn before bDrawVisuals was set to false.

Inside your hook_glReadPixels() hook you set bDrawVisuals = false, then it takes the screenshot. Your DrawVisuals code in your other hook isn't detecting that bDrawVisuals is false so it doesn't stop the draw until the next frame after the screenshot has been taken maybe?

Instead, inside your hook where you do DrawVisuals, before you draw your ESP/menu in the previous frame, do your own oReadPixels and then in your hook_glReadPixels() send that result, AKA the screenshot you took before you draw? I just confused myself, hope this helps tho haha


Source Code - Screenshot Cleaner - Bypass Fairfight & Punkbuster - BitBlt Hook
 
Last edited:

Teuvin

now I am become Death
Dank Tier VIP
Trump Tier Donator
Dec 8, 2016
403
10,388
65
uh, whats the problem again? Its not really clear
 

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
uh, whats the problem again? Its not really clear
Visual functions (esp, wallhack, etc) only turn off after the screenshot, in the case the visual functions appear in the screenshot of the anticheat and only after the print they turn off
 

Paga

Newbie
Full Member
Jul 23, 2017
11
59
1
I'm no professional but can't you just hook it and mess its results up?

C++:
#include <iostream>
#include <windows.h>
#include <gl/GL.h>
#include <detours.h>
#pragma comment(lib, "detours.lib")

void(WINAPI *xReadPixelsOrig)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);

void WINAPI xReadPixelsHook(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
{
	tDisplayPop = { true };
	return xReadPixelsOrig(NULL, NULL, NULL, NULL, NULL, NULL, 0);
}

bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
		xReadPixelsOrig = (void(__stdcall *)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))DetourFunction((PBYTE)GetProcAddress(GetModuleHandleW(L"Opengl32.dll"), "glReadPixels"), (BYTE*)xReadPixelsHook);
	else if (dwReason == DLL_PROCESS_DETACH)
		DetourRemove((BYTE*)GetProcAddress(GetModuleHandleW(L"Opengl32.dll"), "glReadPixels"), (BYTE*)xReadPixelsHook);

	return 1;
}
 
Last edited:

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
I'm no professional but can't you just hook it and mess its results up?

C++:
#include <iostream>
#include <windows.h>
#include <gl/GL.h>
#include <detours.h>
#pragma comment(lib, "detours.lib")

void(WINAPI *xReadPixelsOrig)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);

void WINAPI xReadPixelsHook(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
{
	tDisplayPop = { true };
	return xReadPixelsOrig(NULL, NULL, NULL, NULL, NULL, NULL, 0);
}

bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
		xReadPixelsOrig = (void(__stdcall *)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))DetourFunction((PBYTE)GetProcAddress(GetModuleHandleW(L"Opengl32.dll"), "glReadPixels"), (BYTE*)xReadPixelsHook);
	else if (dwReason == DLL_PROCESS_DETACH)
		DetourRemove((BYTE*)GetProcAddress(GetModuleHandleW(L"Opengl32.dll"), "glReadPixels"), (BYTE*)xReadPixelsHook);

	return 1;
}
I tried that method, it did not work, it keeps showing the functions (esp, wallhack) in the anticheat screenshot
 

Paga

Newbie
Full Member
Jul 23, 2017
11
59
1
Well then the anti-cheat may be patching your detour. You should try to save the bytes after the detour and change them if the anti-cheat does that. I'm just guessing though
 

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
Well then the anti-cheat may be patching your detour. You should try to save the bytes after the detour and change them if the anti-cheat does that. I'm just guessing though
I checked the bytes using the cheat engine, the anticheat is not patching my detour, the visual functions only close after taking the screenshot and not before taking the screenshot any other idea?
 

Paga

Newbie
Full Member
Jul 23, 2017
11
59
1
Then this is either not the right function or not the only one. I didn't reverse anything to find out how it works, I'm just basing this on what you said. Make sure the information you gave is true.
 

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
Then this is either not the right function or not the only one. I didn't reverse anything to find out how it works, I'm just basing this on what you said. Make sure the information you gave is true.
I have 100% sure that it is a function and really this is a single one, it has been confirmed by several coders and by several friends of mine, opengl video mode uses glReadPixels and with video mode using D3D uses BitBlt
 

xHunter

Newbie
Full Member
Jun 12, 2017
22
87
1
Rake;50731 said:
Your DrawVisuals() code is in a hook like glEnd() or glSwapBuffers()? Is your DrawVisuals() and the glReadPixels() executed synchronously in the same thread?

If the glReadPixels occurs after your DrawVisuals(), it's already been drawn before bDrawVisuals was set to false.

Inside your hook_glReadPixels() hook you set bDrawVisuals = false, then it takes the screenshot. Your DrawVisuals code in your other hook isn't detecting that bDrawVisuals is false so it doesn't stop the draw until the next frame after the screenshot has been taken maybe?

Instead, inside your hook where you do DrawVisuals, before you draw your ESP/menu in the previous frame, do your own oReadPixels and then in your hook_glReadPixels() send that result, AKA the screenshot you took before you draw? I just confused myself, hope this helps tho haha
1 - My visual draw code is in an engine hook equivalent to glBegin (I tested on glBegin itself, glEnd, glEnable, glSwapBuffers) and did not work.
2 - I'm 95% sure that's what's happening, if that's what the solution would really be?
3 - Currently I'm doing a similar way to this, but it's not good, because whenever anticheat calls glReadPixels causes a drop of fps, the ideal would be to detect when glReadPixels is called and deactivate the visual functions

This method is not good, because fps drops when glReadPixels is called, in the case every approximately 3 seconds I draw a print with the visual functions turned off
C++:
void WINAPI hk_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
{
	if (g_AntiScreen.ScreenFirst)
	{
		g_AntiScreen.ScreenFirst = false;
		g_AntiScreen.dwSize = (width * height) * 3;
		g_AntiScreen.BufferScreen = (PBYTE)malloc(g_AntiScreen.dwSize);
		oReadPixels(x, y, width, height, format, type, pixels);
		__try
		{
			memcpy(g_AntiScreen.BufferScreen, pixels, g_AntiScreen.dwSize);
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {};
		g_AntiScreen.DrawVisuals = true;
		oReadPixels(x, y, width, height, format, type, pixels);
	}
	__try
	{
		memcpy(pixels, g_AntiScreen.BufferScreen, g_AntiScreen.dwSize);
	}
	__except (EXCEPTION_EXECUTE_HANDLER) {};
}

void HUD_Redraw()
{
	if (bAntiSSTemp)
	{
		bAntiSSTemp = false;
		g_AntiScreen.time_scr = GetTickCount();
		g_AntiScreen.temp = 0;
	}

	if (GetTickCount() - g_AntiScreen.time_scr > 2500)
	{
		g_AntiScreen.DrawVisuals = false;
		g_AntiScreen.temp++;
		if (g_AntiScreen.temp > 7)
		{
			bAntiSSTemp = true;
			g_AntiScreen.ScreenFirst = true;
			DWORD sz = (Client.g_Screen.iWidth * Client.g_Screen.iHeight) * 3;
			free((PBYTE)g_AntiScreen.BufferScreen);
			PBYTE buf = (PBYTE)malloc(sz);
			glReadPixels(0, 0, Client.g_Screen.iWidth, Client.g_Screen.iHeight, GL_RGB, GL_UNSIGNED_BYTE, buf);
			free((PBYTE)buf);
		}
	}

	if(g_AntiScreen.DrawVisuals)
	{
		DrawESP();
		DrawCrosshair();
	}
}
 
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