[Release][C#]WhiteMagic - Injected .NET Helper Library menu

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 15 of 54
  1. #1
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Release][C#]WhiteMagic - Injected .NET Helper Library

    Well, since Shynd released his BlackMagic library for out of process work, I figured I'd release my own little library, for in process work.

    Aptly named: WhiteMagic. (My creativity is awesome isn't it?)

    Anyhow... this library is aimed towards users who inject their .NET applications into processes. It provides ways to hook/detour functions, create memory patches, find patterns (via my FindPatternSharp stuff), as well as read/write memory (basic datatypes, structs, etc).

    It's released under the GPLv3 license (so you silly commercial people can't just go stealing code all willy nilly like).

    The API is fairly well rounded, with only 1 class instantiation required (or omitted if you choose), and you can do pretty much everything from there.

    Anyhow, I'm not releasing an example with this, because... if you don't know how to use it properly... you shouldn't be using it at all.

    HOWEVER, I will answer questions based on API troubles and the like. Other than that, it's up to you to figure out.

    The code is commented, and will throw more than enough exceptions to make sure you code is kept in line of requirements. (Eg; proper attributes, etc)

    You can grab it here: http://dl.getdropbox.com/u/2068143/WhiteMagic.rar

    Edit: Since I got a few PMs about how to actually use the Detour API, here's a quick example.
    Please note, the addresses used, are from WoW. Using the proper addresses to your DXDevice should produce the same results.

    Code:
    using System;
    using System.Runtime.InteropServices;
    
    using WhiteMagic;
    
    namespace ConsoleApplication1
    {
        internal class Program
        {
            #region Delegates
    
            [UnmanagedFunctionPointer(CallingConvention.WinApi)]
            public delegate int EndSceneDelegate(IntPtr instance);
    
            #endregion
    
            private static readonly EndSceneDelegate EndSceneHandler = EndScene;
    
            private static readonly Magic m = new Magic();
    
            private static int EndScene(IntPtr instance)
            {
                // Pulse();
    
                return (int)m.Detours["EndScene"].CallOriginal(instance);
            }
    
            private static void Main(string[] args)
            {
                IntPtr endSceneAddr = m.GetObjectVtableFunction(m.Read<IntPtr>(0x0123E908, 0x397C), 42);
                m.Detours.CreateAndApply(m.RegisterDelegate<EndSceneDelegate>(endSceneAddr), EndSceneHandler, "EndScene");
            }
        }
    }
    Changes:

    9/20/2009 (v0.0.1.1)
    - Added x64 support. Simply build with X64 as a define.
    - Added support to turn off most exceptions. Simply build with NOEXCEPTIONS as a define.
    - Cleaned up some code.
    - Added more documentation, etc.
    - Fixed a bug in the Detour class that caused it to crash. (Forgot to set the _win32 var)
    - Minor other fixes

    Credits:

    Major credit to Shynd, who's name I pretty much stole (from his BlackMagic lib, aimed towards out of proc editors)
    kynox; being an awesome ausfag
    Cypher: being a portability nazi kiwi (yes, this lib is mainly for x86, no x64 support is implied)
    jjaa; a good bit of his code is used in this library, however, I've changed/rewritten a good chunk of it.
    Shynd; the BlackMagic library that I used as a basis of.. well... even writing this one...
    Everyone at GD; just plain awesome people.
    MMOwned; 95% retarded dimwits, but some of you are awesome.
    Last edited by Apoc; 09-19-2009 at 11:22 PM.

    [Release][C#]WhiteMagic - Injected .NET Helper Library
  2. #2
    ~OddBall~'s Avatar Contributor
    Reputation
    207
    Join Date
    Jan 2008
    Posts
    1,156
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    O gawd, every commercial bot is no longer safe O.o
    https://www.mmowned.com/forums/world-of-warcraft/guides/278302-selecting-bot-you.html - SELECTING THE BOT FOR YOU

    PHWOOOOAAAAAR - Parog was here. <3 <----Wtf's a Parog?

  3. #3
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An example since MaiN had some issues with the detour API.

    This is how you can easily hook EndScene using the library:

    Code:
    using System;
    using System.Runtime.InteropServices;
    
    using WhiteMagic;
    
    namespace ConsoleApplication1
    {
        internal class Program
        {
            #region Delegates
    
            [UnmanagedFunctionPointer(CallingConvention.WinApi)]
            public delegate int EndSceneDelegate(IntPtr instance);
    
            #endregion
    
            private static readonly EndSceneDelegate EndSceneHandler = EndScene;
    
            private static readonly Magic m = new Magic();
    
            private static int EndScene(IntPtr instance)
            {
                // Pulse();
    
                return (int)m.Detours["EndScene"].CallOriginal(instance);
            }
    
            private static void Main(string[] args)
            {
                IntPtr endSceneAddr = m.GetObjectVtableFunction(m.Read<IntPtr>(0x0123E908, 0x397C), 42);
                m.Detours.CreateAndApply(m.RegisterDelegate<EndSceneDelegate>(endSceneAddr), EndSceneHandler, "EndScene");
            }
        }
    }
    Last edited by Apoc; 09-19-2009 at 03:31 AM.

  4. #4
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    very kewl apoc

  5. #5
    The-Eradicator's Avatar Contributor

    Reputation
    149
    Join Date
    May 2007
    Posts
    829
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very awesome. +Rep
    The most beautiful thing we can experience is the mysterious. It is the source of all true art and all science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.
    Albert Einstein

  6. #6
    Viano's Avatar Active Member
    Reputation
    37
    Join Date
    May 2008
    Posts
    172
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    ...
    It's released under the GPLv3 license (so you silly commercial people can't just go stealing code all willy nilly like).
    ...
    Thanks for this +Rep +Rep +Rep

    But is the license even valid? Since there is no author or application name in there?

    Code:
    <program>  Copyright (C) <year>  <name of author>
    Viano

  7. #7
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Thanks for this +Rep +Rep +Rep

    But is the license even valid? Since there is no author or application name in there?

    Code:
    <program>  Copyright (C) <year>  <name of author>
    The full license doesn't require those filled out. (Everything after the TOS can be omitted from the full license, I left it in for obvious reasons)

    Each piece of source code has the proper license/copyright header.

    Nice try though!

    Also; the bit you're referring to is for terminal applications. Not a library.

  8. #8
    CimSlunt's Avatar Contributor Authenticator enabled
    Reputation
    154
    Join Date
    Nov 2008
    Posts
    691
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very nice!!

    i bet im one of that 5% of MMOwned thats awesome

    Btw, Anyone know how to start an exe from buttonclick in vb??

    Sorry to hijack Apoc


  9. #9
    FenixTX2's Avatar Active Member
    Reputation
    22
    Join Date
    Mar 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i bet im one of that 5% of MMOwned thats awesome

    Btw, Anyone know how to start an exe from buttonclick in vb??
    You are not awesome.
    Edit: Sorry meant to add an answer. Have you tried 'shellexecute(<filename>)'?
    or is that not exactly the functionality you were looking for?
    Last edited by FenixTX2; 09-19-2009 at 12:35 PM.

  10. #10
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by FenixTX2 View Post


    You are not awesome.
    Troll: Successful.

  11. #11
    CimSlunt's Avatar Contributor Authenticator enabled
    Reputation
    154
    Join Date
    Nov 2008
    Posts
    691
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by FenixTX2 View Post


    You are not awesome.
    Ok well thanks for clearing that up for me xD

    One day i will be awesome!!!


  12. #12
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Amazing lib.

    I have a design question though, seeing as every instance of the Magic class will be identical (as in, it will interact with the same process, namely itself) then why not make the entire class static? Is there a specific drawback to static classes?

    "Robske, you are a moron and should gtfo and read some programming books" is a valid answer.



    Also, 360 awesome people on mmowned ? (5% of 7219)
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  13. #13
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Robske View Post
    Amazing lib.

    I have a design question though, seeing as every instance of the Magic class will be identical (as in, it will interact with the same process, namely itself) then why not make the entire class static? Is there a specific drawback to static classes?

    "Robske, you are a moron and should gtfo and read some programming books" is a valid answer.



    Also, 360 awesome people on mmowned ? (5% of 7219)
    What happens when you inject two different applications in the same AppDomain, that use this library? You end up with 'bad' shit in memory. (Each app conflicting with eachother, etc)

    You could always just use the Magic.Instance property if you so choose.

    There's no specific reason to use a class instance over static classes; other than avoidance of possible bugs.

  14. #14
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freaking awesome library!
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  15. #15
    oliman's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    3
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW, I was hoping to figure out how to hook endScene today and now I have this kick ass library to play with.

    plus it's C#, holy crap!

    Thanks Apoc

Page 1 of 4 1234 LastLast

Similar Threads

  1. [Release] LuaMe Version 1 (Script Helper)
    By Envoke in forum WoW EMU Programs
    Replies: 14
    Last Post: 04-05-2009, 03:05 AM
  2. [Release] Ascent/Arc/Asoure GM Helper
    By xeross155 in forum WoW EMU General Releases
    Replies: 5
    Last Post: 11-07-2008, 03:28 PM
  3. [Release]Custom Launcher[Vb.Net]
    By Emptie[Imp] in forum WoW EMU Programs
    Replies: 12
    Last Post: 10-13-2008, 01:13 PM
  4. [RELEASE] GamerzWoW Launcher - VB9.NET Source!
    By whitekidney in forum World of Warcraft Bots and Programs
    Replies: 9
    Last Post: 04-26-2008, 03:59 PM
  5. [RELEASE] GamerzWoW Launcher - VB9.NET Source!
    By whitekidney in forum WoW EMU Programs
    Replies: 0
    Last Post: 04-26-2008, 11:48 AM
All times are GMT -5. The time now is 10:39 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search