[C#] [Question] Running TraceLine from an Endscene Hook menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Kaziko.'s Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#] [Question] Running TraceLine from an Endscene Hook

    Hello everyone, over the past few days I have created a gathering bot and the only thing left to do is stop if from gathering underground nodes. Through reading this forum and others I have decided that the best way to do this is via TraceLine.

    From my research I found out that CGWorldFrame__Intersect is actually the wrapper for TraceLine. Here is that function in IDA: (Thanks to TOM_RUS).

    [SPOILER]

    [/SPOILER]
    ImageShack&#174; - Online Photo and Video Hosting <--- If it doesn't work.

    I have tried to run the function on the bottom right in the picture (which I believe to be TraceLine) through my EndScene hook (I'm using iHook, thanks to Ryuk).

    See my code here: #1513204 - Pastie

    I am using the following Offset for TraceLine = 0x2851E0 (Thanks to RivalLfr).
    And the flags from MaiN's post here:
    http://www.mmowned.com/forums/world-...ml#post1687087

    When I run this code WoW crashes and I get the error:
    Could not write the specified bytes! 60D1CE09 [5]
    (It points to Hook.Restore()

    There is no errors with iHook as far as I can tell, I have used both the inbuilt and my own DoString() and GetLocalizedText() perfectly.

    I have just a few questions about TraceLine (I have searched, this has kept me stuck for days).
    Do I need to write the Point(0, 0, 0) for the return? Is this what is causing me the error?
    Or is there something wrong with the string that I'm Injecting?

    Thanks alot,

    Kaziko.

    [C#] [Question] Running TraceLine from an Endscene Hook
  2. #2
    VexeRR's Avatar Private
    Reputation
    1
    Join Date
    Jan 2011
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the problem is that you're not calling the right function. I'm not very experienced with this though. Probably wrong :P

    Im also trying to get it to work maybe we can work together?
    Last edited by VexeRR; 01-31-2011 at 01:52 AM.

  3. #3
    alynel's Avatar Member
    Reputation
    4
    Join Date
    Jun 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The function you're calling (0x2851E0) is CGWorldFrame__Intersect. TraceLine is at 0x2BFBE0. TraceLine is stdcall, so it'll clean up the stack for you, but if you're gonna use CGWorldFrame__Intersect, you'll have to do it yourself. Either way you shouldn't have the "pop ebp" after the call. Either use TraceLine and get rid of it, or use CGWorldFrame__Intersect and replace it with "add esp, 0x18".

    Oh and it shouldn't be '[ebp+" + zeroCodeCave + "]' etc, just '[" + zeroCodeCave + "]'

    1 more thing! I think it's the last one... for startCodeCave, result, and end, you just need '"mov eax, " + startCodeCave' since they're pointers, so you want to pass the address of your vectors rather than the x value of them...
    Last edited by alynel; 01-31-2011 at 03:03 AM.

  4. #4
    RivaLfr's Avatar Contributor CoreCoins Purchaser Authenticator enabled
    Reputation
    221
    Join Date
    Sep 2010
    Posts
    258
    Thanks G/R
    2/25
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Look this code

    Code:
     // protected delegate byte Traceline(ref WoWPoint end, ref WoWPoint start, ref WoWPoint result, ref float distance, uint flags, ref WoWPoint Optional)
    				
    		"push " + (int)0, //Optional
                    "push " + (uint)hitFlags, //(CGWorldFrameHitFlags)
                    "push " + (uint)distance,  //(0.9f)
                    "push " + (uint)result, //(x=0;y=0;z=0)
                    "push " + (uint)start, //(x;y;z)
                    "push " + (uint)end, //(x;y;z)
                    "call " + (uint)((uint)wowModule + (uint)TraceLine),
                    "mov [" + (uint)result + "], al", // Move result to CodeCave result (bool)
                    "add esp, " + (uint)0x18, //adjusting stack after all pushes
                    "retn",

  5. #5
    Kaziko.'s Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you and +rep to Rivalfr and alynel.

    I now have the following code working without WoW crashing.

    I am using TraceLine = 0x2851E0.

    Pastie: #1514474 - Pastie
    (still needs some cleaning up that alynel PM'd me about)

    Now the only problem is the bool returned is always true even if my target is out of LoS or I aim the TraceLine below my feet.

    I think this is a problem with the HitFlags. I have tried every one from
    http://www.mmowned.com/forums/world-...ml#post1687087

    But the bool returned is always true. Any Ideas?

    I'll try to see what I get from distance and result.

  6. #6
    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)
    You pass the flag as pointer, which is not a pointer.

  7. #7
    Kaziko.'s Avatar Member
    Reputation
    4
    Join Date
    Oct 2008
    Posts
    26
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks JuJu,

    I fixed my code up but it is still always returning true.

    Heres my new code: #1516577 - Pastie

  8. #8
    RivaLfr's Avatar Contributor CoreCoins Purchaser Authenticator enabled
    Reputation
    221
    Join Date
    Sep 2010
    Posts
    258
    Thanks G/R
    2/25
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Add line:

    Code:
    UInt32 resultRet = Memory.AllocateMemory(0x4);
    Replace
    Code:
    "mov [" + (uint)resultCodeCave + "], al",
    by
    Code:
    "mov [" + (uint)resultRet + "], al",
    And replace
    Code:
    ret = Convert.ToBoolean(Hook.InjectAndExecute(asm));
    by
    Code:
    Hook.InjectAndExecute(asm);
    ret = Hook.Memory.ReadInt(resultRet) > 0;
    Last edited by RivaLfr; 02-01-2011 at 05:30 AM.

Similar Threads

  1. [2.4.3][c#]Some questions about endscene hooking
    By squiggy in forum WoW Memory Editing
    Replies: 2
    Last Post: 06-11-2016, 12:24 PM
  2. Unloading from EndScene hook
    By nerexis in forum WoW Memory Editing
    Replies: 2
    Last Post: 10-28-2012, 08:45 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. EndScene hooking, question
    By shikyo in forum WoW Memory Editing
    Replies: 4
    Last Post: 02-02-2012, 03:02 PM
  5. Question: Prevent Hair From Showing Through Headpiece
    By XxChr0n0xX in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 12-29-2006, 03:18 PM
All times are GMT -5. The time now is 02:35 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