Results 1 to 3 of 3
  1. #1
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy

    Unhappy 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.

  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    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);
    Ah we-a blaze the fyah, make it bun dem!

  3. The Following User Says Thank You to Hell_Demon For This Useful Post:

    AeroMan (12-17-2010)

  4. #3
    Threadstarter
    Upcoming MPGHiean
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy
    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