Curious of safety of my current EndScene/LUADoString menu

User Tag List

Results 1 to 10 of 10
  1. #1
    cvccbum's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    26
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Curious of safety of my current EndScene/LUADoString

    Hey all. I have been using an EndScene hook I wrote for some time. My bot basicly runs off full LUA functions that I inject via the EndScene hook.

    My question is if everytime I do an LUADoString (which is 100s of times a second, I'd assume) I Hook, throw my LUADoString in, and unhook, is that safe? I randomize my codecave, and switch up the format of the ASM in my hook also. I'm afraid hooking and unhooking so much, and even using the LUADoString via my hook will throw up a flag. I will go at a different approach if that is the case.

    Curious of safety of my current EndScene/LUADoString
  2. #2
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds like you're doing some asm injection and not dll injection.

    Hooking/Unhooking all the time is bad because:
    1. If your hook library is not thead-safe (stopping the mainthread before modifying the code it executes), this increases the chance of a race condition and a resulting crash.
    2. If your library doesn't suck it will stop the thread and doing this too often will have a great impact on performance of the game.

    And no, there are no flags set by running a lua string. You might look up the function in a disassembler.
    Hey, it compiles! Ship it!

  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)
    Why not just hook once? That would be much simpler and more efficient.

  4. #4
    cvccbum's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    26
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I stop the thread when I run a few functions (Interact, etc) but with the EndScene hook I've never had it crash without suspending the main thread. I'll go ahead and try to just hook once, and see how it rolls. Thanks for the advice.

  5. #5
    Nikentic's Avatar Elite User
    Reputation
    453
    Join Date
    Oct 2007
    Posts
    1,556
    Thanks G/R
    10/4
    Trade Feedback
    6 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't unhook until you're finished with all the dostrings.

  6. #6
    -Ryuk-'s Avatar Elite User CoreCoins Purchaser Authenticator enabled
    Reputation
    529
    Join Date
    Nov 2009
    Posts
    1,028
    Thanks G/R
    38/51
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hook at runtime, and Unhook when closing.

    Then just use Framescript_ExcuteBuffer();

    Failing that, Try using iHook. Although that doesnt randomize the codecaves :P
    |Leacher:11/2009|Donor:02/2010|Established Member:09/2010|Contributor:09/2010|Elite:08/2013|

  7. #7
    cvccbum's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    26
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I decided to do 1 hook and 1 unhook. I was doing the multiple hooks because if I was debugging it, and it was to crash (my program) it would have never unhooked. I dont think that is much of an issue though now.

  8. #8
    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)
    So in an exception handler ensure that you unhook before your app closes.

  9. #9
    cvccbum's Avatar Member
    Reputation
    1
    Join Date
    Sep 2009
    Posts
    26
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I did it mostly for when I was to end debugging abruptly, just trying stuff out, etc. I will add one though.

  10. #10
    EmilyStrange's Avatar Active Member
    Reputation
    34
    Join Date
    Jul 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by cvccbum View Post
    Well I did it mostly for when I was to end debugging abruptly, just trying stuff out, etc. I will add one though.
    Unfortunately, Windows 7 removed some of the ways to execute a cleanup handler easily, however, if you are using Visual Studio, you can execute your cleanup handler in the DTE even if the debugger detaches abruptly.

    Always shoot for 100% RAII (hooked application is treated as a resource) and you are good to go.

Similar Threads

  1. Replies: 5
    Last Post: 08-02-2022, 10:49 PM
  2. [Selling] WTS US hardcore gold curious why current market value is so low
    By Lennybunz in forum Diablo 3 Buy Sell Trade
    Replies: 0
    Last Post: 07-31-2012, 10:37 AM
  3. [Question] CTM & EndScene Hook Safety
    By MadCoder in forum WoW Memory Editing
    Replies: 2
    Last Post: 03-01-2012, 09:35 AM
  4. Curious
    By pandaman in forum World of Warcraft General
    Replies: 10
    Last Post: 08-22-2006, 08:15 PM
  5. I need Current PTR Mountain climbing code-Because of error
    By Wildslayer in forum World of Warcraft General
    Replies: 0
    Last Post: 08-16-2006, 08:24 AM
All times are GMT -5. The time now is 03:32 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