Calling lua functions requiering an hardware event menu

User Tag List

Results 1 to 11 of 11
  1. #1
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Calling lua functions requiering an hardware event

    Hello,

    today I tried to add the aspect of auction house to my bot, but I encountered a problem I haven't had before with my method to call lua functions. As you know do some functions like 'CreateAuction' require a hardware event and my first approach was writing the PerformanceCounter to LastHardwareEvent (aka anti-afk) aswell as moving the value into LastHardwareAction via asm directly before calling the lua functions (Tried it with every single function GetTop, LoadBuffer, PCall and ToLString), but I still receive the following message:

    Warning: AddOn XXX attempted to call a protected function (UNKNOWN()) which may require interaction.

    Which steps do you all take to be able to call functions which require a hardware event?

    Calling lua functions requiering an hardware event
  2. #2
    CrimeTime's Avatar Active Member
    Reputation
    20
    Join Date
    Dec 2007
    Posts
    83
    Thanks G/R
    16/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe should you look how the auctionhouse addons handle this problem.

  3. #3
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by CrimeTime View Post
    maybe should you look how the auctionhouse addons handle this problem.
    I did that already, but it's only a regular OnClick eventhandler.

    Code:
    function AuctionsCreateAuctionButton_OnClick()
        LAST_ITEM_START_BID = MoneyInputFrame_GetCopper(StartPrice);
        LAST_ITEM_BUYOUT = MoneyInputFrame_GetCopper(BuyoutPrice);
        DropCursorMoney();
        PlaySound("LOOTWINDOWCOINSOUND");
        local startPrice = MoneyInputFrame_GetCopper(StartPrice);
        local buyoutPrice = MoneyInputFrame_GetCopper(BuyoutPrice);
        if ( AuctionFrameAuctions.priceType == PRICE_TYPE_UNIT ) then
            startPrice = startPrice * AuctionsStackSizeEntry:GetNumber();
            buyoutPrice = buyoutPrice * AuctionsStackSizeEntry:GetNumber();
        end
        StartAuction(startPrice, buyoutPrice, AuctionFrameAuctions.duration, AuctionsStackSizeEntry:GetNumber(), AuctionsNumStacksEntry:GetNumber());
    end
    Last edited by Frosttall; 12-21-2012 at 04:05 PM.

  4. #4
    CrimeTime's Avatar Active Member
    Reputation
    20
    Join Date
    Dec 2007
    Posts
    83
    Thanks G/R
    16/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at StartAuction - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons
    there is an example how to use it and I think, if you do it on this way, you won't need any hardwareaction or something else.

  5. #5
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've succeeeded after many hours of try&error: Script_StartAuction makes a call to CGGameUI::CanPerformAction( whereas '8' is an id specifing the current action.

    The following solution will only work for a few methods and will not unlock completly locked function like moving. This method simulates the KeyDown-Flag which is set when you press a button (mouse or keyboard).

    summa sumarum: Writing '1' to the following address will allow to call StartAuction without error:

    Code:
            internal enum BlockedActionUnlockOffsets : uint
            {
                Ptr = 0xCC9EF4,
                Offset = 4704
            }

    Usage:

    Code:
                var unlockPtr = WowMem.ReadRebased<uint>(MemEnums.BlockedActionUnlockOffsets.Ptr);
                if (unlockPtr != 0)
                    unlockPtr += (uint)MemEnums.BlockedActionUnlockOffsets.Offset;
                //The lua pointer isn't always initialized. Take care of it!
    
                            if (unlockPtr != 0)
                            {
                                WowMem.Write(unlockPtr, 1);
                            }

  6. #6
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    I've succeeeded after many hours of try&error: Script_StartAuction makes a call to CGGameUI::CanPerformAction( whereas '8' is an id specifing the current action.

    The following solution will only work for a few methods and will not unlock completly locked function like moving. This method simulates the KeyDown-Flag which is set when you press a button (mouse or keyboard).

    summa sumarum: Writing '1' to the following address will allow to call StartAuction without error:

    Code:
            internal enum BlockedActionUnlockOffsets : uint
            {
                Ptr = 0xCC9EF4,
                Offset = 4704
            }

    Usage:

    Code:
                var unlockPtr = WowMem.ReadRebased<uint>(MemEnums.BlockedActionUnlockOffsets.Ptr);
                if (unlockPtr != 0)
                    unlockPtr += (uint)MemEnums.BlockedActionUnlockOffsets.Offset;
                //The lua pointer isn't always initialized. Take care of it!
    
                            if (unlockPtr != 0)
                            {
                                WowMem.Write(unlockPtr, 1);
                            }
    Patch
    Code:
    mov eax,1
    ret args*4
    to CanPerformAction and hook scan memcpy?
    Last edited by Master674; 12-22-2012 at 08:33 AM.

  7. #7
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Master674 View Post
    Patch
    Code:
    mov eax,1
    ret args*4
    to CanPerformAction and hook scan memcpy?
    Thought about that, but patching is no option for me :/

  8. #8
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    Thought about that, but patching is no option for me :/
    Put a breakpoint on it? You can achieve it without modifying a single byte... ^^
    Last edited by Master674; 12-22-2012 at 10:31 AM.

  9. #9
    Frosttall's Avatar Active Member
    Reputation
    64
    Join Date
    Feb 2011
    Posts
    261
    Thanks G/R
    16/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Master674 View Post
    Put a breakpoint on it? You can achieve it without modifying a single byte... ^^
    Breakpoints are easily detectable. Well, that wouldn't matter for a private project, but I can't consider this as an option if I ever plan to distribute it.

  10. #10
    Master674's Avatar Elite User
    Reputation
    487
    Join Date
    May 2008
    Posts
    578
    Thanks G/R
    2/23
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Frosttall View Post
    Breakpoints are easily detectable. Well, that wouldn't matter for a private project, but I can't consider this as an option if I ever plan to distribute it.
    Depends on how you do it. If you love overhead VirtualProtect and a VEH (there are no good ways of detecting those because _LdrpVectorHandlerList is not exported) / Singlestepping through the code.
    Last edited by Master674; 12-22-2012 at 11:17 AM.

  11. #11
    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 Master674 View Post
    Depends on how you do it. If you love overhead VirtualProtect and a VEH (there are no good ways of detecting those because _LdrpVectorHandlerList is not exported) / Singlestepping through the code.
    _LdrpVectorHandlerList may not be exported, but have you ever looked at what the return value of AddVectoredExceptionHandler REALLY is? (Hint: It's not just a void* to garbage )

Similar Threads

  1. Game crashes when calling lua function before loading screen
    By avizer in forum WoW Memory Editing
    Replies: 6
    Last Post: 04-03-2013, 09:04 PM
  2. Calling Lua Functions from DLL
    By Viano in forum WoW Memory Editing
    Replies: 19
    Last Post: 07-28-2009, 07:56 PM
  3. Question: LUA Functions Restricted to Hardware Events
    By jagged software in forum WoW Memory Editing
    Replies: 3
    Last Post: 03-28-2009, 01:59 PM
  4. Calling LUA Functions
    By cloud_wizard in forum WoW Memory Editing
    Replies: 7
    Last Post: 01-04-2009, 08:24 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 01:27 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