Results 1 to 2 of 2
  1. #1
    Coder.Fail's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Posts
    91
    Reputation
    43
    Thanks
    490

    EndScene 23/12/2014

    I donīt know this hook works in Assault Fire, but, I believe yes






    Code:
    #include <windows.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    
    DWORD dwEndscene_hook = NULL;
    DWORD dwEndscene_ret = NULL;
    DWORD *VTable;
    
    LPD3DXFONT pFont;
    
    int text;
    
    VOID WriteText( LPDIRECT3DDEVICE9 pDevice, INT x, INT y, DWORD color, CHAR *text )
    {    
        RECT rect;
        SetRect( &rect, x, y, x, y );
        pFont->DrawText( NULL, text, -1, &rect, DT_NOCLIP | DT_LEFT, color );
    }
    
    void WriteMemory(void *address, void *bytes, int byteSize)
    {
    		DWORD NewProtection;
    
    			VirtualProtect(address, byteSize, PAGE_EXECUTE_READWRITE, &NewProtection);
    			memcpy(address, bytes, byteSize);
    			VirtualProtect(address, byteSize, NewProtection, &NewProtection);
    }
    
    VOID WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
    	if( pFont )
        {
            pFont->Release();
            pFont = NULL;
        }
        if( !pFont )
        {
            D3DXCreateFont( pDevice, 14,0,FW_BOLD,1,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_DONTCARE,"Arial",&pFont );
        }
    
    	if (GetAsyncKeyState(VK_INSERT)&1)
    		text =! text;
    	if( text )
            WriteText( pDevice, 15, 15, D3DCOLOR_ARGB(255,255,000,000), "MPGH Coder.Fail" );
    
    }
    
    __declspec(naked) void MyEndscene( )
    {
    
    	static LPDIRECT3DDEVICE9 pDevice;
    
        __asm
        {
            mov dword ptr ss:[ebp - 10], esp;
            mov esi, dword ptr ss:[ebp + 0x8];
            mov pDevice, esi;
        }
    
    	EndScene(pDevice);
    
        __asm
        {
            jmp dwEndscene_ret;//jump back to normal endscene
        }
     
    }
    
    bool Mask(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
        for(;*szMask;++szMask,++pData,++bMask)
            if(*szMask=='x' && *pData!=*bMask ) 
                return false;
        return (*szMask) == NULL;
    }
    
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
    {
        for(DWORD i=0; i<dwLen; i++)
            if(Mask((BYTE*)(dwAddress + i), bMask, szMask))
                return (DWORD)(dwAddress+i);
        return 0;
    }
    
    void Detour(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen)
    {
        DWORD dwOldProtect, dwBkup, dwRelAddr;
        VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
        dwRelAddr = (DWORD) (dwJumpTo - (DWORD) pAddress) - 5;
        *pAddress = 0xE9;
        *((DWORD *)(pAddress + 0x1)) = dwRelAddr;
        for(DWORD x = 0x5; x < dwLen; x++) *(pAddress + x) = 0x90;
    	VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
        return;
    }
    
    void MyHook( void )
    {
        DWORD hD3D = NULL;
        while (!hD3D) hD3D = (DWORD)GetModuleHandle("d3d9.dll");
        DWORD PPPDevice = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
        WriteMemory( &VTable, (void *)(PPPDevice + 2), 4);
        dwEndscene_hook = VTable[42] + 0x2A;
        dwEndscene_ret = dwEndscene_hook + 0x6;
    
    	Detour((PBYTE)dwEndscene_hook, (DWORD)MyEndscene, 0x6);
    }
    
    BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved)
    {
        if (dwReason == DLL_PROCESS_ATTACH)
        {
            DisableThreadLibraryCalls(hModule);
            CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MyHook, NULL, NULL, NULL);
        }
        return TRUE;
    }
    Credits

    ZeaS
    Coder.Fail
    Shad0w_
    Skype : luislokao98

  2. #2
    x7gamingm's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Location
    Georgia,USA
    Posts
    192
    Reputation
    10
    Thanks
    16
    My Mood
    Hot
    LPD3DXFONT doesn't work #include <d3dx9.h> D3DXCreateFont ("d3d9.dll") all of those have red underlines, also would you like to help me make a wall hack for a game i play named sf2 (soldier front 2)?

Similar Threads

  1. [Outdated] EndScene 23/12/2014
    By Coder.Fail in forum League of Legends Hacks & Cheats
    Replies: 6
    Last Post: 12-30-2014, 07:17 AM
  2. [Source Code] EndScene 23/12/2014
    By Coder.Fail in forum Tibia Hacks
    Replies: 0
    Last Post: 12-23-2014, 04:34 PM
  3. Endscene?
    By mastermods in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 21
    Last Post: 07-24-2010, 01:56 PM
  4. D3D EndScene Hook dont work
    By inmate in forum C++/C Programming
    Replies: 8
    Last Post: 07-20-2010, 06:10 AM
  5. Hook EndScene
    By inmate in forum C++/C Programming
    Replies: 1
    Last Post: 07-18-2010, 05:24 AM