VFunc GetName.. Someone mind explaining? menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    136
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    VFunc GetName.. Someone mind explaining?

    Im trying to figure out how to get the names of different kind of objects. But this really drives me insane. After reading serveral topics here this is what I came up with. Would be really thankful if someone could have a look at my code and tell me what Ive missed.

    Code:
        public class WoWObject
        {
            [UnmanagedFunctionPointer(CallingConvention.ThisCall, CharSet = CharSet.Ansi)]
            private delegate IntPtr GetNameDelegate(IntPtr objectPtr);
    
            private GetNameDelegate _GetName;
            
            protected IntPtr _Pointer;
            etc.etc.
        }
    _Pointer is the base address of an object. Im "quite" sure this is the right one since its what I use when I enumrerate the linked list, and so on. ;P

    and where I get the name
    Code:
            public string Name
            {
                get
                {
                    if (_GetName == null)
                    {
                        IntPtr ptr = Marshal.ReadIntPtr(_Pointer, (51 * 4));
                        _GetName = Utilities.RegisterDelegate<GetNameDelegate>(ptr);
                    }
                    return Marshal.PtrToStringAnsi(_GetName(_Pointer));
                }
            }
    IntPtr ptr = Marshal.ReadIntPtr(_Pointer, (51 * 4));
    This is where it fails.... I get 0 as return value. Im fairly sure that BaseAddress + 51*4 should be where the virtual function pointer is stored? Or what am I missing?

    VFunc GetName.. Someone mind explaining?
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by xzidez View Post
    Im trying to figure out how to get the names of different kind of objects. But this really drives me insane. After reading serveral topics here this is what I came up with. Would be really thankful if someone could have a look at my code and tell me what Ive missed.

    Code:
        public class WoWObject
        {
            [UnmanagedFunctionPointer(CallingConvention.ThisCall, CharSet = CharSet.Ansi)]
            private delegate IntPtr GetNameDelegate(IntPtr objectPtr);
    
            private GetNameDelegate _GetName;
            
            protected IntPtr _Pointer;
            etc.etc.
        }
    _Pointer is the base address of an object. Im "quite" sure this is the right one since its what I use when I enumrerate the linked list, and so on. ;P

    and where I get the name
    Code:
            public string Name
            {
                get
                {
                    if (_GetName == null)
                    {
                        IntPtr ptr = Marshal.ReadIntPtr(_Pointer, (51 * 4));
                        _GetName = Utilities.RegisterDelegate<GetNameDelegate>(ptr);
                    }
                    return Marshal.PtrToStringAnsi(_GetName(_Pointer));
                }
            }
    IntPtr ptr = Marshal.ReadIntPtr(_Pointer, (51 * 4));
    This is where it fails.... I get 0 as return value. Im fairly sure that BaseAddress + 51*4 should be where the virtual function pointer is stored? Or what am I missing?
    That's because Marshal.ReadIntPtr(x,x) doesn't do a first read.

    You want

    [[obj]+51*4]

    Marshal.Read gives

    [obj + 51*4]

    Thus your issue.

  3. #3
    xzidez's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    136
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    That's because Marshal.ReadIntPtr(x,x) doesn't do a first read.

    You want

    [[obj]+51*4]

    Marshal.Read gives

    [obj + 51*4]

    Thus your issue.
    Duh.. Well now I just feel stupid.

    Anyway. Thanks a lot! +rep.. (even tho it doesnt make much difference in your rep pool ^^)

Similar Threads

  1. Replies: 5
    Last Post: 08-09-2016, 09:34 AM
  2. Can someone explain what requirements noggit has
    By Heartripperz in forum WoW ME Questions and Requests
    Replies: 7
    Last Post: 05-20-2009, 03:38 PM
  3. Can someone explain Arena win-trading?
    By jakobud in forum WoW PvP & Battlegrounds
    Replies: 6
    Last Post: 05-19-2008, 10:39 PM
  4. Someone please explain botting consiqunces to me.
    By spongebob7 in forum World of Warcraft General
    Replies: 4
    Last Post: 06-26-2007, 12:41 AM
All times are GMT -5. The time now is 02:44 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