Source Code Counter-Strike : Source | EndScene Pointer [Shaderapidx9.dll]

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Simon-Benyo

Jr.Coder
Full Member
Nobleman
Aug 9, 2013
64
1,498
3
Hey guys ,,, so today i was feeling bored a bit and had a free time so i said lets dig a little bit in Shaderapidx9.dll in my Counter-Strike:Source game since i dont like the routine of FindPattern or Strife's Method

So we have searched a bit in that magical dll and found a pointer on a pointer on a pointer :trollface: that leads us to the vTable and it was @ Shaderapidx.dll+ 0xB5F1F :)

And to get the EndScene Address we must read 3 pointers with 0 offset added to them and add the Position of EndScene in the table to the result ,,, and read it a a pointer once again to reach to the proper address ;)



C++:
DWORD pppvTable = (DWORD)hMods[i] + 0xB5F1F; //Counter-Strike:Source Build 2234230 
DWORD pdwEndScene = (*(PDWORD)(*(PDWORD)(*(PDWORD)pppd3dPointer))) + EndScenePosition;
And this is the full implementation that you can maybe use in your code or something or at least learn something by studying it although there is bunch of pointers (Third Leveled Basic Pointer) :foreveralone: to the vTable however its kinda useful :cool: :

C++:
DWORD GetEndScene()
{
	HMODULE hMods[1024];
	HANDLE hProcess;
	DWORD cbNeeded;
	int i = 0;
	hProcess = GetCurrentProcess(); // Considering this code will be used in a DLL that will be injected in the target process


	if (EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)) // GetProcesModules
	{
		for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++)
		{
			TCHAR szModName[MAX_PATH];


			if (GetModuleFileNameEx(hProcess, hMods[i], szModName,
				sizeof(szModName) / sizeof(TCHAR)))
			{


				if (wcsstr(szModName, L"shaderapidx9") > 0) // Check the module name
				{

					DWORD	EndScenePosition = 42 * 4; //EndScene Position in the vTable
					DWORD dwEndScene = 0;
					DWORD pppvTable = (DWORD)hMods[i] + 0xB5F1F; //Counter-Strike:Source Build 2234230 
					DWORD pdwEndScene = (*(PDWORD)(*(PDWORD)(*(PDWORD)pppvTable))) + EndScenePosition; // I Love PDWORD Casts  :| -_-
					dwEndScene = *(PDWORD)pdwEndScene;
					return dwEndScene;

				}
			}
		}
	}


}

I hope this code or at least the information that it contains helps anyone ,,, And sorry for my bad English its not my mother language :)

Simon.
 
Last edited:

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Did I misunderstand something or could I just do it like this:
C++:
DWORD SHADERAPIDX9 = (DWORD)GetModuleHandleA((LPCSTR)"shaderapidx9.dll");
DWORD pdwEndScene = (*(DWORD*)(*(DWORD*)(*(DWORD*)(SHADERAPIDX9 + 0xB5F1F)))) + (42 * 4);
DWORD dwEndScene = *(DWORD*)pdwEndScene;
 

Simon-Benyo

Jr.Coder
Full Member
Nobleman
Aug 9, 2013
64
1,498
3
Did I misunderstand something or could I just do it like this:
C++:
DWORD SHADERAPIDX9 = (DWORD)GetModuleHandleA((LPCSTR)"shaderapidx9.dll");
DWORD pdwEndScene = (*(DWORD*)(*(DWORD*)(*(DWORD*)(SHADERAPIDX9 + 0xB5F1F)))) + (42 * 4);
DWORD dwEndScene = *(DWORD*)pdwEndScene;

its the same but i don't like GetModuleHandle neither LoadLibrary i am allergic to them :trollface: (i don't like the same routine always so i said lets give it a push to EnumProcessModules),,, and next step using the (DWORD) with * will get you a cute message saying ( operand of '*' must be a pointer" ) however (DWORD*) is also good but why not (PDWORD) since the result is dword pointer and * reads a dword pointer so why not use a DWORD pointer cast (PDWORD)

so one point for you and one for me but since i am allergic it can be considered as two for me :p just kidding ,,, what am trying to say all roads lead to Rome ,,, thank you for replaying :)
 
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