Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive

    Detours I stumbled on...

    Detoursz.cpp
    Code:
    /*
        Name: Detoursz
        Description: Detoursz is a library for function detouring
        Version: 1.0
        Author: Sinner & Zaki96 & -Dimensions-
        Credits: z0mbie (ADE32), LanceVorgin's CDetour (some ideas)
    */
    
    #include "Detoursz.h"
    
    cDetour detour;
    
    void* cDetour::memcpy_s( void* pvAddress, const void* pvBuffer, size_t stLen )
    {
    	MEMORY_BASIC_INFORMATION mbi;
    	VirtualQuery( ( void* )pvAddress, &mbi, sizeof( mbi ) );
    	VirtualProtect( mbi.BaseAddress, mbi.RegionSize, PAGE_EXECUTE_READWRITE, &mbi.Protect );
    	void* pvRetn = memcpy( ( void* )pvAddress, ( void* )pvBuffer, stLen );
    	VirtualProtect( mbi.BaseAddress, mbi.RegionSize, mbi.Protect, &mbi.Protect );
    	FlushInstructionCache( GetCurrentProcess( ), ( void* )pvAddress, stLen );
    	return pvRetn;
    }
    
    
    LPVOID cDetour::Create( LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen )
    {
        LPVOID lpMallocPtr = NULL;
        DWORD dwProt = NULL;
        PBYTE pbMallocPutr = NULL;
        PBYTE pbFuncOrig = (PBYTE)lpFuncOrig;
        PBYTE pbFuncDetour = (PBYTE)lpFuncDetour;
        PBYTE pbPatchBuf = NULL;
        int minDetLen = 0;
        int detLen = 0;
    
        // Get detour length
        if((minDetLen = GetDetourLen(patchType)) == 0)
                return NULL;
    
        else if((detLen = GetDetourLenAuto(pbFuncOrig, minDetLen)) < minDetLen)
                return NULL;
    
        // Alloc mem for the overwritten bytes
        if((lpMallocPtr = (LPVOID)malloc(detLen+JaMu32_SZ+SI_SSZ)) == NULL)
                return NULL;
    
        pbMallocPutr = (PBYTE)lpMallocPtr;
    
        // Enable writing to original
        VirtualProtect(lpFuncOrig, detLen, PAGE_READWRITE, &dwProt);
    	
    
        // Write overwritten bytes to the malloc
        memcpy(lpMallocPtr, lpFuncOrig, detLen);
        pbMallocPutr += detLen;
        pbMallocPutr[0] = 0xE9;
        *(DWORD*)(pbMallocPutr+1) = (DWORD)((pbFuncOrig+detLen)-pbMallocPutr)-JaMu32_SZ;
        pbMallocPutr += JaMu32_SZ;
        pbMallocPutr[0] = SI_OOP_0;
        pbMallocPutr[1] = SI_OOP_1;
        pbMallocPutr[2] = SI_OOP_2;
    
        // Create a buffer to prepare the detour bytes
        pbPatchBuf = new BYTE[detLen];
        memset(pbPatchBuf, 0x90, detLen);
    
        switch(patchType)
        {
            case DETOUR_TYPE_CLC_JNC:
                    pbPatchBuf[0] = 0xF8;
                    pbPatchBuf[1] = 0x0F;
                    pbPatchBuf[2] = 0x83;
                    *(DWORD*)&pbPatchBuf[3] = (DWORD)(pbFuncDetour - pbFuncOrig) - 7;
                    break;
            
            default:
                    return NULL;
        }
    
        // Write the detour
        for(int i=0; i<detLen; i++)
                pbFuncOrig[i] = pbPatchBuf[i];
    
        delete [] pbPatchBuf;
    
        // Reset original mem flags
        VirtualProtect( lpFuncOrig, detLen, dwProt, &dwOldProt );
    
        return lpMallocPtr;
    }
    
    BOOL cDetour::Remove( LPVOID lpDetourCreatePtr )
    {
        PBYTE pbMallocPutr = NULL;
        DWORD dwFuncOrig = NULL;
        DWORD dwProt = NULL;
        int i=0;
    
        if((pbMallocPutr = (PBYTE)lpDetourCreatePtr) == NULL)
                return FALSE;
    
    	// Find the orig jmp32 opcode sig
        for(i=0; i<=DETOUR_MAX_SRCH_OPLEN; i++)
        {
            if(pbMallocPutr[i] == SI_OOP_0 //ini juga
                    && pbMallocPutr[i+1] == SI_OOP_1//<-------- liat ini jg
                    && pbMallocPutr[i+2] == SI_OOP_2)///ini juga
                    break;
    
            if(i == DETOUR_MAX_SRCH_OPLEN)
                    return FALSE;
        }
    
        // Write the overwritten bytes back to the original
       
        memcpy((LPVOID)dwFuncOrig, lpDetourCreatePtr, (i-JaMu32_SZ));
        VirtualProtect((LPVOID)dwFuncOrig, (i-JaMu32_SZ), dwProt, &dwOldProt);
    
        // Memory cleanup
        free(lpDetourCreatePtr);
    
        return TRUE;
    }
    
    int cDetour::GetDetourLen( int patchType )
    {
        switch(patchType)
        {
            case DETOUR_TYPE_CLC_JNC:
                    return 7;
            default:
                    return 0;
        }
    }
    
    int cDetour::GetDetourLenAuto( PBYTE &pbFuncOrig, int minDetLen )
    {
        int len = 0;
        PBYTE pbCurOp = pbFuncOrig;
    
        while(len < minDetLen)
        {
            int i = oplen(pbCurOp);
            
            if(i == 0 || i == -1)
                    return 0;
    
            if(len > DETOUR_MAX_SRCH_OPLEN)
                    return 0;
    
            len += i;
            pbCurOp += i;
        }
    
        return len;
    }
    
    bool cDetour::bDataCompare( const BYTE* pData, const BYTE* bMask, const char* szMask ) 
    { 
        for( ;*szMask;++szMask,++pData,++bMask ) 
            if( *szMask=='x' && *pData!=*bMask )  
                return false; 
        return ( *szMask ) == NULL; 
    } 
    
    // Thank You d0m1n1k
    DWORD cDetour::FindPattern( DWORD dwAddress, DWORD dwLen,BYTE *bMask, char * szMask ) 
    { 
        for( DWORD i=0; i < dwLen; i++ ) 
    		if( detour->bDataCompare( ( BYTE* )( dwAddress + i ), bMask, szMask) ) 
                return ( DWORD )( dwAddress+i ); 
         
        return 0; 
    }
    Detoursz.h
    Code:
    /*
        Name: Detoursz
        Description: Detoursz is a library for function detouring
        Version: 1.0
        Author: Sinner & Zaki96 & -Dimensions-
        Credits: z0mbie (ADE32), LanceVorgin's CDetour (some ideas)
    */
    
    #pragma once
    
    #define WIN32_LEAN_AND_MEAN
    #define WIN32_EXTRA_LEAN
    
    #include "Includes.h"
    #include "ADE32.h"
    //#pragma comment lib, "detourxs")
    
    #pragma warning(disable: 4311)
    #pragma warning(disable: 4312)
    #pragma warning(disable: 4244)
    #pragma warning(disable: 4102)
    #pragma warning(disable: 4996)
    
    #define DETOUR_LEN_AUTO 0 // Finds the detour length automatically
    
    #define DETOUR_MAX_SRCH_OPLEN 64
    
    #define JaMu32_SZ 5
    #define SI32_SZ 4
    
    // jmp32 si
    //-------bagian penting--------//
    #define SI_SSZ 3//ini yg ak edit
    #define SI_OOP_0 0xCC//ini yg aku edit
    #define SI_OOP_1 0x90//ini juga
    #define SI_OOP_2 0xC3//ini jg
    
    enum
    {
            DETOUR_TYPE_JMP, // min detour len: 5
            DETOUR_TYPE_PUSH_RET, // min detour len: 6
            DETOUR_TYPE_NOP_JMP, // min detour len: 6
            DETOUR_TYPE_NOP_NOP_JMP, // min detour len: 7
            DETOUR_TYPE_STC_JC, // min detour len: 7
            DETOUR_TYPE_CLC_JNC, // min detour len: 7
    };
    
    static DWORD dwOldProt;
    
    class cDetour{
    public:
    	void* memcpy_s( void* pvAddress, const void* pvBuffer, size_t stLen );
    	LPVOID Create( LPVOID lpFuncOrig, LPVOID lpFuncDetour, int patchType, int detourLen=DETOUR_LEN_AUTO );
    	LPVOID Create( LPCSTR lpModuleName, LPCSTR lpProcName, LPVOID lpFuncDetour, int patchType, int detourLen=DETOUR_LEN_AUTO );
    	BOOL Remove( LPVOID lpDetourCreatePtr );
    	int GetDetourLen(int patchType);
    	int GetDetourLenAuto(PBYTE &pbFuncOrig, int minDetLen);
    	bool bDataCompare( const BYTE* pData, const BYTE* bMask, const char* szMask );
    	DWORD FindPattern( DWORD dwAddress, DWORD dwLen,BYTE *bMask, char * szMask );
    };
    
    extern class cDetour detour;
    Let me know if it works or came in useful to anyone. Thank and credit Sinner & Zaki96 & -Dimensions-.
    Last edited by -Dimensions-; 08-10-2011 at 07:49 PM.

  2. #2
    Fabolous's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    192.168.1.01
    Posts
    2,706
    Reputation
    261
    Thanks
    682
    My Mood
    Paranoid
    So you posted this and you haven't tested it.


  3. #3
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    Quote Originally Posted by Fabolous View Post
    So you posted this and you haven't tested it.

    I would but my CA doesn't work. IP Banned and my base (the only one I have) is detected.

  4. #4
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,404
    My Mood
    In Love
    @Fabolous
    No, he just coppied and pasted a few detour files, combined them together and called them his.
    No I do not make game hacks anymore, please stop asking.


    Been MPGH Minion: 6 July 2011 - 1 August 2012

  5. The Following User Says Thank You to flameswor10 For This Useful Post:

    OBrozz (08-11-2011)

  6. #5
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    Quote Originally Posted by flameswor10 View Post
    @Fabolous
    No, he just coppied and pasted a few detour files, combined them together and called them his.
    1st, Its not mine, Zaki96 made it.
    2nd, I organized it and put in memcpy_s, bDataCompare, Find Pattern, and the class.
    3rd, just stop...
    Last edited by -Dimensions-; 08-10-2011 at 06:54 PM.

  7. #6
    UKnownError's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    ERROR
    Posts
    266
    Reputation
    27
    Thanks
    29
    My Mood
    Breezy
    yo boi just a bit more and my base will work let my bro mr sanchez use it lol im bored
    Don't smoke crack kids and always use a condom!XD

  8. #7
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    Quote Originally Posted by UKnownError View Post
    yo boi just a bit more and my base will work let my bro mr sanchez use it lol im bored
    What do you need? I made a new Hook and Create Font this morning. Also fixed up mo3ad001's detours.
    Last edited by -Dimensions-; 08-10-2011 at 07:02 PM.

  9. #8
    UKnownError's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    ERROR
    Posts
    266
    Reputation
    27
    Thanks
    29
    My Mood
    Breezy
    lol i got more posts then you
    Don't smoke crack kids and always use a condom!XD

  10. #9
    sakonxd's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    Figure it out
    Posts
    71
    Reputation
    10
    Thanks
    6
    My Mood
    Angelic
    You always need to give credits to the person you took from not just make it your own...
    Hmm what is life about anyways?

    Random person: you know what you should go drop dead...

    Me: so nice of you starting to like me more and more
    Person: no what im trying to say is i hate you so much you should just kill your self...

    Me: so all your doing is trying to act all badass around other people so they can like you more and more? well sir they only thing you have is PATHEICNESS:3


    Person who hates me the most: Pfft i dont really know you tell me...

  11. #10
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    Quote Originally Posted by sakonxd View Post
    You always need to give credits to the person you took from not just make it your own...
    Goodness. Did you even see it? "Author: Sinner & Zaki96 & -Dimensions-". Plus as far as I'm concerned I'm the only person (excluding Zaki96) who has the detours, and I released them.
    Last edited by -Dimensions-; 08-10-2011 at 08:03 PM.

  12. #11
    ~Stephen's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    117
    Reputation
    16
    Thanks
    9
    Holy shit, some kid knows how to make a class. O_O

    brb adding my self to credits!

  13. #12
    CAFlames's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Where ever my imagination takes me
    Posts
    3,014
    Reputation
    202
    Thanks
    2,934
    My Mood
    Twisted
    this is crappily modified Sinner's detours... (from gellins base)

    Current Works:
    ---Horror Game






    Special thanks to drgnforce9 for my sig picture

    Quote Originally Posted by m_t_h View Post

    CAflames is one epic coder.

    Rep and thanks him.. or you're perma banned.

  14. #13
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    Yeesh, I find some detours and I release them and everyone starts a Fucking flame war. All I want to know is if they work. Test them or fucking don't reply.

    Requesting this thread to be closed please.

  15. #14
    DecoderBack's Avatar
    Join Date
    May 2011
    Gender
    male
    Posts
    111
    Reputation
    10
    Thanks
    12
    he's just trying to help, so why flame on him ?

    C#(.net)/C++ Coder
    Assembly coder [Current learning more]

  16. #15
    -Dimensions-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    243
    Reputation
    2
    Thanks
    161
    My Mood
    Aggressive
    God, I completely regret starting this thread.

Page 1 of 2 12 LastLast

Similar Threads

  1. A Few Hacks I Stumbled Across
    By bond304 in forum Combat Arms Hacks & Cheats
    Replies: 34
    Last Post: 09-03-2008, 11:33 AM
  2. Detour problem
    By juppeli in forum WarRock - International Hacks
    Replies: 4
    Last Post: 07-16-2008, 04:56 AM
  3. [Realease-Test]Detours Test
    By Kung Fu Penguin31 in forum WarRock - International Hacks
    Replies: 16
    Last Post: 06-29-2008, 06:35 AM
  4. Detour
    By HackingIsMyLife in forum Programming Tutorial Requests
    Replies: 0
    Last Post: 05-20-2008, 08:17 AM
  5. coding detour?
    By laserdude45 in forum C++/C Programming
    Replies: 3
    Last Post: 01-20-2008, 04:11 PM