FrameScript-functions and warden menu

Shout-Out

User Tag List

Results 1 to 9 of 9
  1. #1
    Cromon's Avatar Legendary


    Reputation
    840
    Join Date
    Mar 2008
    Posts
    714
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    FrameScript-functions and warden

    Hello there!

    Im working on my inproc wrapper for all the LUA-stuff. Thus im creating an empty 0-sized frame which listens for events. Im also detouring FrameScript::InvalidPtrCheck to not get in trouble when a function is called that was previously registered using FrameScript::RegisterFunction.

    The code i use is the following:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;
    
    namespace Framework.LUA
    {
        public class EventManager
        {
            public EventManager()
            {
                IntPtr origPtrCheck = new IntPtr(Memory.Native.ModuleBase.ToInt32() + (int)LUAOffsets.funInvalidPointerCheck);
                PtrCheckNew = OnPointerCheck;
    
                PointerCheckDetour = new Memory.Detour<InvalidFunctionPointerCheckDlg>(origPtrCheck, PtrCheckNew);
                if (!PointerCheckDetour.Enable())
                {
                    Console.WriteLine("Unable to enable detour!");
                    throw new InvalidOperationException("Unable to write detour!");
                }
    
                eventHandler = OnEvent;
                tramp = LUAFunctions.CreateLuaTrampoline(eventHandler);
                LUAFunctions.FrameScript_RegisterFunction("theEventHandler", tramp);
    
                mEventScript.Lines.Add("local f = CreateFrame(\"FRAME\", \"EventFrame" + this.GetHashCode() + "\", UIParent);");
                mEventScript.Lines.Add("f:SetWidth(0);");
                mEventScript.Lines.Add("f:SetHeight(0);");
                mEventScript.Lines.Add("f:RegisterEvent(\"TIME_PLAYED_MSG\");");
                mEventScript.Lines.Add("f:RegisterEvent(\"CHAT_MSG_SAY\");");
                mEventScript.Lines.Add("f:RegisterEvent(\"UNIT_SPELLCAST_SUCCEEDED\");");
                mEventScript.Lines.Add("f:SetScript(\"OnEvent\", theEventHandler);");
    
                mEventScript.Execute();
            }
    
            public int OnEvent(IntPtr state)
            {
                var luas = new LUAState(state);
                for (int i = 1; i <= luas.NumArguments; ++i)
                {
                    if (luas.ArgumentTypes[i] == LUATypes.String)
                    {
                        string str = luas.Get<string>(i);
                        Console.WriteLine("string arg{0} = {1}", i, str);
                    }
                }
                return 0;
            }
    
            private int OnPointerCheck(IntPtr function)
            {
                if (function == tramp)
                    return 1;
    
                return (int)PointerCheckDetour.CallDetoured(function);
            }
    
            delegate int EventDelegate(IntPtr state);
    
            [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
            delegate int InvalidFunctionPointerCheckDlg(IntPtr function);
    
            InvalidFunctionPointerCheckDlg PtrCheckNew;
    
            EventDelegate eventHandler = null;
            IntPtr tramp;
            Memory.Detour<InvalidFunctionPointerCheckDlg> PointerCheckDetour;
    
    
            LUAScript mEventScript = new LUAScript();
        }
    }
    Now my question is:
    Does anybody of the guys that studied warden know if it check if InvalidPtrCheck was changed? I must confess that im not that much into warden so far but from the name and the code InvalidPtrCheck is executing ive got the feeling that if id be blizzard id check that function.

    Thanks for any thoughts or responses on that!

    Greetings
    Cromon

    FrameScript-functions and warden
  2. #2
    jjaa's Avatar Contributor
    Reputation
    245
    Join Date
    Dec 2006
    Posts
    562
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warden has scanned for those invalid ptr checks in the past (i think it was actually the data that stored the end of the .text segment). That's why most people write a code cave in the .text segment that jumps out to their function.

  3. #3
    caytchen's Avatar Contributor
    Reputation
    138
    Join Date
    Apr 2007
    Posts
    162
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or just not register a new function at all. Anyway, if you still want to do it, don't change the bad function pointer check, but just register a jmp to your function that you write to a code cave to pass the check.

  4. #4
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whilst jjaa and caytchen are both correct, there is a slightly better 'public' way to do it. Register a callback inside the .text section that when called will cause an exception to be raised (interrupt, invalid instruction, access violation, etc etc). Then you can use VEH to catch this exception when your fake callback is called, and redirect to your real callback. That way you don't need to modify WoW at all, not even to write a jump to a 'code cave' (which I beleive is something that caused HB to get detected a while back -- I can't remember 100% as it was quite a while ago, so don't quote me on that).

  5. #5
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...or don't register a callback at all and use a userdata bridge
    Don't believe everything you think.

  6. #6
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    ...or don't register a callback at all and use a userdata bridge
    **** that. Lazy way ftw.

  7. #7
    Cromon's Avatar Legendary


    Reputation
    840
    Join Date
    Mar 2008
    Posts
    714
    Thanks G/R
    0/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Whilst jjaa and caytchen are both correct, there is a slightly better 'public' way to do it. Register a callback inside the .text section that when called will cause an exception to be raised (interrupt, invalid instruction, access violation, etc etc). Then you can use VEH to catch this exception when your fake callback is called, and redirect to your real callback. That way you don't need to modify WoW at all, not even to write a jump to a 'code cave' (which I beleive is something that caused HB to get detected a while back -- I can't remember 100% as it was quite a while ago, so don't quote me on that).
    That sounds interesting! So for example registering 0x40269D (not rebased) as function which is just alignment and filled with int 3 (0xCC) and catch exceptions using VEH and if exception location is 0x40269D and the exception code is first chance exception call my callback, is that right?

    About other suggestions:
    As the whole project is only to improve my skills and not aiming to write a bot ill try to implement each of them if possible as every accomplished thing is a learned thing

  8. #8
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cromon View Post
    That sounds interesting! So for example registering 0x40269D (not rebased) as function which is just alignment and filled with int 3 (0xCC) and catch exceptions using VEH and if exception location is 0x40269D and the exception code is first chance exception call my callback, is that right?

    About other suggestions:
    As the whole project is only to improve my skills and not aiming to write a bot ill try to implement each of them if possible as every accomplished thing is a learned thing
    Your terminology is slightly off, but yes, you seem to have the basic concept down. It's not very difficult to do, give it a try!

  9. #9
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could also destroy unchecked pointers to use a VEH hook, but be careful.


Similar Threads

  1. Windows 10 and Warden question
    By cjgrimm in forum WoW Bots Questions & Requests
    Replies: 4
    Last Post: 03-16-2016, 03:55 AM
  2. [Selling] EU Account 46K prestige starter pack and wardens collector, premium expire 18-11-15!
    By andres619 in forum Skyforge Buy Sell Trade
    Replies: 0
    Last Post: 10-01-2015, 04:44 PM
  3. Purchased Account and Warden Ban?
    By HottKarl in forum World of Warcraft General
    Replies: 5
    Last Post: 07-31-2014, 03:21 PM
  4. How to execute LUA function and get it's result?
    By piiters in forum WoW Bots Questions & Requests
    Replies: 2
    Last Post: 06-07-2010, 05:51 AM
  5. Call lua function and get result
    By starfish99 in forum WoW Memory Editing
    Replies: 4
    Last Post: 12-26-2008, 05:15 AM
All times are GMT -5. The time now is 08:51 AM. 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