LightbulbD3D Hook [CF]

Posts 1–10 of 10 · Page 1 of 1
D3D Hook [CF]
D3D Hook [CF]
Code:
#include <Windows.h>
#include <d3d9.h>
#include <detours.h>

#pragma comment (lib, "d3d9.lib")


IDirect3DDevice9 * pGameDevice;

////////////////
///BeginScene///
////////////////
typedef HRESULT(WINAPI* BeginScene_)(LPDIRECT3DDEVICE9 pDevice);
BeginScene_ pBeginScene;
HRESULT WINAPI nBeginScene(LPDIRECT3DDEVICE9 pDevice)
{
_asm NOP;
HRESULT hRet = pBeginScene(pDevice);






return hRet;
}

/************************************************** ************************************************/

//////////////
///EndScene///
//////////////
typedef HRESULT(WINAPI* EndScene_)(LPDIRECT3DDEVICE9 pDevice);
EndScene_ pEndScene;
HRESULT WINAPI nEndScene(LPDIRECT3DDEVICE9 pDevice)
{ 

HRESULT hRet = pEndScene(pDevice);




return hRet;
}

/************************************************** ************************************************/

//////////////////////////
///DrawIndexedPrimitive///
//////////////////////////
typedef HRESULT(WINAPI* DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
UINT NumVertices, UINT StartIndex, UINT PrimitiveCount);
DrawIndexedPrimitive_ pDrawIndexedPrimitive;
HRESULT WINAPI nDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
{ 


{ 

pDevice->SetRenderState( D3DRS_FOGENABLE, false );//useless engine has it set to 0 Tablefog is on tho 


} 



IDirect3DVertexBuffer9* pStreamData = NULL;

UINT iOffsetInBytes,iStride; 

pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes,&i Stride); 

if ( iStride == 40 )


{


pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );


} 






return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);


}

/************************************************** ************************************************/

/////////////////////
///SetStreamSource///
/////////////////////
typedef HRESULT(WINAPI* SetStreamSource_)(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride);
SetStreamSource_ pSetStreamSource;
HRESULT WINAPI nSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride)
{ 
_asm NOP;
HRESULT hRet = pSetStreamSource(pDevice, StreamNumber, pStreamData, OffsetInBytes, Stride);

return hRet;
}

/************************************************** ************************************************/

///////////
///Reset///
///////////
typedef HRESULT(WINAPI* Reset_)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
Reset_ pReset;
HRESULT WINAPI nReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
_asm NOP;
HRESULT hRet = pReset(pDevice, pPresentationParameters);

return hRet;
}

/************************************************** ************************************************/


DWORD dwWait(LPVOID lpArgs)
{

DWORD Base = NULL;

for (;Base == NULL;Sleep(100)) 
Base = (DWORD)GetModuleHandle("crossfire.exe"); 

for(;pGameDevice == NULL; Sleep(10000)) 
{
DWORD dwProtect;
VirtualProtect((void*)(0x70A440), 4, PAGE_EXECUTE_READWRITE, &dwProtect);
memcpy(&pGameDevice, (void*)(0x70A440), 4);
VirtualProtect((void*)(0x70A440), 4, dwProtect, NULL);
}




DWORD* pdwNewDevice = *(DWORD**)pGameDevice;
pdwNewDevice = (DWORD*)pdwNewDevice[0]; //turn our pointer into an array for the vtable*/


// pReset = (Reset_)DetourFunction((PBYTE)pdwNewDevice[16],(PBYTE)nReset);
// pBeginScene = (BeginScene_)DetourFunction((PBYTE)pdwNewDevice[41],(PBYTE)nBeginScene);
pEndScene = (EndScene_)DetourFunction((PBYTE)pdwNewDevice[42],(PBYTE)nEndScene);
// pDrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)pdwNe wDevice[82],(PBYTE)nDrawIndexedPrimitive);
// pSetStreamSource = (SetStreamSource_)DetourFunction((PBYTE)pdwNewDevi ce[100],(PBYTE)nSetStreamSource);

return 0;
}

bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{

CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwWait, NULL, NULL, NULL);

return true;
}

return false;
}
Can somebody check this out?!
1 failed...
someone try to make it true
lol post the DLL -.-

I think, it fails
That code is sloppy as fuck Dx

Who did you leech this from, because that's not your code.
Quote Originally Posted by Alroundeath View Post
That code is sloppy as fuck Dx

Who did you leech this from, because that's not your code.
umm why we can't use ... like code from d.x.t ? or just ther bypass ?
we can't because that's d.x.t i$ gay lol
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
yea they are right..
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us