code injection for OnRightClickUnit setting the params of the function menu

User Tag List

Results 1 to 4 of 4
  1. #1
    killmeplease's Avatar Member
    Reputation
    1
    Join Date
    Jul 2017
    Posts
    10
    Thanks G/R
    3/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    code injection for OnRightClickUnit setting the params of the function

    Hi all,

    So I am trying to call a function OnRightClickUnit at 0x60BEA0 and pass two parameters to it.
    Param 1: unit address from the object manager
    Param 2: integer with a value of 1 for autoloot

    I ve been following up on WiNiFiX post from here https://www.ownedcore.com/forums/wor...ml#post3436933 (1.12.1(5875)AutoLoot)

    Code:
     internal void OnRightClickObject(uint baseAddr, int autoLoot)
            {
                if (_wowHook.Installed)
                {
                    if (baseAddr != 0 && (autoLoot == 1 || autoLoot == 0))
                    {
                        // Write the asm stuff for Lua_DoString
                        String[] asm = new String[]
                            {
                            "push " + autoLoot,
                            "mov ECX, " + (uint)baseAddr,
                            "call " + (uint)Offsets.OnRightClickObject,
                            "retn",
                            };
    
                        _wowHook.InjectAndExecute(asm);
                    }
                }
            }
    KeyNote: He is calling OnRightClickObject and I want to call OnRightClickUnit ( two fairly similar functions)

    I am primarily using it as a guideline as I am not injecting the way he is doing it. But the principal remains the same.
    Set two parameters and call the function at an address.

    Now the part that I have been struggling with is setting the two parameters for this function. Previously I have called setTarget with a code cave injection and that worked out fine. But what I would like now is to call OnRightClickUnit. However setting the parameters for that function has proven somewhat tricky. I am not using blackMagic or anything like that I am relying on Windows API for C++ for all Ram related operations.

    Could anybody help me out in setting the two parameters for the function.
    Thus far I seam to be able to set one of the params without problems. With an opcode of b9. So in essence just a move instruction to move the value that is the address of the unit in the object manager into a register. But am not sure as how to handle the other argument which is 1 for autoloot.

    Patch 1.12.1

    Thank you all for your time and effort.
    Last edited by killmeplease; 01-31-2018 at 06:58 AM.

    code injection for OnRightClickUnit setting the params of the function
  2. #2
    vegoo's Avatar Contributor
    CoreCoins Purchaser Authenticator enabled
    Reputation
    275
    Join Date
    Dec 2011
    Posts
    707
    Thanks G/R
    10/27
    Trade Feedback
    110 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested and it works for me. Shellcode injection:

    Code:
    OnRightClickUnitAddress = 0x60BEA0
    
    def OnRightClickUnit(address):
        FunctionSpacee = VirtualAllocEx(processHandle, 0, 300, VIRTUAL_MEM, PAGE_EXECUTE_READWRITE)
        packedfunctionaddress = struct.pack("i", (OnRightClickUnitAddress - FunctionSpacee - 12))
        packedaddress = struct.pack("i", address)
    
        injectcode = "\x6A\x01\xB9"
        injectcode += packedaddress
        injectcode += "\xE8"
        injectcode += packedfunctionaddress
        injectcode += "\xC3"
    
        written = c_ulong()
        thread_id = c_ulong()
    
        WriteProcessMemory(processHandle, FunctionSpacee, injectcode, len(injectcode), byref(written))
        thisthread = CreateRemoteThread(processHandle, None, 0, FunctionSpacee, None, 0, byref(thread_id))
        if WaitForSingleObject(thisthread, 5000) == 0:
            CloseHandle(thisthread)
            VirtualFree(processHandle, FunctionSpacee, 0, 0x8000)
    I assumed autoloot is 1. Simple call with address from objectmanager.
    Last edited by vegoo; 01-31-2018 at 02:43 PM.
    WoW TGC Loot & WoW Items
    Selling EU & US WoW Gold
    Buying EU & US WoW Gold

  3. Thanks killmeplease (1 members gave Thanks to vegoo for this useful post)
  4. #3
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    But am not sure as how to handle the other argument which is 1 for autoloot.
    I feel like you don't really know what you're doing. Sounds like you understand the mov, but what don't you get about the push? You have the source... If you don't know the hex value then open CE, allocate some memory and enter the asm. Really hard to help when it looks like you have a large disconect.

  5. Thanks killmeplease (1 members gave Thanks to DarkLinux for this useful post)
  6. #4
    killmeplease's Avatar Member
    Reputation
    1
    Join Date
    Jul 2017
    Posts
    10
    Thanks G/R
    3/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so I see what the problem was. I simply used a wrong push. Thank you both.

Similar Threads

  1. [Request] Increase leniency for avatar settings (At the cost of CC?)
    By IChangedMyUsername in forum Suggestions
    Replies: 2
    Last Post: 12-09-2016, 01:12 PM
  2. [Selling] Heart of Aspects Mount for only $10 (I payed $25) The redeemption code is for US serv
    By driftman09 in forum WoW-US Account Buy Sell Trade
    Replies: 0
    Last Post: 08-21-2013, 01:11 PM
  3. [Trading] Soul of the Aspects code EU for powerleveling
    By phantom325 in forum World of Warcraft Buy Sell Trade
    Replies: 5
    Last Post: 04-12-2012, 07:05 AM
  4. [Guide]How to set up Wrath of The Lich King Repack
    By BrantX in forum WoW EMU Guides & Tutorials
    Replies: 83
    Last Post: 11-29-2008, 04:41 PM
  5. [Question] How do i set the rates of XP and Loot?
    By Gadella in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 12-11-2007, 05:43 AM
All times are GMT -5. The time now is 10:04 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