Join date : 01.01.70
| Subyek: New SC Wallhack by ★★★New-Cyber★★★ Sat Nov 26, 2011 11:56 am | |
| Oke Gan Langsung Ajjh Gx Perlu Lama2 ADE32.cpp - Spoiler:
// ADE32 version 2.02c -- C edition
#define WIN32_LEAN_AND_MEAN #define WIN32_EXTRA_LEAN
#include <windows.h>
#include "ADE32.h"
DWORD ade32_table[512] = { /* 00 */ C_MODRM, /* 01 */ C_MODRM, /* 02 */ C_MODRM, /* 03 */ C_MODRM, /* 04 */ C_DATA1, /* 05 */ C_DATA66, /* 06 */ C_BAD, /* 07 */ C_BAD, /* 08 */ C_MODRM, /* 09 */ C_MODRM, /* 0A */ C_MODRM, /* 0B */ C_MODRM, /* 0C */ C_DATA1, /* 0D */ C_DATA66, /* 0E */ C_BAD, /* 0F */ C_OPCODE2, /* 10 */ C_MODRM+C_BAD, /* 11 */ C_MODRM, /* 12 */ C_MODRM+C_BAD, /* 13 */ C_MODRM, /* 14 */ C_DATA1+C_BAD, /* 15 */ C_DATA66+C_BAD, /* 16 */ C_BAD, /* 17 */ C_BAD, /* 18 */ C_MODRM+C_BAD, /* 19 */ C_MODRM, /* 1A */ C_MODRM, /* 1B */ C_MODRM, /* 1C */ C_DATA1+C_BAD, /* 1D */ C_DATA66+C_BAD, /* 1E */ C_BAD, /* 1F */ C_BAD, /* 20 */ C_MODRM, /* 21 */ C_MODRM, /* 22 */ C_MODRM, /* 23 */ C_MODRM, /* 24 */ C_DATA1, /* 25 */ C_DATA66, /* 26 */ C_SEG+C_BAD, /* 27 */ C_BAD, /* 28 */ C_MODRM, /* 29 */ C_MODRM, /* 2A */ C_MODRM, /* 2B */ C_MODRM, /* 2C */ C_DATA1, /* 2D */ C_DATA66, /* 2E */ C_SEG+C_BAD, /* 2F */ C_BAD, /* 30 */ C_MODRM, /* 31 */ C_MODRM, /* 32 */ C_MODRM, /* 33 */ C_MODRM, /* 34 */ C_DATA1, /* 35 */ C_DATA66, /* 36 */ C_SEG+C_BAD, /* 37 */ C_BAD, /* 38 */ C_MODRM, /* 39 */ C_MODRM, /* 3A */ C_MODRM, /* 3B */ C_MODRM, /* 3C */ C_DATA1, /* 3D */ C_DATA66, /* 3E */ C_SEG+C_BAD, /* 3F */ C_BAD, /* 40 */ 0, /* 41 */ 0, /* 42 */ 0, /* 43 */ 0, /* 44 */ C_BAD, /* 45 */ 0, /* 46 */ 0, /* 47 */ 0, /* 48 */ 0, /* 49 */ 0, /* 4A */ 0, /* 4B */ 0, /* 4C */ C_BAD, /* 4D */ 0, /* 4E */ 0, /* 4F */ 0, /* 50 */ 0, /* 51 */ 0, /* 52 */ 0, /* 53 */ 0, /* 54 */ 0, /* 55 */ 0, /* 56 */ 0, /* 57 */ 0, /* 58 */ 0, /* 59 */ 0, /* 5A */ 0, /* 5B */ 0, /* 5C */ C_BAD, /* 5D */ 0, /* 5E */ 0, /* 5F */ 0, /* 60 */ C_BAD, /* 61 */ C_BAD, /* 62 */ C_MODRM+C_BAD, /* 63 */ C_MODRM+C_BAD, /* 64 */ C_SEG, /* 65 */ C_SEG+C_BAD, /* 66 */ C_66, /* 67 */ C_67, /* 68 */ C_DATA66, /* 69 */ C_MODRM+C_DATA66, /* 6A */ C_DATA1, /* 6B */ C_MODRM+C_DATA1, /* 6C */ C_BAD, /* 6D */ C_BAD, /* 6E */ C_BAD, /* 6F */ C_BAD, /* 70 */ C_DATA1+C_REL+C_BAD, /* 71 */ C_DATA1+C_REL+C_BAD, /* 72 */ C_DATA1+C_REL, /* 73 */ C_DATA1+C_REL, /* 74 */ C_DATA1+C_REL, /* 75 */ C_DATA1+C_REL, /* 76 */ C_DATA1+C_REL, /* 77 */ C_DATA1+C_REL, /* 78 */ C_DATA1+C_REL, /* 79 */ C_DATA1+C_REL, /* 7A */ C_DATA1+C_REL+C_BAD, /* 7B */ C_DATA1+C_REL+C_BAD, /* 7C */ C_DATA1+C_REL, /* 7D */ C_DATA1+C_REL, /* 7E */ C_DATA1+C_REL, /* 7F */ C_DATA1+C_REL, /* 80 */ C_MODRM+C_DATA1, /* 81 */ C_MODRM+C_DATA66, /* 82 */ C_MODRM+C_DATA1+C_BAD, /* 83 */ C_MODRM+C_DATA1, /* 84 */ C_MODRM, /* 85 */ C_MODRM, /* 86 */ C_MODRM, /* 87 */ C_MODRM, /* 88 */ C_MODRM, /* 89 */ C_MODRM, /* 8A */ C_MODRM, /* 8B */ C_MODRM, /* 8C */ C_MODRM+C_BAD, /* 8D */ C_MODRM, /* 8E */ C_MODRM+C_BAD, /* 8F */ C_MODRM, /* 90 */ 0, /* 91 */ 0, /* 92 */ 0, /* 93 */ C_BAD, /* 94 */ C_BAD, /* 95 */ C_BAD, /* 96 */ C_BAD, /* 97 */ C_BAD, /* 98 */ C_BAD, /* 99 */ 0, /* 9A */ C_DATA66+C_DATA2+C_BAD, /* 9B */ 0, /* 9C */ C_BAD, /* 9D */ C_BAD, /* 9E */ C_BAD, /* 9F */ C_BAD, /* A0 */ C_ADDR67, /* A1 */ C_ADDR67, /* A2 */ C_ADDR67, /* A3 */ C_ADDR67, /* A4 */ 0, /* A5 */ 0, /* A6 */ 0, /* A7 */ 0, /* A8 */ C_DATA1, /* A9 */ C_DATA66, /* AA */ 0, /* AB */ 0, /* AC */ 0, /* AD */ C_BAD, /* AE */ 0, /* AF */ C_BAD, /* B0 */ C_DATA1, /* B1 */ C_DATA1, /* B2 */ C_DATA1, /* B3 */ C_DATA1, /* B4 */ C_DATA1, /* B5 */ C_DATA1, /* B6 */ C_DATA1+C_BAD, /* B7 */ C_DATA1+C_BAD, /* B8 */ C_DATA66, /* B9 */ C_DATA66, /* BA */ C_DATA66, /* BB */ C_DATA66, /* BC */ C_DATA66+C_BAD, /* BD */ C_DATA66, /* BE */ C_DATA66, /* BF */ C_DATA66, /* C0 */ C_MODRM+C_DATA1, /* C1 */ C_MODRM+C_DATA1, /* C2 */ C_DATA2+C_STOP, /* C3 */ C_STOP, /* C4 */ C_MODRM+C_BAD, /* C5 */ C_MODRM+C_BAD, /* C6 */ C_MODRM+C_DATA1, /* C7 */ C_MODRM+C_DATA66, /* C8 */ C_DATA2+C_DATA1, /* C9 */ 0, /* CA */ C_DATA2+C_STOP+C_BAD, /* CB */ C_STOP+C_BAD, /* CC */ C_BAD, /* CD */ C_BAD, /* CE */ C_BAD, /* CF */ C_STOP+C_BAD, /* D0 */ C_MODRM, /* D1 */ C_MODRM, /* D2 */ C_MODRM, /* D3 */ C_MODRM, /* D4 */ C_DATA1+C_BAD, /* D5 */ C_DATA1+C_BAD, /* D6 */ C_BAD, /* D7 */ C_BAD, /* D8 */ C_MODRM, /* D9 */ C_MODRM, /* DA */ C_MODRM, /* DB */ C_MODRM, /* DC */ C_MODRM, /* DD */ C_MODRM, /* DE */ C_MODRM, /* DF */ C_MODRM, /* E0 */ C_DATA1+C_REL+C_BAD, /* E1 */ C_DATA1+C_REL+C_BAD, /* E2 */ C_DATA1+C_REL, /* E3 */ C_DATA1+C_REL, /* E4 */ C_DATA1+C_BAD, /* E5 */ C_DATA1+C_BAD, /* E6 */ C_DATA1+C_BAD, /* E7 */ C_DATA1+C_BAD, /* E8 */ C_DATA66+C_REL, /* E9 */ C_DATA66+C_REL+C_STOP, /* EA */ C_DATA66+C_DATA2+C_BAD, /* EB */ C_DATA1+C_REL+C_STOP, /* EC */ C_BAD, /* ED */ C_BAD, /* EE */ C_BAD, /* EF */ C_BAD, /* F0 */ C_LOCK+C_BAD, /* F1 */ C_BAD, /* F2 */ C_REP, /* F3 */ C_REP, /* F4 */ C_BAD, /* F5 */ C_BAD, /* F6 */ C_MODRM, /* F7 */ C_MODRM, /* F8 */ 0, /* F9 */ 0, /* FA */ C_BAD, /* FB */ C_BAD, /* FC */ 0, /* FD */ 0, /* FE */ C_MODRM, /* FF */ C_MODRM, /* 00 */ C_MODRM, /* 01 */ C_MODRM, /* 02 */ C_MODRM, /* 03 */ C_MODRM, /* 04 */ C_ERROR, /* 05 */ C_ERROR, /* 06 */ 0, /* 07 */ C_ERROR, /* 08 */ 0, /* 09 */ 0, /* 0A */ 0, /* 0B */ 0, /* 0C */ C_ERROR, /* 0D */ C_ERROR, /* 0E */ C_ERROR, /* 0F */ C_ERROR, /* 10 */ C_ERROR, /* 11 */ C_ERROR, /* 12 */ C_ERROR, /* 13 */ C_ERROR, /* 14 */ C_ERROR, /* 15 */ C_ERROR, /* 16 */ C_ERROR, /* 17 */ C_ERROR, /* 18 */ C_ERROR, /* 19 */ C_ERROR, /* 1A */ C_ERROR, /* 1B */ C_ERROR, /* 1C */ C_ERROR, /* 1D */ C_ERROR, /* 1E */ C_ERROR, /* 1F */ C_ERROR, /* 20 */ C_ERROR, /* 21 */ C_ERROR, /* 22 */ C_ERROR, /* 23 */ C_ERROR, /* 24 */ C_ERROR, /* 25 */ C_ERROR, /* 26 */ C_ERROR, /* 27 */ C_ERROR, /* 28 */ C_ERROR, /* 29 */ C_ERROR, /* 2A */ C_ERROR, /* 2B */ C_ERROR, /* 2C */ C_ERROR, /* 2D */ C_ERROR, /* 2E */ C_ERROR, /* 2F */ C_ERROR, /* 30 */ C_ERROR, /* 31 */ C_ERROR, /* 32 */ C_ERROR, /* 33 */ C_ERROR, /* 34 */ C_ERROR, /* 35 */ C_ERROR, /* 36 */ C_ERROR, /* 37 */ C_ERROR, /* 38 */ C_ERROR, /* 39 */ C_ERROR, /* 3A */ C_ERROR, /* 3B */ C_ERROR, /* 3C */ C_ERROR, /* 3D */ C_ERROR, /* 3E */ C_ERROR, /* 3F */ C_ERROR, /* 40 */ C_ERROR, /* 41 */ C_ERROR, /* 42 */ C_ERROR, /* 43 */ C_ERROR, /* 44 */ C_ERROR, /* 45 */ C_ERROR, /* 46 */ C_ERROR, /* 47 */ C_ERROR, /* 48 */ C_ERROR, /* 49 */ C_ERROR, /* 4A */ C_ERROR, /* 4B */ C_ERROR, /* 4C */ C_ERROR, /* 4D */ C_ERROR, /* 4E */ C_ERROR, /* 4F */ C_ERROR, /* 50 */ C_ERROR, /* 51 */ C_ERROR, /* 52 */ C_ERROR, /* 53 */ C_ERROR, /* 54 */ C_ERROR, /* 55 */ C_ERROR, /* 56 */ C_ERROR, /* 57 */ C_ERROR, /* 58 */ C_ERROR, /* 59 */ C_ERROR, /* 5A */ C_ERROR, /* 5B */ C_ERROR, /* 5C */ C_ERROR, /* 5D */ C_ERROR, /* 5E */ C_ERROR, /* 5F */ C_ERROR, /* 60 */ C_ERROR, /* 61 */ C_ERROR, /* 62 */ C_ERROR, /* 63 */ C_ERROR, /* 64 */ C_ERROR, /* 65 */ C_ERROR, /* 66 */ C_ERROR, /* 67 */ C_ERROR, /* 68 */ C_ERROR, /* 69 */ C_ERROR, /* 6A */ C_ERROR, /* 6B */ C_ERROR, /* 6C */ C_ERROR, /* 6D */ C_ERROR, /* 6E */ C_ERROR, /* 6F */ C_ERROR, /* 70 */ C_ERROR, /* 71 */ C_ERROR, /* 72 */ C_ERROR, /* 73 */ C_ERROR, /* 74 */ C_ERROR, /* 75 */ C_ERROR, /* 76 */ C_ERROR, /* 77 */ C_ERROR, /* 78 */ C_ERROR, /* 79 */ C_ERROR, /* 7A */ C_ERROR, /* 7B */ C_ERROR, /* 7C */ C_ERROR, /* 7D */ C_ERROR, /* 7E */ C_ERROR, /* 7F */ C_ERROR, /* 80 */ C_DATA66+C_REL, /* 81 */ C_DATA66+C_REL, /* 82 */ C_DATA66+C_REL, /* 83 */ C_DATA66+C_REL, /* 84 */ C_DATA66+C_REL, /* 85 */ C_DATA66+C_REL, /* 86 */ C_DATA66+C_REL, /* 87 */ C_DATA66+C_REL, /* 88 */ C_DATA66+C_REL, /* 89 */ C_DATA66+C_REL, /* 8A */ C_DATA66+C_REL, /* 8B */ C_DATA66+C_REL, /* 8C */ C_DATA66+C_REL, /* 8D */ C_DATA66+C_REL, /* 8E */ C_DATA66+C_REL, /* 8F */ C_DATA66+C_REL, /* 90 */ C_MODRM, /* 91 */ C_MODRM, /* 92 */ C_MODRM, /* 93 */ C_MODRM, /* 94 */ C_MODRM, /* 95 */ C_MODRM, /* 96 */ C_MODRM, /* 97 */ C_MODRM, /* 98 */ C_MODRM, /* 99 */ C_MODRM, /* 9A */ C_MODRM, /* 9B */ C_MODRM, /* 9C */ C_MODRM, /* 9D */ C_MODRM, /* 9E */ C_MODRM, /* 9F */ C_MODRM, /* A0 */ 0, /* A1 */ 0, /* A2 */ 0, /* A3 */ C_MODRM, /* A4 */ C_MODRM+C_DATA1, /* A5 */ C_MODRM, /* A6 */ C_ERROR, /* A7 */ C_ERROR, /* A8 */ 0, /* A9 */ 0, /* AA */ 0, /* AB */ C_MODRM, /* AC */ C_MODRM+C_DATA1, /* AD */ C_MODRM, /* AE */ C_ERROR, /* AF */ C_MODRM, /* B0 */ C_MODRM, /* B1 */ C_MODRM, /* B2 */ C_MODRM, /* B3 */ C_MODRM, /* B4 */ C_MODRM, /* B5 */ C_MODRM, /* B6 */ C_MODRM, /* B7 */ C_MODRM, /* B8 */ C_ERROR, /* B9 */ C_ERROR, /* BA */ C_MODRM+C_DATA1, /* BB */ C_MODRM, /* BC */ C_MODRM, /* BD */ C_MODRM, /* BE */ C_MODRM, /* BF */ C_MODRM, /* C0 */ C_MODRM, /* C1 */ C_MODRM, /* C2 */ C_ERROR, /* C3 */ C_ERROR, /* C4 */ C_ERROR, /* C5 */ C_ERROR, /* C6 */ C_ERROR, /* C7 */ C_ERROR, /* C8 */ 0, /* C9 */ 0, /* CA */ 0, /* CB */ 0, /* CC */ 0, /* CD */ C_DATA1, /* CE */ 0, /* CF */ 0, /* D0 */ C_ERROR, /* D1 */ C_ERROR, /* D2 */ C_ERROR, /* D3 */ C_ERROR, /* D4 */ C_ERROR, /* D5 */ C_ERROR, /* D6 */ C_ERROR, /* D7 */ C_ERROR, /* D8 */ C_ERROR, /* D9 */ C_ERROR, /* DA */ C_ERROR, /* DB */ C_ERROR, /* DC */ C_ERROR, /* DD */ C_ERROR, /* DE */ C_ERROR, /* DF */ C_ERROR, /* E0 */ C_ERROR, /* E1 */ C_ERROR, /* E2 */ C_ERROR, /* E3 */ C_ERROR, /* E4 */ C_ERROR, /* E5 */ C_ERROR, /* E6 */ C_ERROR, /* E7 */ C_ERROR, /* E8 */ C_ERROR, /* E9 */ C_ERROR, /* EA */ C_ERROR, /* EB */ C_ERROR, /* EC */ C_ERROR, /* ED */ C_ERROR, /* EE */ C_ERROR, /* EF */ C_ERROR, /* F0 */ C_ERROR, /* F1 */ C_ERROR, /* F2 */ C_ERROR, /* F3 */ C_ERROR, /* F4 */ C_ERROR, /* F5 */ C_ERROR, /* F6 */ C_ERROR, /* F7 */ C_ERROR, /* F8 */ C_ERROR, /* F9 */ C_ERROR, /* FA */ C_ERROR, /* FB */ C_ERROR, /* FC */ C_ERROR, /* FD */ C_ERROR, /* FE */ C_ERROR, /* FF */ C_ERROR }; // ade32_table[]
int disasm(BYTE* opcode0, disasm_struct* diza){ BYTE* opcode = opcode0;
memset(diza, 0x00, sizeof(disasm_struct)); diza->disasm_defdata = 4; diza->disasm_defaddr = 4;
if(*(WORD*)opcode == 0x0000) return 0; if(*(WORD*)opcode == 0xFFFF) return 0;
DWORD flag = 0;
repeat_prefix:
BYTE c = *opcode++; DWORD t = ade32_table[ c ];
if(t & C_ANYPREFIX){ if(flag & t) return 0;
flag |= t;
if(t & C_67) diza->disasm_defaddr ^= 2^4; else if(t & C_66) diza->disasm_defdata ^= 2^4; else if(t & C_SEG) diza->disasm_seg = c; else if(t & C_REP) diza->disasm_rep = c; // LOCK
goto repeat_prefix; } // C_ANYPREFIX
flag |= t; diza->disasm_opcode = c;
if(c == 0x0F){ c = *opcode++; diza->disasm_opcode2 = c; flag |= ade32_table[256+c]; // 2nd flagtable half
if(flag == C_ERROR) return 0; }else if(c == 0xF7){ if(((*opcode) & 0x38) == 0) flag |= C_DATA66; }else if(c == 0xF6){ if(((*opcode) & 0x38) == 0) flag |= C_DATA1; }else if(c == 0xCD){ if(*opcode == 0x20) flag |= C_DATA4; }
if(flag & C_MODRM){ c = *opcode++; diza->disasm_modrm = c;
if(((c & 0x38) == 0x20) && (diza->disasm_opcode == 0xFF)) flag |= C_STOP;
BYTE mod = c & 0xC0; BYTE rm = c & 0x07;
if(mod != 0xC0){ if(diza->disasm_defaddr == 4){ if(rm == 4){ flag |= C_SIB; c = *opcode++; diza->disasm_sib = c; rm = c & 0x07; }
if(mod == 0x40) flag |= C_ADDR1; else if(mod == 0x80) flag |= C_ADDR4; else if (rm == 5) flag |= C_ADDR4; }else{ // MODRM 16-bit if(mod == 0x40) flag |= C_ADDR1; else if(mod == 0x80) flag |= C_ADDR2; else if(rm == 6) flag |= C_ADDR2; } } } // C_MODRM
diza->disasm_flag = flag;
DWORD a = flag & (C_ADDR1 | C_ADDR2 | C_ADDR4); DWORD d = (flag & (C_DATA1 | C_DATA2 | C_DATA4)) >> 8;
if(flag & C_ADDR67) a += diza->disasm_defaddr; if(flag & C_DATA66) d += diza->disasm_defdata;
diza->disasm_addrsize = a; diza->disasm_datasize = d;
DWORD i; for(i = 0; i < a; i++) diza->disasm_addr_b[i] = *opcode++;
for(i = 0; i < d; i++) diza->disasm_data_b[i] = *opcode++;
diza->disasm_len = opcode - opcode0;
return diza->disasm_len; } // disasm()
int oplen(BYTE *opcode){ disasm_struct diza; memset(&diza,0,sizeof(diza));
disasm((BYTE*)opcode,&diza);
if((diza.disasm_flag == C_ERROR) || ((diza.disasm_flag&C_STOP) == C_STOP) || ((diza.disasm_flag&C_REL)==C_REL) || ((diza.disasm_flag&C_BAD)==C_BAD)) return -1;
return diza.disasm_len; }
ADE32.h - Spoiler:
// ADE32 v2.02c by z0mbie
#ifndef __ADE32_H__ #define __ADE32_H__
#define C_ERROR 0xFFFFFFFF #define C_ADDR1 0x00000001 #define C_ADDR2 0x00000002 #define C_ADDR4 0x00000004 #define C_LOCK 0x00000008 #define C_67 0x00000010 #define C_66 0x00000020 #define C_REP 0x00000040 #define C_SEG 0x00000080 #define C_ANYPREFIX (C_66+C_67+C_LOCK+C_REP+C_SEG) #define C_DATA1 0x00000100 #define C_DATA2 0x00000200 #define C_DATA4 0x00000400 #define C_SIB 0x00000800 #define C_ADDR67 0x00001000 #define C_DATA66 0x00002000 #define C_MODRM 0x00004000 #define C_BAD 0x00008000 #define C_OPCODE2 0x00010000 #define C_REL 0x00020000 #define C_STOP 0x00040000
#pragma pack(push) #pragma pack(1)
struct disasm_struct { BYTE disasm_defaddr; // 00 BYTE disasm_defdata; // 01 DWORD disasm_len; // 02 03 04 05 DWORD disasm_flag; // 06 07 08 09 DWORD disasm_addrsize; // 0A 0B 0C 0D DWORD disasm_datasize; // 0E 0F 10 11 BYTE disasm_rep; // 12 BYTE disasm_seg; // 13 BYTE disasm_opcode; // 14 BYTE disasm_opcode2; // 15 BYTE disasm_modrm; // 16 BYTE disasm_sib; // 17
union { BYTE disasm_addr_b[8]; // 18 19 1A 1B 1C 1D 1E 1F WORD disasm_addr_w[4]; DWORD disasm_addr_d[2]; char disasm_addr_c[8]; short disasm_addr_s[4]; long disasm_addr_l[2]; };
union { BYTE disasm_data_b[8]; // 20 21 22 23 24 25 26 27 WORD disasm_data_w[4]; DWORD disasm_data_d[2]; char disasm_data_c[8]; short disasm_data_s[4]; long disasm_data_l[2]; }; }; // disasm_struct
#pragma pack(pop)
int disasm(BYTE* opcode0, disasm_struct* diza); int oplen(BYTE* opcode);
#endif // __ADE32_H__
New_Cyber .cpp - Spoiler:
/**************************************************************************************************************************************************************************************************************/ #pragma once #define WIN32_LEAN_AND_MEAN #include <stdio.h> #include <d3d9.h> #include <d3dx9.h> #include <fstream> #include "detoursx.h" /**************************************************************************************************************************************************************************************************************/ LPDIRECT3DTEXTURE9 texYellow, texRed, texGreen, texBlue, texBlack, texWhite, texPink, texOrange, texLightBlue, texCyan, texPurple, texSteelBlue, texLightSteelBlue, texSalmon, texBrown, texTeal, texLime, texElectricLime, texGold, texOrangeRed, texGreenYellow, texAquaMarine, texSkyBlue, texSlateBlue, texCrimson, texDarkOliveGreen, texPaleGreen, texDarkGoldenRod, texFireBrick, texDarkBlue, texDarkerBlue, texDarkYellow, texLightYellow; /**************************************************************************************************************************************************************************************************************/ #pragma comment(lib, "d3d9.lib") bool CekHook=false; bool Chams=false; bool Chams1=false; bool Generate=false; #pragma comment(lib, "d3dx9.lib") /**************************************************************************************************************************************************************************************************************/ int hack1 = 0; int hack2 = 0; int hack3 = 0; int hack4 = 0; int hack5 = 0; int cross = 0; int redt2 = 0; int ScreenCenterX = ( GetSystemMetrics( 0 ) / 2); int ScreenCenterY = ( GetSystemMetrics( 1 ) / 2); /**************************************************************************************************************************************************************************************************************/ #define D3DparamX , UINT paramx #define D3DparamvalX , paramx #define vsprintf #define smoke (nNumVertices == 192 || nPrimitiveCount == 52 || nNumVertices == 256) /**************************************************************************************************************************************************************************************************************/ LPD3DXFONT g_pFont = NULL; LPD3DXLINE g_pLine = NULL; D3DVIEWPORT9 g_ViewPort; //ViewPort LPDIRECT3DDEVICE9 pDevice = 0; LPDIRECT3DDEVICE9 npDevice; UINT OffsetInBytes; UINT m_Stride; /******** GenerateTexture ******************************************************************************************************************************************************************************************************/ 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)<< |(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; } /**************************************************************************************************************************************************************************************************************/ PVOID D3Ddiscover(void *tbl, int size) { HWND hWnd; void *pInterface=0 ; D3DPRESENT_PARAMETERS d3dpp; if ((hWnd=CreateWindowEx(NULL,WC_DIALOG,"",WS_OVERLAPPED,0,0,50,50,NULL,NULL,NULL,NULL))==NULL) return 0; ShowWindow(hWnd, SW_HIDE); LPDIRECT3D9 pD3D; LPDIRECT3DDEVICE9 pD3Ddev; if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION))!=NULL) { ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hWnd; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferWidth = d3dpp.BackBufferHeight = 600; pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pD3Ddev); if (pD3Ddev) { pInterface = (PDWORD)*(DWORD *)pD3Ddev; memcpy(tbl,(void *)pInterface,size); pD3Ddev->Release(); } pD3D->Release(); } DestroyWindow(hWnd); return pInterface; } /**************************************************************************************************************************************************************************************************************/ void EraseHeaders(HINSTANCE hModule) { /* * just a func to erase headers by Croner. * keep in mind you wont be able to load * any resources after you erase headers. */ PIMAGE_DOS_HEADER pDoH; PIMAGE_NT_HEADERS pNtH; DWORD i, ersize, protect; if (!hModule) return; // well just to make clear what we doing pDoH = (PIMAGE_DOS_HEADER)(hModule); pNtH = (PIMAGE_NT_HEADERS)((LONG)hModule + ((PIMAGE_DOS_HEADER)hModule)->e_lfanew); ersize = sizeof(IMAGE_DOS_HEADER); if ( VirtualProtect(pDoH, ersize, PAGE_READWRITE, &protect) ) { for ( i=0; i < ersize; i++ ) *(BYTE*)((BYTE*)pDoH + i) = 0; } ersize = sizeof(IMAGE_NT_HEADERS); if ( pNtH && VirtualProtect(pNtH, ersize, PAGE_READWRITE, &protect) ) { for ( i=0; i < ersize; i++ ) *(BYTE*)((BYTE*)pNtH + i) = 0; } return; } /**************************************************************************************************************************************************************************************************************/ void DrawString(int x, int y, DWORD color, const char *fmt, ...) { RECT FontPos = { x, y, x + 120, y + 16 }; char buf[1024] = {'\0'}; va_list va_alist; va_start(va_alist, fmt); vsprintf_s(buf, fmt, va_alist); va_end(va_alist); g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color); } /**************************************************************************************************************************************************************************************************************/ typedef HRESULT (WINAPI* oDrawIndexedPrimitive) (LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount); oDrawIndexedPrimitive pDrawIndexedPrimitive; typedef HRESULT (WINAPI* oEndScene)(LPDIRECT3DDEVICE9 pDevice); oEndScene pEndScene; /**************************************************************************************************************************************************************************************************************/ HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice) { if(g_pFont == NULL) { D3DXCreateFont(pDevice, 30, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Comic Sans MS", &g_pFont); //Create fonts } if(g_pLine == NULL) D3DXCreateLine(pDevice, &g_pLine); //Create lines DrawString(280, 10, 0xFFFF0000, ".: |>> T A U F I K _ [J] u N I o [R] <<||::."); DrawString(240, 720, 0xFF0000FF, ".: |>> [You must be registered and logged in to see this link.] <<||::."); return pEndScene(pDevice); OutputDebugString("EndScene: hooked"); } /**************************************************************************************************************************************************************************************************************/ inline HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE pType D3DparamX ,UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount ) { __asm { mov ecx,[ebp+32] mov edx,[ebp+28] PUSHAD; } if (Generate) { GenerateTexture(pDevice, &texGreen , D3DCOLOR_ARGB(255,0,255,0)); GenerateTexture(pDevice, &texRed , D3DCOLOR_ARGB(255,255,0,0)); GenerateTexture(pDevice, &texBlue , D3DCOLOR_ARGB(255,0,0,255)); GenerateTexture(pDevice, &texOrange , D3DCOLOR_ARGB(255,255,165,0)); GenerateTexture(pDevice, &texYellow , D3DCOLOR_ARGB(255,255,255,0)); GenerateTexture(pDevice, &texPink , D3DCOLOR_ARGB(255,255,192,203)); GenerateTexture(pDevice, &texCyan , D3DCOLOR_ARGB(255,0,255,255)); GenerateTexture(pDevice, &texPurple , D3DCOLOR_ARGB(255,160,32,240)); GenerateTexture(pDevice, &texBlack , D3DCOLOR_ARGB(255,0,0,0)); GenerateTexture(pDevice, &texWhite , D3DCOLOR_ARGB(255,255,255,255)); GenerateTexture(pDevice, &texSteelBlue , D3DCOLOR_ARGB(255,33,104,140)); GenerateTexture(pDevice, &texLightSteelBlue, D3DCOLOR_ARGB(255,201,255,255)); GenerateTexture(pDevice, &texLightBlue , D3DCOLOR_ARGB(255,26,140,306)); GenerateTexture(pDevice, &texSalmon , D3DCOLOR_ARGB(255,196,112,112)); GenerateTexture(pDevice, &texBrown , D3DCOLOR_ARGB(255,168,99,20)); GenerateTexture(pDevice, &texTeal , D3DCOLOR_ARGB(255,38,140,140)); GenerateTexture(pDevice, &texLime , D3DCOLOR_ARGB(255,50,205,50)); GenerateTexture(pDevice, &texElectricLime , D3DCOLOR_ARGB(255,204,255,0)); GenerateTexture(pDevice, &texGold , D3DCOLOR_ARGB(255,255, 215, 0)); GenerateTexture(pDevice, &texOrangeRed , D3DCOLOR_ARGB(255,255,69,0)); GenerateTexture(pDevice, &texGreenYellow , D3DCOLOR_ARGB(255,173,255,47)); GenerateTexture(pDevice, &texAquaMarine , D3DCOLOR_ARGB(255,127,255,212)); GenerateTexture(pDevice, &texSkyBlue , D3DCOLOR_ARGB(255,0,191,255)); GenerateTexture(pDevice, &texSlateBlue , D3DCOLOR_ARGB(255,132, 112, 255)); GenerateTexture(pDevice, &texCrimson , D3DCOLOR_ARGB(255,220,20,60)); GenerateTexture(pDevice, &texDarkOliveGreen, D3DCOLOR_ARGB(255,188,238,104 )); GenerateTexture(pDevice, &texPaleGreen , D3DCOLOR_ARGB(255,154,255, 154)); GenerateTexture(pDevice, &texDarkGoldenRod , D3DCOLOR_ARGB(255,255, 185, 15 )); GenerateTexture(pDevice, &texFireBrick , D3DCOLOR_ARGB(255,255,48,48)); GenerateTexture(pDevice, &texDarkBlue , D3DCOLOR_ARGB(255,0,0,204)); GenerateTexture(pDevice, &texDarkerBlue , D3DCOLOR_ARGB(255,0,0,153)); GenerateTexture(pDevice, &texDarkYellow , D3DCOLOR_ARGB(255,255,204,0)); GenerateTexture(pDevice, &texLightYellow , D3DCOLOR_ARGB(255,255,255,153)); Generate = false; } LPDIRECT3DVERTEXBUFFER9 Stream_Data; UINT Offset = 0; UINT Stride = 0; if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK) Stream_Data->Release(); //=========================================== WH KACA ====================================/ if (GetAsyncKeyState(VK_INSERT)&1) { hack1 = !hack1; MessageBeep(1);} if (hack1 == 1){ DWORD SumStride=Stride+nPrimitiveCount+nStartIndex+nNumVertices; if(Stride == 0) { CekHook=true; SumStride=SumStride+4;} if (Stride==48) CekHook=true; if (Stride==52) CekHook=true; if (Stride==0x24) CekHook=true; if (Stride==64) CekHook=true; //myfile << "DIP is hooked\n"%Stride; //Check log if (CekHook==true){ pDevice->SetRenderState(D3DRS_ZENABLE, false); pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount); pDevice->SetRenderState(D3DRS_ZENABLE, true); pDevice->SetRenderState(D3DRS_ZENABLE,false); CekHook=false;}} //=========================================== WH JABLAY ====================================/ if (GetAsyncKeyState(VK_DELETE)&1) { hack2 = !hack2; MessageBeep(1);} if(hack2 == 1){ if( Stride == 44) pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME );} else{ pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );} //=========================================== NO SMOKE ====================================/ if (GetAsyncKeyState(VK_F12)&1) { hack4 = !hack4; MessageBeep(1);} if(hack4) { if( Stride == 24 ){ pDevice->SetRenderState(D3DRS_ZENABLE, true); } } //=========================================== CROSSHAIR ====================================/ if (GetAsyncKeyState(VK_F11)&1) { hack3 = !hack3; MessageBeep(1);} if(hack3 == 1) { int ScreenCenterX = ( GetSystemMetrics( 0 ) / 2); int ScreenCenterY = ( GetSystemMetrics( 1 ) / 2); D3DCOLOR redt2 = D3DCOLOR_XRGB( 200, 255, 255 ); //Yellow D3DRECT rec4 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+1}; D3DRECT rec5 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 1,ScreenCenterY+20}; pDevice->Clear(1, &rec4, D3DCLEAR_TARGET,redt2, 0, 0); pDevice->Clear(1, &rec5, D3DCLEAR_TARGET,redt2, 0, 0); } /*******************************************************************************************************************************************************************************************************/ if (GetAsyncKeyState(VK_HOME)&1) { Chams = !Chams; MessageBeep(1);} if (Chams == 1) if (Stride==44) { pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); pDevice->SetTexture(0, texRed); pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount); pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); } if (GetAsyncKeyState(VK_END)&1) { Chams1 = !Chams1; MessageBeep(1);} if (Chams1 == 1) if (Stride==52) { pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); pDevice->SetTexture(0, texWhite); pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount); pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); } __asm popad; return pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount); } /**************************************************************************************************************************************************************************************************************/ void HideModule(HINSTANCE hModule) { DWORD dwPEB_LDR_DATA = 0; _asm { pushad; pushfd; mov eax, fs:[30h] mov eax, [eax+0Ch] mov dwPEB_LDR_DATA, eax InLoadOrderModuleList: mov esi, [eax+0Ch] mov edx, [eax+10h] LoopInLoadOrderModuleList: lodsd mov esi, eax mov ecx, [eax+18h] cmp ecx, hModule jne SkipA mov ebx, [eax] mov ecx, [eax+4] mov [ecx], ebx mov [ebx+4], ecx jmp InMemoryOrderModuleList SkipA: cmp edx, esi jne LoopInLoadOrderModuleList InMemoryOrderModuleList: mov eax, dwPEB_LDR_DATA mov esi, [eax+14h] mov edx, [eax+18h] LoopInMemoryOrderModuleList: lodsd mov esi, eax mov ecx, [eax+10h] cmp ecx, hModule jne SkipB mov ebx, [eax] mov ecx, [eax+4] mov [ecx], ebx mov [ebx+4], ecx jmp InInitializationOrderModuleList SkipB: cmp edx, esi jne LoopInMemoryOrderModuleList InInitializationOrderModuleList: mov eax, dwPEB_LDR_DATA mov esi, [eax+1Ch] mov edx, [eax+20h] LoopInInitializationOrderModuleList: lodsd mov esi, eax mov ecx, [eax+08h] cmp ecx, hModule jne SkipC mov ebx, [eax] mov ecx, [eax+4] mov [ecx], ebx mov [ebx+4], ecx jmp Finished SkipC: cmp edx, esi jne LoopInInitializationOrderModuleList Finished: popfd; popad; } } /**************************************************************************************************************************************************************************************************************/ bool hooked = false; int D3D(void) { HINSTANCE hD3D; DWORD vTable[105]; hD3D=0; do { hD3D = GetModuleHandle("d3d9.dll"); if (!hD3D) Sleep(100); } while(!hD3D); if (D3Ddiscover((void *)&vTable[0],420)==0) return 0; { while(1) { if(memcmp((void*)vTable[82],(void*)(PBYTE)"\x8B\xFF",2)== 0) { pDrawIndexedPrimitive = (oDrawIndexedPrimitive) DetourCreate((PBYTE)vTable[82], (PBYTE)myDrawIndexedPrimitive, 5); pEndScene = (oEndScene) DetourCreate((PBYTE)vTable[42], (PBYTE)hkEndScene, 5); } Sleep(50); } return 0; } } /**************************************************************************************************************************************************************************************************************/ BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved) { DisableThreadLibraryCalls(hDll); if (dwReason == DLL_PROCESS_ATTACH) { MessageBox(0,";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;By T A U F I K _ J R || A G U S _ J R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n-------------------------------------------------------------------------------\n [-] WH Chamz TERO [HOME]\n [-] WH Chamz CT [END]\n [-] WH Jablay [DELETE]\n [-] CROSS HAIR [F11]\n [-] WH GLASS [INSERT]\n [-] NO Smoke [F12]\n-------------------------------------------------------------------------------\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;By T A U F I K _ J R || A G U S _ J R;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;", "By TAUFIK_JR || AGUS_JR",MB_OK); MessageBox (0,"|========NOT FOR SHARE========|"," ¨T A U F I K _ J R || A G U S _ J R¨ ", MB_OK); MessageBox (0,"|========TAUFIKSAY@YAHOO.CO.ID========|"," ¨T A U F I K _ J R || A G U S _ J R¨ ", MB_OK); MessageBox (0,"|========AGAY_I@YAHOO.COM========|"," ¨T A U F I K _ J R || A G U S _ J R¨ ", MB_OK); MessageBox (0,"|========TAUFIK_[J]uNIo[R]========|","T A U F I K _ J R || A G U S _ J R", MB_OK | MB_ICONEXCLAMATION); MessageBox (0,"|========TAUFIK_[J]uNIo[R]========|","T A U F I K _ J R || A G U S _ J R", MB_OK | MB_ICONEXCLAMATION); MessageBox (0,"|========AGUS_[J]uNIo[R]========|","T A U F I K _ J R || A G U S _ J R", MB_OK | MB_ICONEXCLAMATION); MessageBox (0,"|========AGUS_[J]uNIo[R]========|","T A U F I K _ J R || A G U S _ J R", MB_OK | MB_ICONEXCLAMATION); HideModule(hDll); EraseHeaders(hDll); CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3D, NULL, NULL, NULL); } else if(dwReason == DLL_PROCESS_DETACH) { DetourRemove(pDrawIndexedPrimitive); return TRUE; } return FALSE; } /******************************************************************************************************************************************* detoursx.h - Spoiler:
/* Name: DetourXS Description: DetourXS is a library for function detouring Version: 1.0 Author: Sinner Credits: z0mbie (ADE32), LanceVorgin's CDetour (some ideas) */
#define WIN32_LEAN_AND_MEAN #define WIN32_EXTRA_LEAN
#include <windows.h>
#include "ADE32.h"
//#pragma comment(lib, "detourxs")
#include <windows.h>
#define DETOUR_LEN_AUTO 0 // Finds the detour length automatically
enum { DETOUR_TYPE_JMP, // min detour len: 5 DETOUR_TYPE_PUSH_RET, // min detour len: 6 DETOUR_TYPE_NOP_JMP, // min detour len: 6 DETOUR_TYPE_NOP_NOP_JMP, // min detour len: 7 DETOUR_TYPE_STC_JC, // min detour len: 7 DETOUR_TYPE_CLC_JNC, // min detour len: 7 };
LPVOID DetourCreate(LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen=DETOUR_LEN_AUTO); LPVOID DetourCreate(LPCSTR lpModuleName, LPCSTR lpProcName, LPVOID lpFuncDetour, int patchType, int detourLen=DETOUR_LEN_AUTO); BOOL DetourRemove(LPVOID lpDetourCreatePtr);
#pragma warning(disable: 4311) #pragma warning(disable: 4312) #pragma warning(disable: 4244)
#define DETOUR_MAX_SRCH_OPLEN 64
#define JMP32_SZ 5 #define BIT32_SZ 4
// jmp32 sig #define SIG_SZ 3 #define SIG_OP_0 0xCC #define SIG_OP_1 0x90 #define SIG_OP_2 0xC3
static DWORD dwOldProt;
int GetDetourLen(int patchType); int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen);
// Thin wrapper for APIs LPVOID DetourCreate(LPCSTR lpModuleName, LPCSTR lpProcName, LPVOID lpFuncDetour, int patchType, int detourLen) { LPVOID lpFuncOrig = NULL;
if((lpFuncOrig = GetProcAddress(GetModuleHandle(lpModuleName), lpProcName)) == NULL) return NULL;
return DetourCreate(lpFuncOrig, lpFuncDetour, patchType, detourLen); }
LPVOID DetourCreate(LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen) { LPVOID lpMallocPtr = NULL; DWORD dwProt = NULL; PBYTE pbMallocPtr = NULL; PBYTE pbFuncOrig = (PBYTE)lpFuncOrig; PBYTE pbFuncDetour = (PBYTE)lpFuncDetour; PBYTE pbPatchBuf = NULL; int minDetLen = 0; int detLen = 0;
// Get detour length if((minDetLen = GetDetourLen(patchType)) == 0) return NULL;
if(detourLen != DETOUR_LEN_AUTO) detLen = detourLen;
else if((detLen = GetDetourLenAuto(pbFuncOrig, minDetLen)) < minDetLen) return NULL;
// Alloc mem for the overwritten bytes if((lpMallocPtr = (LPVOID)malloc(detLen+JMP32_SZ+SIG_SZ)) == NULL) return NULL;
pbMallocPtr = (PBYTE)lpMallocPtr;
// Enable writing to original VirtualProtect(lpFuncOrig, detLen, PAGE_READWRITE, &dwProt);
// Write overwritten bytes to the malloc memcpy(lpMallocPtr, lpFuncOrig, detLen); pbMallocPtr += detLen; pbMallocPtr[0] = 0xE9; *(DWORD*)(pbMallocPtr+1) = (DWORD)((pbFuncOrig+detLen)-pbMallocPtr)-JMP32_SZ; pbMallocPtr += JMP32_SZ; pbMallocPtr[0] = SIG_OP_0; pbMallocPtr[1] = SIG_OP_1; pbMallocPtr[2] = SIG_OP_2;
// Create a buffer to prepare the detour bytes pbPatchBuf = new BYTE[detLen]; memset(pbPatchBuf, 0x90, detLen);
switch(patchType) { case DETOUR_TYPE_JMP: pbPatchBuf[0] = 0xE9; *(DWORD*)&pbPatchBuf[1] = (DWORD)(pbFuncDetour - pbFuncOrig) - 5; break;
case DETOUR_TYPE_PUSH_RET: pbPatchBuf[0] = 0x68; *(DWORD*)&pbPatchBuf[1] = (DWORD)pbFuncDetour; pbPatchBuf[5] = 0xC3; break;
case DETOUR_TYPE_NOP_JMP: pbPatchBuf[0] = 0x90; pbPatchBuf[1] = 0xE9; *(DWORD*)&pbPatchBuf[2] = (DWORD)(pbFuncDetour - pbFuncOrig) - 6; break;
case DETOUR_TYPE_NOP_NOP_JMP: pbPatchBuf[0] = 0x90; pbPatchBuf[1] = 0x90; pbPatchBuf[2] = 0xE9; *(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7; break;
case DETOUR_TYPE_STC_JC: pbPatchBuf[0] = 0xF9; pbPatchBuf[1] = 0x0F; pbPatchBuf[2] = 0x82; *(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7; break;
case DETOUR_TYPE_CLC_JNC: pbPatchBuf[0] = 0xF8; pbPatchBuf[1] = 0x0F; pbPatchBuf[2] = 0x83; *(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7; break;
default: return NULL; }
// Write the detour for(int i=0; i<detLen; i++) pbFuncOrig[i] = pbPatchBuf[i];
delete [] pbPatchBuf;
// Reset original mem flags VirtualProtect(lpFuncOrig, detLen, dwProt, &dwOldProt);
return lpMallocPtr; }
BOOL DetourRemove(LPVOID lpDetourCreatePtr) { PBYTE pbMallocPtr = NULL; DWORD dwFuncOrig = NULL; DWORD dwProt = NULL; int i=0;
if((pbMallocPtr = (PBYTE)lpDetourCreatePtr) == NULL) return FALSE;
// Find the orig jmp32 opcode sig for(i=0; i<=DETOUR_MAX_SRCH_OPLEN; i++) { if(pbMallocPtr[i] == SIG_OP_0 && pbMallocPtr[i+1] == SIG_OP_1 && pbMallocPtr[i+2] == SIG_OP_2) break;
if(i == DETOUR_MAX_SRCH_OPLEN) return FALSE; }
// Calculate the original address pbMallocPtr += (i-JMP32_SZ+1); // Inc to jmp dwFuncOrig = *(DWORD*)pbMallocPtr; // Get 32bit jmp pbMallocPtr += BIT32_SZ; // Inc to end of jmp dwFuncOrig += (DWORD)pbMallocPtr; // Add this addr to 32bit jmp dwFuncOrig -= (i-JMP32_SZ); // Dec by detour len to get to start of orig
// Write the overwritten bytes back to the original VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), PAGE_READWRITE, &dwProt); memcpy((LPVOID)dwFuncOrig, lpDetourCreatePtr, (i-JMP32_SZ)); VirtualProtect((LPVOID)dwFuncOrig, (i-JMP32_SZ), dwProt, &dwOldProt);
// Memory cleanup free(lpDetourCreatePtr);
return TRUE; }
int GetDetourLen(int patchType) { switch(patchType) { case DETOUR_TYPE_JMP: return 5;
case DETOUR_TYPE_PUSH_RET: case DETOUR_TYPE_NOP_JMP: return 6;
case DETOUR_TYPE_NOP_NOP_JMP: case DETOUR_TYPE_STC_JC: case DETOUR_TYPE_CLC_JNC: return 7;
default: return 0; } }
int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen) { int len = 0; PBYTE pbCurOp = pbFuncOrig;
while(len < minDetLen) { int i = oplen(pbCurOp);
if(i == 0 || i == -1) return 0;
if(len > DETOUR_MAX_SRCH_OPLEN) return 0;
len += i; pbCurOp += i; }
return len; }
harap di manfaat kan dengan sebaik2 nya ??
CONTOH SC TERSEBUT BERTAHAN 5MENIT
UNTUK LEBIHNYA EDIT SC TERSEBUT MENURUT FELLING ANDA SENDIRI
UNTUK BAHAN2 | |
|