HelpVTable Count Problem

Posts 1–3 of 3 · Page 1 of 1
VTable Count Problem
So, I started with my own hooking class because it was boring to just paste one.
I got a problem with my "countfunction" function in my hooking class and I've tried a sh*t ton of methods trying to get it to work.

This is my current one:
Code:
unsigned int CVTable::GetSize()
{
	for (int i = 0;; i++)
	{
		if (!CanReadAddress(oldVTable[i]) && !oldVTable[i] && IsBadCodePtr(FARPROC(oldVTable[i])))
			return i;
	}
}
and it gives me these results:
Code:
Number of functions: 258432384 Size of EngineVTable: 1033729536
Code:
CVTable::CVTable(void* ClassAddress, int& size)
{
	pObject = (void***)ClassAddress;
	oldVTable = *(void***)ClassAddress;
	int i = this->GetSize();
	
	//*pHookedTable = malloc(this->GetSize());
	//memcpy(*pHookedTable, oldVTable, this->GetSize());     
}

 //main.cpp
        int funcs;
	pEngine = (CEngine*)CreateInterface("engine.dll", "VEngineClient014");
	EngineTable = new CVTable((void*)pEngine, funcs);

	std::cout << (DWORD)pEngine << std::endl;
	std::cout << "Is in game: " << pEngine->isInGame() << std::endl;
	std::cout << "Number of functions: " << funcs / sizeof(void*) << " Size of EngineVTable: " << funcs << std::endl;
Calling original functions works with the engine instance, I've also tried with the client, same issue.

Some more maybe useful code
Code:
class CVTable
{
public:
	CVTable(void* ClassAddress, int& size);
	void*** pObject;
	void** pHookedTable;
	void** oldVTable;
	unsigned int TableSize;
	void HookMethod(int Index, void* Function);
	template <typename T> inline T GetOriginal(int Index) const;
	unsigned int GetSize();
	void HookTable(bool ShouldHook);



bool CanReadAddress(void* pointer) //Semi-pasted from another cheat trying to get it to work.
{
	MEMORY_BASIC_INFORMATION MemoryBasicInfo;
	if (pointer == nullptr) return false;
	if (!VirtualQuery(pointer, &MemoryBasicInfo, sizeof(MemoryBasicInfo))) return false;
	if (MemoryBasicInfo.Protect & k_page_offlimits) return false;
	return (MemoryBasicInfo.Protect & k_page_readable);
}
};
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?