Опубликовано 1 августа, 20187 г. comment_906 Суть проблемы такова->инжект проходит а отрисовки вх нету,посмотрите где ошибка в коде.Сам код#include "Headers.h"#include "Hook.h"#include "Menu.h"#include "Texture.h"CHAR *OnOff [] = { "[Off]", "[On]" };CHAR *Folder[] = { "[+]", "[-]" };//MenuCHAR MenuTitle [ MAX_PATH ] = { "Menu" };CHAR Timestruct[ MAX_PATH ] = { "hh':'mm':'ss tt" };CHAR TimeString[ MAX_PATH ];BOOL BFont = FALSE;INT Variable[ MAX_PATH ];INT VFolder[ MAX_PATH ];//Примитивыtypedef HRESULT(WINAPI* oDrawIndexedPrimitive) (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT PrimitiveCount);oDrawIndexedPrimitive pDrawIndexedPrimitive;HRESULT WINAPI Reset( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters ){PFont->OnLostDevice();HRESULT hTorna = OReset( pDevice, pPresentationParameters );if( SUCCEEDED( hTorna ) )PFont->OnResetDevice();return hTorna;}HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32){if (FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)))return E_FAIL;WORD colour16 = ((WORD)((colour32 >> 28) & 0xF) << 12)| (WORD)(((colour32 >> 20) & 0xF) << 8)| (WORD)(((colour32 >> 12) & 0xF) << 4)| (WORD)(((colour32 >> 4) & 0xF) << 0);D3DLOCKED_RECT d3dlr;(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);WORD *pDst16 = (WORD*)d3dlr.pBits;for (int xy = 0; xy < 8 * 8; xy++)*pDst16++ = colour16;(*ppD3Dtex)->UnlockRect(0);return S_OK;}// Замена текстурvoid SetModelColor(LPDIRECT3DDEVICE9 pDevice, float r, float g, float b, float a, float glowr, float glowg, float glowb, float glowa){float lightValues[4] = { r, g, b, a };float glowValues[4] = { glowr, glowg, glowb, glowa };pDevice->SetPixelShaderConstantF(1, lightValues, 1);pDevice->SetPixelShaderConstantF(3, glowValues, 1);}UINT Stride;LPDIRECT3DVERTEXBUFFER9 StreamData;UINT OffsetInBytes;LPDIRECT3DTEXTURE9 chams_bcolor;bool GenOne = 0;HRESULT WINAPI Present( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion ){if (GenOne == 0){//ЦветаGenerateTexture(pDevice, &chams_bcolor, D3DCOLOR_ARGB(255, 255, 0, 0)); //redGenOne = 1;}if( PFont ){PFont->Release();PFont = NULL;BFont = FALSE;}if( !BFont ){D3DXCreateFont( pDevice, 14, 0, 400, 1, 0, 1, 0, 4, 0 | (0<<4), "Arial", &PFont );BFont = TRUE;}if( GetAsyncKeyState( VK_INSERT ) &1 )menu.ShowMenu =! menu.ShowMenu;if( menu.ShowMenu && PFont ){pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );GetTimeFormat( 0, 0, 0, 0, Timestruct, 15 );DrawBox( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ] - 22, 162, 20, TBlack, Green, pDevice );DrawBorder( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ] - 22, 162, 20, 1, Green, pDevice );WriteText( menu.matrixPos[ 0 ] , menu.matrixPos[ 1 ] - 20, Yellow, MenuTitle );sprintf_s( TimeString, "%s", Timestruct );WriteText( menu.matrixPos[ 0 ] + 100, menu.matrixPos[ 1 ] - 20, Yellow, TimeString );DrawBox( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ], 162, ( ( menu.Current * 15 ) - 5 ), TBlack, Green, pDevice );DrawBorder( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ], 162, ( ( menu.Current * 15 ) - 5 ), 1, Green, pDevice );DrawBorder( menu.matrixPos[ 0 ] - 10, ( ( menu.matrixPos[ 2 ] + 2 ) + ( menu.MenuSelection * 15 ) ), 162, 13, 1, Cyan, pDevice );menu.Current = 1;if( GetAsyncKeyState( VK_UP ) &1 )menu.MenuSelection--;if(GetAsyncKeyState( VK_DOWN ) &1 )menu.MenuSelection++;Additem( "[Folder 1]", 1, VFolder[ 0 ], 1, Folder );if( VFolder[ 0 ] ){Additem( "Item 0", 1, Variable[ 0 ], 0, OnOff );Additem( "Item 1", 1, Variable[ 1 ], 0, OnOff );Additem( "Item 2", 1, Variable[ 2 ], 0, OnOff );Additem( "Item 3", 1, Variable[ 3 ], 0, OnOff );}if( menu.MenuSelection >= menu.Current )menu.MenuSelection = 1;else if( menu.MenuSelection <= 0 )menu.MenuSelection = ( menu.Current - 1 );}if( Variable[ 0 ] )CrossHair( pDevice, Red );if( Variable[ 1 ] ){POINT vec2Cursor;GetCursorPos( &vec2Cursor );menu.matrixPos[ 0 ] = vec2Cursor.x;menu.matrixPos[ 1 ] = vec2Cursor.y;menu.matrixPos[ 2 ] = ( vec2Cursor.y - 10 );}return OPresent( pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion );}HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT PrimitiveCount){if (pDevice->GetStreamSource(0, &StreamData, &OffsetInBytes, &Stride) == D3D_OK){StreamData->Release();}if (Variable[0] == 1)if//Stride 8 numvert 8 prim 10((NumVertices == 8 && PrimitiveCount == 10 && Stride == 8))/*((NumVertices == 763 && PrimitiveCount == 1020 && Stride == 64))*/{pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_NEVER);pDevice->SetTexture(0, chams_bcolor);SetModelColor(pDevice, 200.0f, 165.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f);pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, PrimitiveCount);pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);pDevice->SetTexture(0, chams_bcolor);SetModelColor(pDevice, 255.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f);}return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, PrimitiveCount);}DWORD WINAPI Hook( LPVOID lpArgs ){HMODULE D3D9 = 0;while( !D3D9 ){Sleep( 100 );D3D9 = GetModuleHandle( "d3d9.dll" );}DWORD VTable[ 5 ] = { 0 };CreateDevice( VTable );pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)VTable[0], (PBYTE)myDrawIndexedPrimitive);OReset = (TReset)DetourFunction( (PBYTE)VTable[ 0 ], (PBYTE)&Reset );OPresent = (TPresent)DetourFunction( (PBYTE)VTable[1], (PBYTE)&Present );return FALSE;}BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved ){UNREFERENCED_PARAMETER( hModule );if( dwReason == DLL_PROCESS_ATTACH ){DisableThreadLibraryCalls( hModule );CreateThread( 0, 0, &Hook, 0, 0, 0 );}return TRUE;}
Опубликовано 1 августа, 20187 г. comment_907 pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)VTable[0], (PBYTE)myDrawIndexedPrimitive); OReset = (TReset)DetourFunction( (PBYTE)VTable[ 0 ], (PBYTE)&Reset ); OPresent = (TPresent)DetourFunction( (PBYTE)VTable[1], (PBYTE)&Present ); pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)VTable[82], (PBYTE)myDrawIndexedPrimitive);OReset = (TReset)DetourFunction( (PBYTE)VTable[16], (PBYTE)&Reset );OPresent = (TPresent)DetourFunction( (PBYTE)VTable[17], (PBYTE)&Present ); Не правильные индексы функций. struct DirectX9VTable { DWORD QueryInterface; // 0 DWORD AddRef; // 1 DWORD Release; // 2 DWORD TestCooperativeLevel; // 3 DWORD GetAvailableTextureMem; // 4 DWORD EvictManagedResources; // 5 DWORD GetDirect3D; // 6 DWORD GetDeviceCaps; // 7 DWORD GetDisplayMode; // 8 DWORD GetCreationParameters; // 9 DWORD SetCursorProperties; // 10 DWORD SetCursorPosition; // 11 DWORD ShowCursor; // 12 DWORD CreateAdditionalSwapChain; // 13 DWORD GetSwapChain; // 14 DWORD GetNumberOfSwapChains; // 15 DWORD Reset; // 16 DWORD Present; // 17 DWORD GetBackBuffer; // 18 DWORD GetRasterStatus; // 19 DWORD SetDialogBoxMode; // 20 DWORD SetGammaRamp; // 21 DWORD GetGammaRamp; // 22 DWORD CreateTexture; // 23 DWORD CreateVolumeTexture; // 24 DWORD CreateCubeTexture; // 25 DWORD CreateVertexBuffer; // 26 DWORD CreateIndexBuffer; // 27 DWORD CreateRenderTarget; // 28 DWORD CreateDepthStencilSurface; // 29 DWORD UpdateSurface; // 30 DWORD UpdateTexture; // 31 DWORD GetRenderTargetData; // 32 DWORD GetFrontBufferData; // 33 DWORD StretchRect; // 34 DWORD ColorFill; // 35 DWORD CreateOffscreenPlainSurface; // 36 DWORD SetRenderTarget; // 37 DWORD GetRenderTarget; // 38 DWORD SetDepthStencilSurface; // 39 DWORD GetDepthStencilSurface; // 40 DWORD BeginScene; // 41 DWORD EndScene; // 42 DWORD Clear; // 43 DWORD SetTransform; // 44 DWORD GetTransform; // 45 DWORD MultiplyTransform; // 46 DWORD SetViewport; // 47 DWORD GetViewport; // 48 DWORD SetMaterial; // 49 DWORD GetMaterial; // 50 DWORD SetLight; // 51 DWORD GetLight; // 52 DWORD LightEnable; // 53 DWORD GetLightEnable; // 54 DWORD SetClipPlane; // 55 DWORD GetClipPlane; // 56 DWORD SetRenderState; // 57 DWORD GetRenderState; // 58 DWORD CreateStateBlock; // 59 DWORD BeginStateBlock; // 60 DWORD EndStateBlock; // 61 DWORD SetClipStatus; // 62 DWORD GetClipStatus; // 63 DWORD GetTexture; // 64 DWORD SetTexture; // 65 DWORD GetTextureStageState; // 66 DWORD SetTextureStageState; // 67 DWORD GetSamplerState; // 68 DWORD SetSamplerState; // 69 DWORD ValidateDevice; // 70 DWORD SetPaletteEntries; // 71 DWORD GetPaletteEntries; // 72 DWORD SetCurrentTexturePalette; // 73 DWORD GetCurrentTexturePalette; // 74 DWORD SetScissorRect; // 75 DWORD GetScissorRect; // 76 DWORD SetSoftwareVertexProcessing; // 77 DWORD GetSoftwareVertexProcessing; // 78 DWORD SetNPatchMode; // 79 DWORD GetNPatchMode; // 80 DWORD DrawPrimitive; // 81 DWORD DrawIndexedPrimitive; // 82 DWORD DrawPrimitiveUP; // 83 DWORD DrawIndexedPrimitiveUP; // 84 DWORD ProcessVertices; // 85 DWORD CreateVertexDeclaration; // 86 DWORD SetVertexDeclaration; // 87 DWORD GetVertexDeclaration; // 88 DWORD SetFVF; // 89 DWORD GetFVF; // 90 DWORD CreateVertexShader; // 91 DWORD SetVertexShader; // 92 DWORD GetVertexShader; // 93 DWORD SetVertexShaderConstantF; // 94 DWORD GetVertexShaderConstantF; // 95 DWORD SetVertexShaderConstantI; // 96 DWORD GetVertexShaderConstantI; // 97 DWORD SetVertexShaderConstantB; // 98 DWORD GetVertexShaderConstantB; // 99 DWORD SetStreamSource; // 100 DWORD GetStreamSource; // 101 DWORD SetStreamSourceFreq; // 102 DWORD GetStreamSourceFreq; // 103 DWORD SetIndices; // 104 DWORD GetIndices; // 105 DWORD CreatePixelShader; // 106 DWORD SetPixelShader; // 107 DWORD GetPixelShader; // 108 DWORD SetPixelShaderConstantF; // 109 DWORD GetPixelShaderConstantF; // 110 DWORD SetPixelShaderConstantI; // 111 DWORD GetPixelShaderConstantI; // 112 DWORD SetPixelShaderConstantB; // 113 DWORD GetPixelShaderConstantB; // 114 DWORD DrawRectPatch; // 115 DWORD DrawTriPatch; // 116 DWORD DeletePatch; // 117 DWORD CreateQuery; // 118 };
Опубликовано 1 августа, 20187 г. Автор comment_908 Теперь вообще нечего не происходит при инжекте (Меню не отрисовывается даже)
Опубликовано 1 августа, 20187 г. Автор comment_910 Вот еще кусок исхода#include "Headers.h"typedef HRESULT( WINAPI *TReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters );TReset OReset;typedef HRESULT( WINAPI *TPresent )( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion );TPresent OPresent;VOID CreateDevice(DWORD *dwVTable){LPDIRECT3D9 D3D9;LPDIRECT3DDEVICE9 pD3DDevice;D3D9 = Direct3DCreate9( D3D_SDK_VERSION );if( D3D9 == NULL )return;D3DPRESENT_PARAMETERS pPresentParms;ZeroMemory( &pPresentParms, sizeof( pPresentParms ) );pPresentParms.Windowed = TRUE;pPresentParms.BackBufferFormat = D3DFMT_UNKNOWN;pPresentParms.SwapEffect = D3DSWAPEFFECT_DISCARD;if( FAILED( D3D9->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow(), D3DCREATE_SOFTWARE_VERTEXPROCESSING, &pPresentParms, &pD3DDevice ) ) )return;DWORD *dwTable = (DWORD *)pD3DDevice;dwTable = (DWORD *) dwTable[ 0 ];dwVTable[ 0 ] = dwTable[ 16 ];dwVTable[ 1 ] = dwTable[ 17 ];}VOID *DetourCreate( BYTE *src, CONST BYTE *dst, CONST INT len ){BYTE *jmp = (BYTE *)malloc( len + 5 );DWORD dwback;VirtualProtect( src, len, PAGE_READWRITE, &dwback );memcpy( jmp, src, len );jmp += len;jmp[0] = 0xE9;*(DWORD *)( jmp + 1 ) = (DWORD)( src + len - jmp ) - 5;src[0] = 0xE9;*(DWORD *)( src + 1 ) = (DWORD)( dst - src ) - 5;for( INT i = 5; i < len; i++ )src = 0x90;VirtualProtect( src, len, dwback, &dwback );return( jmp - len );}
Опубликовано 1 августа, 20187 г. comment_911 dwVTable[ 0 ] = dwTable[ 16 ]; dwVTable[ 1 ] = dwTable[ 17 ]; у тебя вон как прописано)) Верни как было до этого у тебя.И добавь ДравИндексес dwVTable[ 2 ] = dwTable[ 82 ];И при установке хука pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)VTable[2], (PBYTE)myDrawIndexedPrimitive);http://prntscr.com/kdi4jz http://prntscr.com/kdi4zw Как то так))
comment_906Суть проблемы такова->инжект проходит а отрисовки вх нету,посмотрите где ошибка в коде.
Сам код
#include "Headers.h"
#include "Hook.h"
#include "Menu.h"
#include "Texture.h"
CHAR *OnOff [] = { "[Off]", "[On]" };
CHAR *Folder[] = { "[+]", "[-]" };
//Menu
CHAR MenuTitle [ MAX_PATH ] = { "Menu" };
CHAR Timestruct[ MAX_PATH ] = { "hh':'mm':'ss tt" };
CHAR TimeString[ MAX_PATH ];
BOOL BFont = FALSE;
INT Variable[ MAX_PATH ];
INT VFolder[ MAX_PATH ];
//Примитивы
typedef HRESULT(WINAPI* oDrawIndexedPrimitive) (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT PrimitiveCount);
oDrawIndexedPrimitive pDrawIndexedPrimitive;
HRESULT WINAPI Reset( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters )
{
PFont->OnLostDevice();
HRESULT hTorna = OReset( pDevice, pPresentationParameters );
if( SUCCEEDED( hTorna ) )
PFont->OnResetDevice();
return hTorna;
}
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if (FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)))
return E_FAIL;
WORD colour16 = ((WORD)((colour32 >> 28) & 0xF) << 12)
| (WORD)(((colour32 >> 20) & 0xF) << 8)
| (WORD)(((colour32 >> 12) & 0xF) << 4)
| (WORD)(((colour32 >> 4) & 0xF) << 0);
D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for (int xy = 0; xy < 8 * 8; xy++)
*pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK;
}
// Замена текстур
void SetModelColor(LPDIRECT3DDEVICE9 pDevice, float r, float g, float b, float a, float glowr, float glowg, float glowb, float glowa)
{
float lightValues[4] = { r, g, b, a };
float glowValues[4] = { glowr, glowg, glowb, glowa };
pDevice->SetPixelShaderConstantF(1, lightValues, 1);
pDevice->SetPixelShaderConstantF(3, glowValues, 1);
}
UINT Stride;
LPDIRECT3DVERTEXBUFFER9 StreamData;
UINT OffsetInBytes;
LPDIRECT3DTEXTURE9 chams_bcolor;
bool GenOne = 0;
HRESULT WINAPI Present( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion )
{
if (GenOne == 0)
{
//Цвета
GenerateTexture(pDevice, &chams_bcolor, D3DCOLOR_ARGB(255, 255, 0, 0)); //red
GenOne = 1;
}
if( PFont )
{
PFont->Release();
PFont = NULL;
BFont = FALSE;
}
if( !BFont )
{
D3DXCreateFont( pDevice, 14, 0, 400, 1, 0, 1, 0, 4, 0 | (0<<4), "Arial", &PFont );
BFont = TRUE;
}
if( GetAsyncKeyState( VK_INSERT ) &1 )
menu.ShowMenu =! menu.ShowMenu;
if( menu.ShowMenu && PFont )
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
GetTimeFormat( 0, 0, 0, 0, Timestruct, 15 );
DrawBox( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ] - 22, 162, 20, TBlack, Green, pDevice );
DrawBorder( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ] - 22, 162, 20, 1, Green, pDevice );
WriteText( menu.matrixPos[ 0 ] , menu.matrixPos[ 1 ] - 20, Yellow, MenuTitle );
sprintf_s( TimeString, "%s", Timestruct );
WriteText( menu.matrixPos[ 0 ] + 100, menu.matrixPos[ 1 ] - 20, Yellow, TimeString );
DrawBox( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ], 162, ( ( menu.Current * 15 ) - 5 ), TBlack, Green, pDevice );
DrawBorder( menu.matrixPos[ 0 ] - 10, menu.matrixPos[ 1 ], 162, ( ( menu.Current * 15 ) - 5 ), 1, Green, pDevice );
DrawBorder( menu.matrixPos[ 0 ] - 10, ( ( menu.matrixPos[ 2 ] + 2 ) + ( menu.MenuSelection * 15 ) ), 162, 13, 1, Cyan, pDevice );
menu.Current = 1;
if( GetAsyncKeyState( VK_UP ) &1 )
menu.MenuSelection--;
if(GetAsyncKeyState( VK_DOWN ) &1 )
menu.MenuSelection++;
Additem( "[Folder 1]", 1, VFolder[ 0 ], 1, Folder );
if( VFolder[ 0 ] )
{
Additem( "Item 0", 1, Variable[ 0 ], 0, OnOff );
Additem( "Item 1", 1, Variable[ 1 ], 0, OnOff );
Additem( "Item 2", 1, Variable[ 2 ], 0, OnOff );
Additem( "Item 3", 1, Variable[ 3 ], 0, OnOff );
}
if( menu.MenuSelection >= menu.Current )
menu.MenuSelection = 1;
else if( menu.MenuSelection <= 0 )
menu.MenuSelection = ( menu.Current - 1 );
}
if( Variable[ 0 ] )
CrossHair( pDevice, Red );
if( Variable[ 1 ] )
{
POINT vec2Cursor;
GetCursorPos( &vec2Cursor );
menu.matrixPos[ 0 ] = vec2Cursor.x;
menu.matrixPos[ 1 ] = vec2Cursor.y;
menu.matrixPos[ 2 ] = ( vec2Cursor.y - 10 );
}
return OPresent( pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion );
}
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT PrimitiveCount)
{
if (pDevice->GetStreamSource(0, &StreamData, &OffsetInBytes, &Stride) == D3D_OK)
{
StreamData->Release();
}
if (Variable[0] == 1)
if
//Stride 8 numvert 8 prim 10
((NumVertices == 8 && PrimitiveCount == 10 && Stride == 8))
/*((NumVertices == 763 && PrimitiveCount == 1020 && Stride == 64))*/
{
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_NEVER);
pDevice->SetTexture(0, chams_bcolor);
SetModelColor(pDevice, 200.0f, 165.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f);
pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, PrimitiveCount);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
pDevice->SetTexture(0, chams_bcolor);
SetModelColor(pDevice, 255.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f);
}
return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, PrimitiveCount);
}
DWORD WINAPI Hook( LPVOID lpArgs )
{
HMODULE D3D9 = 0;
while( !D3D9 )
{
Sleep( 100 );
D3D9 = GetModuleHandle( "d3d9.dll" );
}
DWORD VTable[ 5 ] = { 0 };
CreateDevice( VTable );
pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)VTable[0], (PBYTE)myDrawIndexedPrimitive);
OReset = (TReset)DetourFunction( (PBYTE)VTable[ 0 ], (PBYTE)&Reset );
OPresent = (TPresent)DetourFunction( (PBYTE)VTable[1], (PBYTE)&Present );
return FALSE;
}
BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )
{
UNREFERENCED_PARAMETER( hModule );
if( dwReason == DLL_PROCESS_ATTACH )
{
DisableThreadLibraryCalls( hModule );
CreateThread( 0, 0, &Hook, 0, 0, 0 );
}
return TRUE;
}