CA D3D VMT Hook with HS bypass

Posts 1–5 of 5 · Page 1 of 1
CA D3D VMT Hook with HS bypass
Basicly it is a simple VMT hook that rehooks whenever the devicepointer has changed and it 'hooks' the VMT backup from hackshield too.

Code:
DWORD GetAddressPtr(int index)
{
    DWORD dwBase = *(DWORD*)dwDevicePointer;
    if(dwBase == 0) return 0;

    dwBase = *(DWORD*)dwBase;
    if(dwBase == 0) return 0;

    dwBase = *(DWORD*)dwBase;
    if(dwBase == 0) return 0;

    return dwBase+4*index;
}

DWORD GetD3DHSApi(int index)
{
    DWORD dwVA = dwHSDevicePointer;

    if(IsBadReadPtr((void*)dwVA, 4)) return 0;
    
    dwVA = *(DWORD*)dwVA;
    
    if(!dwVA || IsBadReadPtr((void*)dwVA, 0x200)) return 0;
    
    return dwVA + (4*index);
}

#define HOOKD3DAPI(a, b) \
    if(*(DWORD*)GetAddressPtr(b) != (DWORD)&hk##a) { \
        p##a = (a##_t) *(DWORD*)GetAddressPtr(b); \
        *(DWORD*)GetAddressPtr(b) = (DWORD)&hk##a; \
        *(DWORD*)GetD3DHSApi(b) = (DWORD)&hk##a; \
    }


DWORD WINAPI HookD3DApis(LPVOID)
{
    bool bValid = false;
    while(true) {
        bValid = GetAddressPtr(0) > 0;

        if(bValid) {
            HOOKD3DAPI(Reset, 16)
            HOOKD3DAPI(EndScene, 42)
            HOOKD3DAPI(DrawIndexedPrimitive, 82)
            HOOKD3DAPI(SetStreamSource, 100)
        }
        
        Sleep(300);
    }

    return 1;
}
XORStr

Code:
#ifndef _XORSTR_H
#define _XORSTR_H

#pragma once

template <int XORSTART, int BUFLEN, int XREFKILLER>
class XorStr
{
private: 
    XorStr();
public: 
    char s[BUFLEN];

    XorStr(const char* xs);
    ~XorStr(){ for(int i=0;i<BUFLEN;i++)s[i]=0;}
};

template <int XORSTART, int BUFLEN, int XREFKILLER>
XorStr<XORSTART,BUFLEN,XREFKILLER>::XorStr(const char* xs)
{

    int xvalue = XORSTART;
    int i = 0;
    for(;i<(BUFLEN-1);i++) {
        s[i] = xs[i-XREFKILLER]^xvalue;
        xvalue += 1;
        xvalue %= 256;
    }
    s[BUFLEN-1] = 0;


}

#endif
HookD3DApis is a thread

Code:
dwHSDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(ehsvc), 0x90000, (PBYTE)"\x8B\x84\x11\x00\x00\x00\x00\x8B\x8D\xCC\xFD\xFF\xFF\x8B\x95", "xxx????xxxxxxxx");
    if(dwHSDevicePointer) {
        dwHSDevicePointer = *(DWORD*)(dwHSDevicePointer+3);
        dwHSDevicePointer += 0x10;
    }

DWORD dwTempDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(0), (DWORD)0xFFFFFFFF, (PBYTE)"\xA1\x00\x00\x00\x00\x89\x45\xF8\x8D", "x????xxxx");
    if(dwTempDevicePointer) {
        dwDevicePointer = *(DWORD*)(dwTempDevicePointer+1);
    }
ehmm wut is this?
Thanks alot
And where does one play this anyway
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us