[C#] Detouring menu

Shout-Out

User Tag List

Results 1 to 6 of 6
  1. #1
    jjaa's Avatar Contributor
    Reputation
    245
    Join Date
    Dec 2006
    Posts
    562
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#] Detouring

    I got bored the other day so I decided to mess around with some C#, and the BlackMagic library. I have done minimal work with C#, so if something could be done a better way feel free to point it out.

    Anyway I decided to try detour the object tracking function. It worked, so I am posting it here because someone may find it useful

    Syntax Highlighting (NoMorePasting.com)


    Code:
            static void Detour( uint codeCave, uint Address, byte[] hook_func, ref BlackMagic WoW )
            {
    
                Console.WriteLine("Detouring 0x{0:X}", Address);
                Console.WriteLine("With Function at 0x{0:X}", codeCave);
    
    
                WoW.WriteBytes(codeCave, hook_func); 
                //Our function is in memory
                WoW.Asm.Clear();
                WoW.Asm.AddLine("push {0}", codeCave);
                WoW.Asm.AddLine("retn"); //pops codeCave from the stack into EIP
    
                WoW.WriteBytes(Address, WoW.Asm.Assemble()); //Detour the Function
    
            }
    
            static void Main(string[] args)
            {
    
                /////////////
                //WoW 3.0.9//
                /////////////
    
                BlackMagic WoW = new BlackMagic(SProcess.GetProcessFromProcessName("WoW"));
    
    
                uint CodeCave = WoW.AllocateMemory();
    
    
                WoW.Asm.Clear(); //Make sure no ASM lines exist
                //An STD call that returns true
                WoW.Asm.AddLine("mov al,1");
                WoW.Asm.AddLine("retn 4");
    
                //0x00633470 -> ObjectTracking
    
                Detour(CodeCave,0x00633470, WoW.Asm.Assemble(), ref WoW); 
                //tracking all objects
    
                Console.ReadLine();
    
            }
    The only real limitation is that if you want to do something complex you will need good ASM skills


    Now I canz track stuff :P


    EDIT: I just remembered, i think there is a similar thing on GD so if you want more information look there....but i don't know if it is the same thing...i haven't looked...
    Last edited by jjaa; 03-15-2009 at 11:30 PM.

    [C#] Detouring
  2. #2
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two functions you need to hook to do tracking like that. You've got one, but you're missing the other.

    From memory one is for GameObjects, the other is for everything else. Or something similar to that.

  3. #3
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW! That's pretty awesome man. I'd almost +rep just for that bit of code there, never really thought about doing that...

  4. #4
    jjaa's Avatar Contributor
    Reputation
    245
    Join Date
    Dec 2006
    Posts
    562
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    There are two functions you need to hook to do tracking like that. You've got one, but you're missing the other.

    From memory one is for GameObjects, the other is for everything else. Or something similar to that.
    Yeh i know, but they can detour that one themselves

    0x006333E0 -> UnitTracking

  5. #5
    ostapus's Avatar Active Member
    Reputation
    60
    Join Date
    Nov 2008
    Posts
    180
    Thanks G/R
    3/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am wondering is that detouring functions in this way (modifying .CODE section) should be catched by warden, isn't ? you dont worry about it or you tracking warden for information it sends to server ?

  6. #6
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by jjaa View Post
    Yeh i know, but they can detour that one themselves

    0x006333E0 -> UnitTracking
    You're close to 'real' .NET detouring.

    Look into how delegates mimic function pointers in memory. (That was a big hint)

Similar Threads

  1. Detour, SourceCode in C++
    By ajox86 in forum WoW Memory Editing
    Replies: 7
    Last Post: 06-21-2010, 01:17 AM
  2. Detours on 64bit
    By jockel in forum WoW Memory Editing
    Replies: 7
    Last Post: 06-05-2009, 05:05 AM
  3. EncryptPacket Detouring code...
    By lanman92 in forum WoW Memory Editing
    Replies: 13
    Last Post: 03-24-2009, 06:29 PM
  4. Problems with Detours v1.5
    By lanman92 in forum WoW Memory Editing
    Replies: 11
    Last Post: 12-01-2008, 04:29 AM
  5. Nofalldmg Detour causes wow to crash
    By Xarg0 in forum WoW Memory Editing
    Replies: 42
    Last Post: 09-21-2008, 11:18 AM
All times are GMT -5. The time now is 05:53 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search