[General] Executing functions in a Hook menu

Shout-Out

User Tag List

Results 1 to 10 of 10
  1. #1
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [General] Executing functions in a Hook

    Hey again,

    so i finally decided to go inprocess with an injected c# dll using easyhook to hook the render function as this makes it easier to get the returnvalues(like lists^^)
    now my question would be how i'd execute my stuff in the hook.
    ofc i can do something like in the easyhook example, just writing my code in the hook, but how would i manage to handle this from my oop app?
    Using some kind of queue for functions?
    i hope you understand my problem,if not i'll try to explain it even further

    as always thanks for your help

    [General] Executing functions in a Hook
  2. #2
    DrakeFish's Avatar Lazy Leecher

    Reputation
    634
    Join Date
    Nov 2008
    Posts
    569
    Thanks G/R
    0/14
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can (must?) use delegates in C# to execute functions. You can find ton of information and examples about this here and on Google.

    I see that you're talking about communicating with your external application. I guess you could open up a Named Pipe to make your two processes communicate together. But why don't you do everything from your injected app. It would be easier and would not slow the game for nothing. (If it's because of the user interface, you can create a GUI while injected.)

  3. #3
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by DrakeFish View Post
    You can (must?) use delegates in C# to execute functions. You can find ton of information and examples about this here and on Google.

    I see that you're talking about communicating with your external application. I guess you could open up a Named Pipe to make your two processes communicate together. But why don't you do everything from your injected app. It would be easier and would not slow the game for nothing. (If it's because of the user interface, you can create a GUI while injected.)
    Thanks for your fast answer

    about using delegates i already know. it's not about creating an ingame gui but the communication with the oop application.
    names pipes are one way here,the other i thought about is .net remoting

    the problem i had was about how to execute my stuff in the hook

    [UnmanagedFunctionPointer(CallingConvention.ThisCall, CharSet = Cha - Pastebin.com

    in the try block i will have to execute my code, but how would i do this via named pipes e.g.?
    ofc i'd have to write a handler to receive the methodnames and params i'd want to use
    should i use some kind of queue there to handle the function calls?

    sorry that i can't explain it better right now, got some headache :/

    thanks for your help again

  4. #4
    Jens's Avatar Contributor
    Reputation
    179
    Join Date
    Sep 2006
    Posts
    251
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe that EasyHook already has some kind of communication in place that you could use to communicate, you should have a look at RemoteHooking.IpcCreateServer.

    With EndScene you could simple listen for new messages every frame and execute them in a queue style fashion.

    But why would you do it like this when you can do it from inside the process you're injected into?

  5. #5
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1601
    Join Date
    May 2010
    Posts
    1,832
    Thanks G/R
    190/533
    Trade Feedback
    16 (100%)
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey darklinux
    so if i got you right you want me to use createremotethread to run the functions i want to run?
    why should i want to do this if i could just use a delegate of the function i wanna call and call this delegate in my hooked code?

    or did i misunderstand you?

  7. #7
    JuJuBoSc's Avatar Banned for scamming CoreCoins Purchaser
    Reputation
    1019
    Join Date
    May 2007
    Posts
    922
    Thanks G/R
    1/3
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CreateRemoteThread is useless in your case, your best choice is a Queue imo, anyway as Drakefish I think you should make you GUI directly in the remote process.

  8. #8
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well the idea for having my gui in the remoteprocess itself is no problem, BUT the problem is that the game client closes if it loses the connection for some reason. this would cause my bot to stop too and i'd have to write an external monitor application to look for the running bots and restart them. if i'm oop with the gui and therefor i still have a window where i can just check if the game is running, i can just write a simple restart routine with autologin and char selection etc.

    but i will think about it today...damned i really can't find the time to code atm,either i'm out with friends or have to work....
    i'll write back as soon as i came any further

  9. #9
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I plan on an external GUI application which displays basic information about each botting session (player & target health and mana). Nevertheless, my whole bot logic runs inside WoW (actually, with my current implementation I would also be able to run it from an external process). I communicate with my GUI for some configuration things like profiles, custom classes, if botting should stop etc.

  10. #10
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *push*

    ok so i got my hook working
    for handling the executing of my stuff i thought that it would work if i use some lock variable and in the hook check of the lock is active,if it is,sleep until it is not anymore
    the problem is that it does not work this way(the client crashes just like before when doing many calls in a short time)
    do you have any other idea?

    i also tryed to have the hook in another thread so i can actually call several functions at once and it will in all of them wait until the hook is free again, but i didn't get around doing this correctly
    i'll try to hook the function before every call and release it afterwards

    any ideas would be great and as always thanks for your help,without mmowned i seriously wouldn't be as far in understanding what is going on as i am now(and still there is a lot more to learn)

Similar Threads

  1. Replies: 8
    Last Post: 07-22-2013, 01:24 AM
  2. Replies: 3
    Last Post: 11-13-2009, 03:31 AM
  3. Dumping the function names from the WoW executable?
    By Tanaris4 in forum WoW Memory Editing
    Replies: 3
    Last Post: 08-08-2009, 10:51 AM
  4. Using Hook to execute code in WoWs mainthread
    By flo8464 in forum WoW Memory Editing
    Replies: 5
    Last Post: 07-25-2009, 05:27 AM
  5. View what API functions are hooked by Wow
    By barthen in forum WoW Memory Editing
    Replies: 8
    Last Post: 10-26-2008, 11:25 PM
All times are GMT -5. The time now is 07:15 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