Code:
# Include <windows.h>
# Include
# Include <fstream>
# Include "cDetours.h"
# Include <d3d9.h>
# Include <d3dx9.h>
# Pragma comment (lib, "d3d9.lib")
# Comment pragma (lib, "d3dx9.lib")
# Define GANCHO (func, Addy) o # # func = (t # # func) CreateDetour ((DWORD) hk # # func, (DWORD) Addy, Detour_Type_0xB8, 7) / / gancho rápido usando CreateDetour ****** ***
# Define desprender (func, Addy) o # # func = (t # # func) CreateDetour ((DWORD) o # # func, (DWORD) Addy, Detour_Type_0xB8, 7) / / Unook rápida usando CreateDetour ****** ***
typedef HRESULT (WINAPI * tEndScene) (LPDIRECT3DDEVICE9 pDevice);
tEndScene oEndScene = NULL;
typedef HRESULT (WINAPI * tDrawIndexedPrimitive) (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType, BaseVertexIndex INT, UINT MinVertexIndex, UINT NumVertices, UINT índiceInicial, UINT primCount);
oDrawIndexedPrimitive tDrawIndexedPrimitive = NULL;
typedef HRESULT (WINAPI * tReset) (LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters);
tReset oReset = NULL;
LPDIRECT3DDEVICE9 npDevice;
LPD3DXLINE g_pLine = NULL;
D3DVIEWPORT9 g_ViewPort;
LPDIRECT3DVERTEXBUFFER9 Stream_Data;
UINT offset = 0;
UINT Stride = 0;
WallHack bool = true;
bool chams = true;
int m_stride;
LPDIRECT3DDEVICE9 g_pDevice = 0;
int b = 0;
LPDIRECT3DTEXTURE9 g_Blue = NULL;
const Blue Byte [60] =
{
0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
};
LPDIRECT3DTEXTURE9 g_Oren = NULL;
const BYTE Oren [58] = {
0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xFF, 0x00
};
LPDIRECT3DTEXTURE9 g_Muda = NULL;
const muda BYTE [60] =
{
0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00,
0x12, 0x0B, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x80, 0x00, 0x00, 0x00, 0x00
};
vazio ReFont (LPDIRECT3DDEVICE9 pDevice)
{
if (g_pDevice! = pDevice)
{
g_pDevice = pDevice;
}
}
PBYTE HookVTableFunction (PDWORD * dwVTable, PBYTE dwHook, Índice INT)
{
DWORD dwOld = 0;
PBYTE pOrig = ((PBYTE) (* dwVTable) [Index]);
(* DwVTable) [índice] = (DWORD) dwHook;
voltar pOrig;
}
HRESULT WINAPI hkEndScene (LPDIRECT3DDEVICE9 pDevice)
{
while (! npDevice) {
npDevice = pDevice;
}
if (g_Oren == NULL) D3DXCreateTextureFromFileInMemory (pDevice (LPCVOID) e Oren, sizeof (Oren), e g_Oren);
if (g_Blue == NULL) D3DXCreateTextureFromFileInMemory (pDevice (LPCVOID) & Blue, sizeof (azul), e g_Blue);
if (g_Muda == NULL) D3DXCreateTextureFromFileInMemory (pDevice (LPCVOID) e muda, sizeof (muda), e g_Muda);
if (g_pLine == NULL) D3DXCreateLine (pDevice, e g_pLine);
pDevice-> GetViewport (& g_ViewPort);
if (g_Blue == NULL) D3DXCrea [Maaf Saya Kasar] xtureFromFileInMemory (pDevice (LPCVOID) & Blue, sizeof (azul), e g_Blue);
if (g_pLine! = NULL) {
}
voltar oEndScene (pDevice);
}
HRESULT WINAPI hkDrawIndexedPrimitive (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType, BaseVertexIndex INT, UINT MinVertexIndex, UINT NumVertices, UINT índiceInicial, UINT primCount)
{
if (pDevice-> GetStreamSource (0, & Stream_Data, e Offset, e Stride) == D3D_OK)
Stream_Data-> Release ();
if (WallHack)
{
if (m_stride == 52)
{
DWORD dwOldZEnable;
pDevice-> GetRenderState (D3DRS_ZENABLE, e dwOldZEnable);
pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE);
oDrawIndexedPrimitive (pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, índiceInicial, primCount);
}
}
if (chams)
{
if (m_stride == 44)
{
DWORD dwOldZEnable;
pDevice-> GetRenderState (D3DRS_ZENABLE, e dwOldZEnable);
pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE);
pDevice-> SetRenderState (D3DRS_FILLMODE, D3DFILL_SOLID);
pDevice-> SetTexture (0, g_Oren);
oDrawIndexedPrimitive (pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, índiceInicial, primCount);
pDevice-> SetRenderState (D3DRS_ZENABLE, dwOldZEnable);
}
}
oDrawIndexedPrimitive retorno (pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, índiceInicial, primCount);
}
HRESULT WINAPI hkReset (LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters)
{
if (g_pLine)
g_pLine-> OnLostDevice ();
HRESULT iReturnValue = oReset (pDevice, pPresentationParameters);
if (iReturnValue == D3D_OK) {
if (g_pLine)
g_pLine-> OnResetDevice ();
}
HRESULT hRet = oReset (pDevice, pPresentationParameters);
voltar iReturnValue;
}
CreateDetour DWORD (DWORD dwThread, DWORD dwAdress, DWORD dwType, DWORD dwSize)
{
DWORD dwDetour, dwProtect, i;
if (dwAdress && dwThread && dwSize> = dwSize)
{
dwDetour = (DWORD) VirtualAlloc (0, dwSize + dwSize, 0x1000, 0x40);
if (dwDetour VirtualProtect && ((void *) dwAdress, dwSize, 0x40, e dwProtect))
{
for (i = 0; i <dwSize; i + +)
{
* (BYTE *) (dwDetour + i) = * (BYTE *) (dwAdress + i);
}
switch (dwType)
{
caso Detour_Type_0xE9:
{
* (BYTE *) (dwDetour + dwSize 0) = 0xE9;
* (DWORD *) (+ dwDetour dwSize 1) = (dwAdress-dwDetour-dwSize);
* (BYTE *) (dwAdress 0) = 0xE9;
* (DWORD *) (dwAdress 1) = (dwThread-dwAdress-dwSize);
}
quebrar;
caso Detour_Type_0xB8:
{
* (BYTE *) (dwDetour + dwSize 0) = 0xB8;
* (DWORD *) (+ dwDetour dwSize 1) = (dwAdress dwSize +);
* (WORD *) (dwDetour dwSize + 5) = 0xE0FF;
* (BYTE *) (dwAdress 0) = 0xB8;
* (DWORD *) (dwAdress 1) = (dwThread);
* (WORD *) (dwAdress +5) = 0xE0FF;
}
quebrar;
caso Detour_Type_0x68:
{
* (BYTE *) (dwDetour + dwSize 0) = 0x68;
* (DWORD *) (+ dwDetour dwSize 1) = (dwAdress dwSize +);
* (WORD *) (dwDetour dwSize + 5) = 0xC3;
* (BYTE *) (dwAdress 0) = 0x68;
* (DWORD *) (dwAdress 1) = (dwThread);
* (WORD *) (dwAdress +5) = 0xC3;
}
quebrar;
}
VirtualProtect ((void *) dwAdress, dwSize, dwProtect, e dwProtect);
VirtualProtect ((void *) dwDetour, dwSize + dwSize, 0x20, e dwProtect);
voltar dwDetour;
}
}
Suspensão (15);
retorno (0);
}
/ / Este é o gancho / /
BOOL WINAPI DllMain (hModule HMODULE, DWORD dwReason, LPVOID lpvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH) {
Beep (100,1000);
CreateThread (0, 0, LoopFunction, 0, 0, 0);
}
return true;
}