Results 1 to 15 of 62

Threaded View

  1. #1
    Clarkie's Avatar
    Join Date
    May 2011
    Gender
    male
    Posts
    28
    Reputation
    20
    Thanks
    14
    My Mood
    Shocked

    Clarkie Detours.

    Well you guys have a lot of detour problems so i made a detour for you guys. I know dont post this and that.

    I was using topblast's revival Base and i notice the Tjmp structure, which is exactly what you need to make a Jump function. So I edited it and used it to make a detour.


    Credit
    Clarkie making it
    Topblast (only for the little structure)

    [highlight=c++]#pragma pack(push)
    #pragma pack(1)

    typedef struct {
    unsigned char bNop;
    unsigned char bPush;
    unsigned long dwAddress;
    unsigned char bRet;
    } TestJmp;


    typedef struct {
    unsigned char bOPS[7];
    unsigned char bNop;
    unsigned char bJmp;
    unsigned long dwAddress;
    } Tjmp;
    #pragma pack(pop)

    bool Detour::Hook(PBYTE pTargetAddr, PBYTE pNewAddr, VOID** pCallOrigAddress)
    {
    TestJmp recJump;
    Tjmp RetJump;
    DWORD dwProtect;
    *pCallOrigAddress = VirtualAlloc(0, sizeof(Tjmp), (MEM_COMMIT | MEM_RESERVE), PAGE_EXECUTE_READWRITE);
    if( pCallOrigAddress != NULL)
    {
    WriteNOP(&RetJump, sizeof(Tjmp));

    for( int i = 0; i < (sizeof(TestJmp)+1); i++)
    RetJump.bOPS[i] = pTargetAddr[i];
    RetJump.bNop = 0x90;
    RetJump.bJmp = 0xE9;
    RetJump.dwAddress = (DWORD(pTargetAddr) + (sizeof(TestJmp)+1))-DWORD(*pCallOrigAddress)-(((sizeof(TestJmp)*2)));
    memcpy(*pCallOrigAddress, &RetJump, sizeof(Tjmp));

    if( WriteNOP(pTargetAddr, (sizeof(TestJmp))) == true &&
    VirtualProtect(pTargetAddr, sizeof(TestJmp), PAGE_EXECUTE_READWRITE, &dwProtect) == TRUE)
    {
    WriteNOP(&recJump, sizeof(TestJmp));
    recJump.bNop = 0x90;
    recJump.bPush = 0x68;
    recJump.dwAddress = DWORD(pNewAddr);
    recJump.bRet = 0xC3;
    memcpy(pTargetAddr, &recJump, sizeof(TestJmp));
    VirtualProtect(pTargetAddr, sizeof(TestJmp), dwProtect, &dwProtect);
    return true;
    }
    }
    return false;
    }
    [/highlight]
    Last edited by Clarkie; 05-30-2011 at 06:41 PM.
    New Coder here to Rock your world.

    Email : Mr_clarkie@live.com


  2. The Following 11 Users Say Thank You to Clarkie For This Useful Post:

    'Batata! (06-25-2011),baraozin (07-26-2011),CAFlames (05-30-2011),dllbaseII (07-26-2011),Ghost8631 (05-31-2011),HurleyppL (06-26-2011),markoj (05-31-2011),qwerty01 (08-30-2011),street_21 (09-27-2011),ViniciusD7 (07-26-2011),_Fk127_ (05-30-2011)