Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > First-Person Shooters > Battlefield Series > Battlefield 2

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Battlefield 2
hacks cheats tutorials source code
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

D3D Hooking Using Renderer Class
Old 04-26-2010, 11:30 AM   #1
The 0n3

Sfab1's Avatar

Join Date: Nov 2007
Location: Finland
Posts: 422
Reputation: 22706
Rep Power: 287
Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!Sfab1 has reputation that takes up 2GB of server space!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (1)
Points: 16,492, Level: 17
Points: 16,492, Level: 17 Points: 16,492, Level: 17 Points: 16,492, Level: 17
Activity: 31.0%
Activity: 31.0% Activity: 31.0% Activity: 31.0%
Last Achievements
D3D Hooking Using Renderer Class

this is short and simple probably nothing new for some people but might be usefull for newcomers and i actually didnt see this anywhere posted so...

Code:
LPDIRECT3DDEVICE9 pGameDevice;
typedef HRESULT( WINAPI *EndScene_ )( LPDIRECT3DDEVICE9 pDevice);
typedef HRESULT( WINAPI *DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,    UINT NumVertices, UINT StartIndex, UINT PrimitiveCount);
EndScene_ pEndScene;
DrawIndexedPrimitive_ pDrawIndexedPrimitive;

HRESULT WINAPI hEndScene( LPDIRECT3DDEVICE9 pDevice )
{    
    _asm pushad;
    /*YOUR CODE HERE*/
    __asm popad;
    return pEndScene(pDevice);
}
HRESULT WINAPI hDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{    
    _asm pushad;
    /*YOUR CHAMS CODE HERE*/
    _asm popad;
    return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex,NumVertices, startIndex, primCount);
}
void InitRendering(LPDIRECT3DDEVICE9 pDevice)
{
    if(bInitOnce == true)
    {
        /* HERE CREATE FONTS, LINES, INIT VIEWPORT */

        bInitOnce = false;
    }
} 
DWORD WINAPI dwSleepThread( LPVOID lpArgs )
{
    DWORD BF2Base = NULL;
    while ( BF2Base == NULL )
    {
        Sleep( 200 );
        BF2Base = ( DWORD ) GetModuleHandle("BF2.exe");
    }

    while(!pGameDevice) 
        pGameDevice = renderer->m_pDevice;// LPDIRECT3DDEVICE9 from Renderer Class

    InitRendering(pGameDevice);

    DWORD* pdwNewGameDevice = (DWORD*)pGameDevice;
    pdwNewGameDevice = (DWORD*)pdwNewGameDevice[0]; 

    pEndScene = (EndScene_)DetourFunction((PBYTE)(pdwNewGameDevice[42]),(PBYTE)hEndScene);
    pDrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)pdwNewGameDevice[82],(PBYTE)hDrawIndexedPrimitive);
    return 0;
}
INT WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpArgs )
{
    switch ( dwReason )
    {
        case DLL_PROCESS_ATTACH:
        {    
            CreateThread( NULL, NULL, &dwSleepThread, NULL, NULL, NULL );
        }
        break;
    }
    return TRUE;
}
above works for bf2 and 2142 it would work for Cod4 as well with small change

make it work with MW2 or WAW just change offset then...

Code:
    DWORD  COD4Base = NULL;
    while ( COD4Base == NULL )
    {
        Sleep( 200 );
         COD4Base = ( DWORD ) GetModuleHandle("iw3mp.exe");
    }

    while(!pGameDevice) 
        *( DWORD *)&pGameDevice = *( DWORD * )0xCC9A408;//for call of duty 4
credits: Me, uc-forum in general and everyone who contributes their knowledge to this community
__________________

Sfab1 is online now

Reply With Quote


Old 04-26-2010, 11:44 AM   #2
Retired Admin

learn_more's Avatar

Join Date: Sep 2006
Posts: 5,249
Reputation: 93628
Rep Power: 1106
learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!learn_more has a huge epeen!
Recognitions:
Members who have contributed financial support towards UnKnoWnCheaTs. Donation (2)
sieg heil Nazi
Points: 70,490, Level: 39
Points: 70,490, Level: 39 Points: 70,490, Level: 39 Points: 70,490, Level: 39
Activity: 24.7%
Activity: 24.7% Activity: 24.7% Activity: 24.7%
Last Achievements
Award-Showcase
thanks for sharing your insights, but imho this could be expanded a bit:

you call it 'D3D Hooking Using Renderer Class', yet you only reference the renderer class once, when reading it.

this doesnt teach much, not how to find the renderer class, not how to reverse it, only to get the device out of it when you already have the renderer class, but when people are upto that point, you can assume they can read the device out of it aswell?
__________________
learn_more is offline

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
class, d3d, hooking, renderer
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 03:43 PM.