πŸ™ Drawing or detours?

Posts 1–3 of 3 Β· Page 1 of 1
πŸ™ Drawing or detours?
Hello,
I have been working on this base for a long time..
I am not as good as much of you ppl in here, thats why i am here to ask the following:

If i test into D3D9 device it crashes if i add the following line ->

Code:
pReset				  = (oReset)				DetourFunction((PBYTE)vTable[16]	, (PBYTE)myReset	);
 		pEndScene			  = (oEndScene)				DetourFunction((PBYTE)vTable[42]	, (PBYTE)myEndScene	);
It goes to here ->
Code:
HRESULT WINAPI myReset ( PDEVICE pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{	
	pFont->OnLostDevice();
	pFont->OnResetDevice();

	pFont = NULL;

	return pReset(pDevice, pPresentationParameters);
}

HRESULT WINAPI myEndScene (PDEVICE pDevice)
{	
	if (pFont){
		RenderMenu(pDevice);
	}else{
		PostReset(pDevice);	
		RenderMenu(pDevice);
	}

	return pEndScene(pDevice);
}
Ive tooken this lines from 'TopBlast' credits to him..
If i inject into game it also crashes.

Does anyone know how to fix this?
Credits will be given..
I have tried different detours, other hooking but no difference.
I had recoded the Menu Navigation, Drawing,.. etc, no difference
Thanks already.
Code:
DWORD *hookVFunc(DWORD *vtable, int index, DWORD *newFunction)
{
	DWORD dwOldProt, *oldFunc;
	VirtualProtect(&vtable[index], 4, PAGE_EXECUTE_READWRITE, &dwOldProt);
	oldFunc=(DWORD*)vtable[index];
	vtable[index]=(DWORD)newFunction;
	VirtualProtect(&vtable[index], 4, dwOldProt, &dwOldProt);
	return oldFunc;
}
Then use as
Code:
pReset = (oReset)HookVFunc(vTable, 16, (DWORD*)myReset);
Quote Originally Posted by Hell_Demon View Post
Code:
DWORD *hookVFunc(DWORD *vtable, int index, DWORD *newFunction)
{
	DWORD dwOldProt, *oldFunc;
	VirtualProtect(&vtable[index], 4, PAGE_EXECUTE_READWRITE, &dwOldProt);
	oldFunc=(DWORD*)vtable[index];
	vtable[index]=(DWORD)newFunction;
	VirtualProtect(&vtable[index], 4, dwOldProt, &dwOldProt);
	return oldFunc;
}
Then use as
Code:
pReset = (oReset)HookVFunc(vTable, 16, (DWORD*)myReset);
Thanks you, thanked
Posts 1–3 of 3 Β· Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us