[Crash] when calling TerrainClick menu

These ads disappear when you log in.

Results 1 to 5 of 5
  1. #1
    NightlyBlooD's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    18
    Thanks G/R
    5/0
    Trade Feedback
    0 (0%)

    [Crash] when calling TerrainClick

    Good day guys.
    Tell me what could be the problem, when calling the function HandleTerrainClick WoW crashes

    Code:
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    private delegate bool Spell_C__HandleTerrainClickDelegate(TerrainClick TC);
    
    public static bool HandleTerrainClick(Location Coords, ulong GUID = 0ul)
    {
        if (_spellHandleTerrainClick == null)
            _spellHandleTerrainClick = Reader.Memory.RegisterDelegate<Spell_C__HandleTerrainClickDelegate>((IntPtr)0x00527360, true); // 3.3.5a(12340)
        return _spellHandleTerrainClick(new TerrainClick {GUID = GUID, Location = Coords, Button = MouseButton.Left });
    }
    
    public struct Location
    {
        public float x;
        public float y;
        public float z;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct TerrainClick
    {
        public  GUID;
        public Location Location;
        [MarshalAs(UnmanagedType.U4)] public MouseButton Button;
    }
    
    [Flags]
    public enum MouseButton : uint
    {
        Left = 1,
        Middle = 2,
        None = 0,
        Right = 4,
        XButton1 = 8,
        XButton2 = 0x10
    }
    Error
    Code:
    Errors 
    ERROR #132 (0x85100084) Fatal Exception
    Program:	C:\WoWCircle 3.3.5a\Wow.exe
    Exception:	0xE0434352 (unknown exception) at 0023:76D3C762
    
    ----------------------------------------
        x86 Registers
    ----------------------------------------
    
    EAX=03B5F9F0  EBX=00000005  ECX=00000005  EDX=00000000  ESI=03B5FAB0
    EDI=00000001  EBP=03B5FA48  ESP=03B5F9F0  EIP=76D3C762  FLG=00000216
    CS =0023      DS =002B      ES =002B      SS =002B      FS =0053      GS =002B
    I tried to divide the GUID into 2 parts, there was no more crash, but the click does not work
    Code:
    public struct GUID
    {
            public uint GUIDx;
            public uint GUIDy;
            public GUID(ulong GUID)
            {
                GUIDx = (uint)((GUID) & 0xFFFFFFFF);
                GUIDy = (uint)(((GUID) >> 32) & 0xFFFFFFFF);
    
            }
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct TerrainClick
    {
        public GUID GUID;
        public Location Location;
        [MarshalAs(UnmanagedType.U4)] public MouseButton Button;
    }
    Last edited by NightlyBlooD; 05-20-2019 at 03:31 PM.

    These ads disappear when you log in.

  2. #2
    DarkLinux's Avatar ★ Elder ★ CoreCoins User Authenticator enabled
    Reputation
    1410
    Join Date
    May 2010
    Posts
    1,624
    Thanks G/R
    131/413
    Trade Feedback
    15 (100%)
    I was told WoWCircle 3.3.5a runs a custom client/anti cheat. If that is true it could be that. I would try 00527830 CGGameUI__HandleTerrainClick, I think its the same thing. What code is at 76D3C762, was that your own module?


    --edit

    Could be missing 4 bytes? I'm counting 7 "args" ( 0x1C )

    Code:
    mov     [ebp+var_18], 0
    mov     [ebp+var_14], 0
    mov     [ebp+var_C], eax
    mov     [ebp+var_10], edx
    mov     edx, [ebp+arg_0]
    lea     eax, [ebp+var_18]
    push    eax
    mov     [ebp+var_8], ecx
    mov     [ebp+var_4], edx
    call    sub_527830
    --edit

    Not the 1st? -- edit Was looking at the wrong version of wow
    wor...t-working.html

    Code:
    GV.WoWHook.Memory.WriteFloat(DoStringArg_Codecave, 0);
    GV.WoWHook.Memory.WriteFloat(DoStringArg_Codecave + 8, 0);
    GV.WoWHook.Memory.WriteFloat(DoStringArg_Codecave + 16, X);
    GV.WoWHook.Memory.WriteFloat(DoStringArg_Codecave + 20, Y);
    GV.WoWHook.Memory.WriteFloat(DoStringArg_Codecave + 24, Z);
    --edit

    nvm, looking over that asm again, its a pointer to the data that's on the stack, ooops So no extra 4 bytes


    --edit

    https://www.ownedcore.com/forums/wor...-question.html

    Originally Posted by TOM_RUS View Post
    Isn't argument of that function supposed to be a pointer (ref in C#) to struct?
    As history repeats itself...
    Last edited by DarkLinux; 05-21-2019 at 12:04 AM.

  3. Thanks NightlyBlooD (1 members gave Thanks to DarkLinux for this useful post)
  4. #3
    NightlyBlooD's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    18
    Thanks G/R
    5/0
    Trade Feedback
    0 (0%)
    This method works.
    Code:
            public void TerrainClick(ulong GUID = 0,float X=0, float Y=0, float Z=0)
            {
                IntPtr MyStructure = Reader.Memory..AllocateMemory(20);
                Reader.Memory..Write<ulong>(MyStructure, GUID);
                Reader.Memory..Write<float>(MyStructure + 0x8, X);
                Reader.Memory..Write<float>(MyStructure + 0xC, Y);
                Reader.Memory..Write<float>(MyStructure + 0x10, Z);
                Reader.Memory..Asm.Clear();
     
                String[] asm = new String[]
                {
                "mov eax, " + MyStructure + "",
                "push eax",
                "call " + (uint)Spell_C__HandleTerrainClick, //(IntPtr)0x00527360
                "add esp, 0x4",
                "retn"
                };
     
                wow.InjectAndExecute(asm);
                Reader.Memory..FreeMemory(MyStructure);
            }
    but unfortunately it does not fit ...
    CGGameUI__HandleTerrainClick also leads to crash

  5. #4
    NightlyBlooD's Avatar Member
    Reputation
    1
    Join Date
    Sep 2012
    Posts
    18
    Thanks G/R
    5/0
    Trade Feedback
    0 (0%)
    Sorry, completely forgotten =) Thanks for the help!
    Originally Posted by DarkLinux View Post
    Originally Posted by TOM_RUS View Post
    Isn't argument of that function supposed to be a pointer (ref in C#) to struct?
    It really helped, although Google translator did not quite correctly translate xD

  6. #5
    Icesythe7's Avatar Contributor CoreCoins User
    Reputation
    170
    Join Date
    Feb 2017
    Posts
    97
    Thanks G/R
    2/63
    Trade Feedback
    0 (0%)
    Code:
    class TerrainClickData
    {
    public:
    	int64_t guid; //0x0000
    	Vector3 pos; //0x0008
    	int32_t click_type; //0x0014
    }; //Size: 0x0018
    
    int32_t TerrainClick(TerrainClickData* data)
    {
    	return reinterpret_cast<int32_t(__cdecl*)(TerrainClickData*)>(0x527830)(data);
    }
    and called like this

    Code:
    WowFunctions::TerrainClickData testData{0, {-9413.485f, 88.942f, 57.320f}, 0x4};
    TerrainClick(&testData);
    just pass 0 to guid as that is what wow does, no crash here and works as expected with no errors (using c++ you will have to convert on your own)

    also be sure to call from wows thread like endscene etc
    Last edited by Icesythe7; 05-24-2019 at 10:28 AM.

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. Ascent Crash when starting it [Rep+ to they who can fix it ! :p]
    By TheZaronz in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 01-20-2008, 09:00 AM
  3. [QUESTION] Client Crashes when tries to load modifyed ADT file...
    By evan1 in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-08-2007, 10:49 AM
  4. Crash when entering edited zone! :(
    By Gorge in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 09-16-2007, 02:32 PM
  5. is your MWS crashing when u click on an M2? Learn how to fix it here.
    By soulcatcher in forum World of Warcraft Model Editing
    Replies: 17
    Last Post: 01-06-2007, 10:29 AM
All times are GMT -5. The time now is 02:49 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search