C# pointers to function menu

User Tag List

Results 1 to 14 of 14
  1. #1
    Shamun's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C# pointers to function

    does anyone know if I can point to function in C# (not delegates), like in C++?
    I've googled it and all I can found is about delegates.
    I want to cast an address into a pointer of a function.

    C# pointers to function
  2. #2
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't work that way. Your C# code isn't in the processes address space so you have to allocate memory and call functions via a new thread.

  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)
    You can't do that with C#. You can however, write a small stub in C++ to point that function to your managed code. (Though, at that point, it's probably easier just to go fully C++)

    This would require you to load the CLR from the target process, and then load your managed code.

  4. #4
    Shamun's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx it's the same as what I thought

  5. #5
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh I misread. He basically wants detours in C#? Yeah, not gonna happen.

  6. #6
    Shamun's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I'll have to manage something with both C# and C++

  7. #7
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or just do it in all C++ and save yourself a bunch of hassle.

  8. #8
    Shamun's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, maybe...
    I'll have to rewrite some of the BlackMagic's features into C++.

    EDIT: btw should I open any specific type of project in C++ for the bot and the injected dll or just a normal empty project?
    Last edited by Shamun; 12-10-2008 at 04:10 PM.

  9. #9
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Errr, you don't have to rewrite any of BlackMagic. The whole point of BlackMagic is its working around a lot of limitations imposed by the language. Once you're using native code and inside your targets address space all those limitations are gone.

  10. #10
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Errr, you don't have to rewrite any of BlackMagic. The whole point of BlackMagic is its working around a lot of limitations imposed by the language. Once you're using native code and inside your targets address space all those limitations are gone.
    ^this

    The only reason I even bothered with writing the BlackMagic library is I'm, for no particular reason, currently dedicated to C#. I can't explain it. Maybe it's because I never bothered to learn about creating dialog windows in unmanaged code, maybe it's because I'm an idiot. If you want ease of use from a bot standpoint--i.e. want to easily be able to call things in-process, etc.--write it in C++. Period.

  11. #11
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Hyru View Post
    :: throws up facepalm collection and makes a run for it ::
    Unless you're looking for a ban I suggest you do one of the following:
    1. Stop posting.
    2. Actually contribute in your posts.
    3. GTFO.

  12. #12
    kynox's Avatar Account not activated by Email
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, maybe...
    I'll have to rewrite some
    I actually lol'd.

  13. #13
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kynox View Post
    I actually lol'd.
    Get on MSN you fuc.kstick.

  14. #14
    Shamun's Avatar Member
    Reputation
    1
    Join Date
    Nov 2008
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help I got your point...

Similar Threads

  1. Invalid function pointer
    By flo8464 in forum WoW Memory Editing
    Replies: 6
    Last Post: 05-31-2010, 05:28 PM
  2. [Help me]Problem with using function pointer in Debug builds
    By wanyancan in forum WoW Memory Editing
    Replies: 6
    Last Post: 01-06-2010, 05:06 AM
  3. C# function pointers
    By lanman92 in forum Programming
    Replies: 8
    Last Post: 06-05-2009, 01:24 PM
  4. The typedef keyword. Functions, function pointers, and you.
    By Cypher in forum WoW Memory Editing
    Replies: 16
    Last Post: 01-07-2009, 12:10 AM
  5. 3.0.2 some function/pointer addresses
    By g3gg0 in forum WoW Memory Editing
    Replies: 6
    Last Post: 11-04-2008, 12:23 AM
All times are GMT -5. The time now is 01:12 AM. 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