Results 1 to 4 of 4
  1. #1
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,648
    My Mood
    Bored

    D3D9 Test [EndScene don't work]

    Hey guys i have a problem with the endscene...

    That's my code:

    Code:
    #pragma once
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    #include <windows.h>
    #include <cstdio>
    #include <d3d9.h>
    #include <d3dx9.h>
    
    typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
    EndScene_t pEndScene;
    
    void *DetourFunc(BYTE *src, const BYTE *dst, const int len) // credits to *************
    {
    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;
    VirtualProtect(src, len, dwback, &dwback);
    return (jmp-len);
    }
    
    const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grün, Blau
    
    void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
    {
    D3DRECT rect = {X, Y, X+L, Y+H};
    Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); // bei Google gibt’s näheres
    }
    
    
    
    
    
    
    
    
    HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice) 
    {
    	DrawRect ( pDevice, 10, 10, 200, 200, txtPink);
    	return pEndScene(pDevice);
    }
    
    void InitHook()
    {
    	HMODULE hModule = NULL;
    	while( !hModule )
    	{
    		hModule = GetModuleHandleA( "d3d9.dll" ); // Handle zur DLL holen
    		Sleep( 100 ); // 100ms warten
    	}
    	pEndScene = ( EndScene_t )DetourFunc((PBYTE) 0x71a8d507,(PBYTE)hkEndScene, 5);
    }
    
    int WINAPI DllMain(HINSTANCE hInst,DWORD reason,LPVOID reserved)
    {
     switch(reason)
     {
     case DLL_PROCESS_ATTACH:
    	CreateThread(0, 0, (LPTHREAD_START_ROUTINE) InitHook, 0, 0, 0);
     break;
     }
     return true;
    }

    I use the detourfunction from *************.
    why this doesnt work, I TESTED IT ON A D3D9 TEST ENVIRONMENT

    The whole problem is the rect wont drawn
    Last edited by _PuRe.LucK*; 07-22-2013 at 03:27 PM.

  2. #2
    Eu sou Daleste cheguei mais to saindo fora
    MPGH Member
    experthack's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    1,178
    Reputation
    90
    Thanks
    626
    My Mood
    Aggressive
    This address is incorrect EndScene ...

  3. #3
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    Code:
    pEndScene = ( EndScene_t )DetourFunc((PBYTE) 0x71a8d507,(PBYTE)hkEndScene, 5);
    Using a static address like this for hooking EndScene is your problem. Given that you are just copy pasting is probably the other part of the problem.
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  4. #4
    Threadstarter
    I'm not lazy, I just really enjoy doing nothing.
    Donator
    _PuRe.LucK*'s Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    idk bruh.
    Posts
    521
    Reputation
    71
    Thanks
    5,648
    My Mood
    Bored
    Quote Originally Posted by atom0s View Post
    Code:
    pEndScene = ( EndScene_t )DetourFunc((PBYTE) 0x71a8d507,(PBYTE)hkEndScene, 5);
    Using a static address like this for hooking EndScene is your problem. Given that you are just copy pasting is probably the other part of the problem.
    Its already solve I use now vTables

Similar Threads

  1. the old hacks don't work anymore with the new update!
    By zeroknight2000 in forum Combat Arms Hacks & Cheats
    Replies: 5
    Last Post: 08-23-2008, 01:03 AM
  2. D3D's don't work anymore!!!
    By austinlau1 in forum Combat Arms Hacks & Cheats
    Replies: 14
    Last Post: 08-23-2008, 12:36 AM
  3. Why all hacks don't work for me
    By frits1 in forum WarRock - International Hacks
    Replies: 2
    Last Post: 07-19-2008, 12:31 PM
  4. HACKS DON'T WORK!! after 23-05-07
    By jaspertjuhh in forum WarRock - International Hacks
    Replies: 19
    Last Post: 05-25-2007, 09:31 AM
  5. GPS and InstaSpawn Don't Work On CQC
    By sirbannedalot in forum WarRock - International Hacks
    Replies: 7
    Last Post: 04-13-2007, 06:32 AM