Results 1 to 7 of 7
  1. #1
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic

    How to make a simple detour for hacks [TeknoMW3]

    Ok first I gotta thank -InSaNe- for teaching me most of this stuff.
    Anyways, lets continue. As I usually code in C++, this will be in C++ as well.
    Now let's get started: i'll show you the detour: [I'll be using the uiShowList to hook, you can use anything though.]


    Code:
    typedef (__cdecl *uiShowList_t)(int a, int b, int c, int d); //Define uiShowList_t
    uiShowList_t uiShowList = NULL; //Make uiShowList and assign it to NULL from uiShowList_t
    DWORD uiSHOWLIST= 0x644240; //This is the offset we'll be hooking to. AKA the UIShowList offset.
    Ok, now this is a general detour function:
    Code:
    void *DetourFunction (BYTE *src, const BYTE *dst, const int len)
    	{
    	BYTE *jmp = (BYTE*)malloc(len+5);
    	DWORD dwBack;
    
    	VirtualProtect(src, len, PAGE_EXECUTE_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;
    	for (int i=5; i<len; i++)  
    		src[i]=0x90;
    	VirtualProtect(src, len, dwBack, &dwBack);
    	return (jmp-len);
    	}
    As you can see, it takes a pointer to the source address to hook into and another pointer but to the destination and the size of the hook.

    So before we use this, we'll need to create a function to replace the code @ uiShowList with:


    Code:
    void OverWrite(int a, int b, int c, int d)
    {
       __asm PUSHAD; //Pushes all general registers to the stack before our function is called.
       __asm PUSHFD; //Pushes all EFLAGS to the stack.
       MyFunc(); //Calls the custom function written.
       __asm POPFD; //Retrieves the EFLAGS from stack
       __asm POPAD; //Retrieves all general registers from stack.
       uiShowList(a, b, c, d); //Calls uiShowList
    }
    Ok, now as we told uiShowList to now call MyFunc(), we now need to create a MyFunc() ::
    Code:
    
    DWORD MyFunc()
    {
       return 0;
    }
    
    Now every time uiShowList is called, your function is also called. :P

    Let's say you wanna use it now. Here's how: (From a dll)

    Code:
    DWORD APIENTRY DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
    {
       switch(dwReason)
       {
          case DLL_PROCESS_ATTACH:
             uiShowList = (uiShowList_t)DetourFunction((BYTE*)uiSHOWLIST, (BYTE*)&OverWrite, 5);
       }
       return 0;
    }
    Again, Since some people thing i'm leeching, this is NOT MINE, IT IS NOT MINE.
    I didn't make if, find it, anything.
    I'll give credits to the only person who taught me all this: @-InSaNe-
    Regards.
    Last edited by MarkHC; 09-30-2012 at 09:21 PM. Reason: Bite Me.

  2. The Following User Says Thank You to Kenshin13 For This Useful Post:

    mwxplayer (10-27-2012)

  3. #2
    rawr im a tiger's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    On the edge of Sanity
    Posts
    238
    Reputation
    40
    Thanks
    1,041
    My Mood
    Angelic
    Saying "THIS IS NOT MINE" doesn't mean you aren't a leecher

  4. The Following 2 Users Say Thank You to rawr im a tiger For This Useful Post:

    intervention61 (10-01-2012),mwxplayer (11-23-2012)

  5. #3
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by rawr im a tiger View Post
    Saying "THIS IS NOT MINE" doesn't mean you aren't a leecher
    Giving credits(As I have forgotten before, im only human) proves you aren't a leecher.
    ***k off. I'm just making these thing because I knew how hard it was to learn for me. This is just helping out those people.
    If you can't appreciate my effort to make these tutorials, gtfo.
    Be the bigger person then and say nothing if you believe i'm wrong.

  6. #4
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    No offense, but this isn't a tutorial.. It's basically just source code. That being said:

    /Changed thread tag to [Source Code]

    Also, you can find the Detour function tutorial here https://www.mpgh.net/forum/161-progra...ng-detour.html


    CoD Minion from 09/19/2012 to 01/10/2013

  7. The Following 2 Users Say Thank You to MarkHC For This Useful Post:

    Jorndel (09-30-2012),Kenshin13 (09-30-2012)

  8. #5
    rawr im a tiger's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    On the edge of Sanity
    Posts
    238
    Reputation
    40
    Thanks
    1,041
    My Mood
    Angelic
    Quote Originally Posted by Kenshin13 View Post
    Giving credits(As I have forgotten before, im only human) proves you aren't a leecher.
    ._.

    Quote Originally Posted by Kenshin13 View Post
    ***k off.
    No.

    Quote Originally Posted by Kenshin13 View Post
    Be the bigger person then and say nothing if you believe i'm wrong.
    >say nothing if you believe I'm wrong
    >better
    ._.
    I have nothing more to say.

  9. The Following User Says Thank You to rawr im a tiger For This Useful Post:

    Jorndel (09-30-2012)

  10. #6
    Kenshin13's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    Cloud 9
    Posts
    3,470
    Reputation
    564
    Thanks
    6,168
    My Mood
    Psychedelic
    Quote Originally Posted by -InSaNe- View Post
    No offense, but this isn't a tutorial.. It's basically just source code. That being said:

    /Changed thread tag to [Source Code]

    Also, you can find the Detour function tutorial here https://www.mpgh.net/forum/161-progra...ng-detour.html
    Why didn't I see that a month ago >.<
    Thanks for that, you may close this if you want.

  11. #7
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    /Closed as requested


    CoD Minion from 09/19/2012 to 01/10/2013

Similar Threads

  1. Can someone make a simple esp box hack for me?
    By crest in forum Combat Arms Hack Requests
    Replies: 9
    Last Post: 07-01-2012, 05:16 AM
  2. [Solved] How To make A Simple Rez Hack
    By iciici13 in forum CrossFire Help
    Replies: 4
    Last Post: 06-30-2012, 05:15 PM
  3. [Tutorial] How to make a Simple Hack
    By flameswor10 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 172
    Last Post: 02-15-2012, 01:36 PM
  4. [Help Request] wanna learn how to make a simple hack
    By shinngo in forum CrossFire Help
    Replies: 18
    Last Post: 06-07-2011, 11:01 AM