Code injection, random crashes menu

Shout-Out

User Tag List

Results 1 to 9 of 9
  1. #1
    tok_junior's Avatar Member
    Reputation
    4
    Join Date
    Apr 2009
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code injection, random crashes

    Hi all,

    tl;dr - Is CreateRemoteThread() viable for injecting small snippets of code, or is that the reason of my random crashes?

    I've been out of the botting scene since isxwow ceased existing, and just started looking at it again. I used to be on irc as junior|, and I'm sure some of you will remember me, and hopefully that I'm not completely clueless or asking for handouts

    So, anyway, I've forgotten everything, but fired up IDA yesterday and now have a basic object manager up and running, and I'm able to run LUA code by injecting via remote threads. When just running LUA things seem to work fine, but when I'm trying to set a target by guid (calling function at 0x8CE477 in latest live) I get random crashes more often than not. I don't seem to remember having this problem back in WOTLK, so I'm wondering if anything's changed architecturally. I think I'm running into some threading issues, and I'm mainly wondering if you think this will work if I hook the mainthread (EndScene or such), or if I'm doing something else that's stupid?

    Code injection, random crashes
  2. #2
    Corthezz's Avatar Elite User Authenticator enabled
    Reputation
    386
    Join Date
    Nov 2011
    Posts
    325
    Thanks G/R
    191/98
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LUA isnt threadsafe and should be called from the final state of the main thread (EndScene). Not sure if this applies to every WoW version tho.
    Why the client is crashing when you call the SetTarget function I cant tell for sure since I am not working with your client version

  3. #3
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    I can confirm that executing lua code is not thread-safe within WoW and you should execute this code from the main thread. An interesting aside, just because EndScene is called does not mean it is being called from the 'main thread'. If you are injecting a ui toolkit of some kind which also uses DirectX it may render in its own thread. I have seen that happen!

  4. #4
    tok_junior's Avatar Member
    Reputation
    4
    Join Date
    Apr 2009
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hooking the main-thread solved everything. I didn't go for hooking D3D at all, as I figured there wouldn't be any guarantee that it was actually called from the main thread, which namreeb now confirmed.

  5. #5
    Corthezz's Avatar Elite User Authenticator enabled
    Reputation
    386
    Join Date
    Nov 2011
    Posts
    325
    Thanks G/R
    191/98
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by tok_junior View Post
    Hooking the main-thread solved everything. I didn't go for hooking D3D at all, as I figured there wouldn't be any guarantee that it was actually called from the main thread, which namreeb now confirmed.
    Sounds interesting. What function did you choose? Someone told me about a SetTimer function.
    I for once tried a function (CGxDeviceD3d__ISceneEnd) also in the mainthread which leaded to very unpredictable errors (strange graphic errors, random crashes all the time etc).
    Last edited by Corthezz; 04-17-2014 at 04:00 AM.

  6. #6
    tok_junior's Avatar Member
    Reputation
    4
    Join Date
    Apr 2009
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Corthezz View Post
    Sounds interesting. What function did you choose? Someone told me about a SetTimer function once.
    I for once tried a function (CGxDeviceD3d__ISceneEnd) also in the mainthread which leaded to very unpredictable errors (strange graphic errors, random crashes all the time etc).
    A bit further down in the callgraph of ISceneEnd is call to CGxDeviceD3d__Present (not sure about the name, I just named it that), which works just fine. I also managed to do a bit of rendering when hooking that, even though it probably leads to very suboptimal state management in the device, which I of course don't care about

  7. #7
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Well it won't be a problem unless there is another rendering engine at work. To my knowledge, WoW calls EndScene always from it's 'main thread'. You could also just use GetCurrentThreadId() (http://msdn.microsoft.com/en-us/libr...v=vs.85).aspx) to check for being the 'main thread'.

  8. #8
    Wildbreath's Avatar Contributor
    Reputation
    162
    Join Date
    Feb 2012
    Posts
    121
    Thanks G/R
    2/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also you can hook a CGWorldFrame::Render and call after your lua functions.

  9. #9
    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)
    Or just hook EndScene as usual and check the device pointer ?

Similar Threads

  1. Replies: 11
    Last Post: 12-23-2010, 09:30 PM
  2. [Help] Have code injected *only* when required.
    By vulcanaoc in forum WoW Memory Editing
    Replies: 8
    Last Post: 07-14-2009, 06:23 AM
  3. [GUIDE] Fixing Random Server Crashes and having to press enter repeatedly
    By kreegoth in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 08-23-2008, 06:39 PM
  4. WoW crashes randomly
    By Jinrohk in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 04-06-2008, 03:35 PM
  5. Random Teleporting With Crashing
    By Premium-mmo in forum World of Warcraft Exploits
    Replies: 22
    Last Post: 05-08-2007, 07:56 AM
All times are GMT -5. The time now is 08:00 PM. 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