DescriptorClass C# menu

Shout-Out

User Tag List

Results 1 to 1 of 1
  1. #1
    matamore's Avatar Member
    Reputation
    6
    Join Date
    Dec 2008
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DescriptorClass C#

    Hi guys.
    After beeing a passive member, i decided to share something...

    I wrote a class to read all descriptors from Memory.

    Credits go to Bobbysing for WoWX Framework 2010
    and to the guy who made the PlugIn for IDA to dump the Descriptors..

    Enjoy :-)

    Code:
        using System;
        using System.Collections;
    
        public class DescriptorClass
        {
    
            public static DescriptorClass Main;// = new DescriptorClass();
    
            # region Fields
    
            public uint StartAddress;
            public SortedList DescriptorList;
            public bool Dump = false;
    
            # endregion
    
            # region Constructors
    
            public DescriptorClass()
            {
                this.StartAddress = GetStartAddress();
                this.DescriptorList = new SortedList();
                this.Dump = false;
                this.Init();
            }
    
            public DescriptorClass(bool Dump)
            {
                this.StartAddress = GetStartAddress();
                this.DescriptorList = new SortedList();
                this.Dump = Dump;
                this.Init();
            }
    
            # endregion
    
            # region Methods
    
            public void Init()
            {
    
                # region
    
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0xD), "OBJECT", null);
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0x32), "ITEM", "OBJECT_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0x57), "CONTAINER", "ITEM_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0x7C), "UNIT", "OBJECT_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0xA1), "PLAYER", "UNIT_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0xC6), "GAMEOBJECT", "OBJECT_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0xEB), "DYNAMICOBJECT", "OBJECT_END");
                LoadFields(Memory.Read<UInt32>(this.StartAddress + 0x110), "CORPSE", "OBJECT_END");
    
                # endregion
    
            }
    
            private void LoadFields(uint dwPointer, string szPrefix, string szStart)
            {
    
                # region
    
                if (Dump)
                {
                    GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, "Dump descriptor: " + szPrefix + " start: " + dwPointer.ToString("x8"));
                }
                uint dwFieldCount = 0;
                uint dwLastIndex = 0;
    
                while (true)
                {
                    string pszName = Memory.ReadCString(Memory.Read<UInt32>(dwPointer), 0x40);
    
                    if (Dump)
                    {
                        GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, pszName);
                    }
                    if (pszName == "")
                    {
                        break;
                    }
    
                    if (pszName.Contains(szPrefix))//strstr(pszName, szPrefix) == 0)
                    {
                        uint dwIndex;
    
                        dwIndex = Memory.Read<UInt32>(dwPointer + 4);
                        dwLastIndex = dwIndex + Memory.Read<UInt32>(dwPointer + 8);
    
                        //if (szStart != 0)
                        //    fprintf(hFile, "\t%s = %s + 0x%X,\n", pszName, szStart, dwIndex * 4);
                        //else
                        //    fprintf(hFile, "\t%s = 0x%X,\n", pszName, dwIndex * 4);
    
                        if (!this.DescriptorList.ContainsKey(pszName))
                        {
                            this.DescriptorList.Add(pszName, dwIndex);
                        }
    
                        if (Dump)
                        {
                            GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, pszName + " = " + dwIndex.ToString("x4"));
                        }
    
                        dwFieldCount = dwFieldCount + 1;
    
                    }
                    dwPointer = dwPointer + 0x14;
    
                }
    
                if (!String.IsNullOrEmpty(szPrefix))
                {
                    if (!this.DescriptorList.ContainsKey(szPrefix + "_END"))
                    {
                        this.DescriptorList.Add(szPrefix + "_END", dwFieldCount);
                    }
                    if (Dump)
                    {
                        GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, szPrefix + "_END" + " = " + dwFieldCount.ToString("x4"));
                    }
                }
    
                # endregion
            
            }
    
    
            private uint GetStartAddress()
            {
    
                # region
    
                try
                {
                    CPattern pattern = new CPattern(Memory.GetModule("Wow.exe"), new ReadDelegate(Memory.ReadBytes));
    
                    if (true || Dump)
                    {
                        GLogClass.WriteLog(LOG_CATEGORY.EXCEPTION, "Module: 0x" + Memory.GetModule("Wow.exe").BaseAddress.ToString("x8"));
                    }
    
                    //uint dwStartFunc = pattern.FindPattern("56 57 68 00 00 00 00 B8 05", "xxx????xx", ' '); // 3.3.5.12345
                    //uint dwStartFunc = pattern.FindPattern("68 70 12 E2 00 B8 05", "x????xx", ' ');
                    uint dwStartFunc = pattern.FindPattern("56 57 68 00 00 00 00 B8 00", "xxx????x?", ' ');
                    // 56 57 68 00 00 00 00 B8  06
    
                    if (Dump)
                    {
                        GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, "dwStartFunc: " + dwStartFunc.ToString("x8"));
                    }
                    return dwStartFunc;
    
                }
                catch (Exception ex)
                {
                    GLogClass.WriteLog(LOG_CATEGORY.EXCEPTION, ex.Message);
                    return 0;
                }
    
                # endregion
    
            }
    
            public uint Get(string What)
            {
    
                # region
    
                uint Start = 0;
    
                # region Get Start
    
                if (What.StartsWith("ITEM") || What.StartsWith("UNIT") || What.StartsWith("GAMEOBJECT") || What.StartsWith("DYNAMICOBJECT") || What.StartsWith("CORPSE"))
                {
                    if (this.DescriptorList.ContainsKey("OBJECT_END"))
                    {
                        Start += 4 * (uint)this.DescriptorList["OBJECT_END"];
                    }
                }
                else if (What.StartsWith("CONTAINER"))
                {
                    if (this.DescriptorList.ContainsKey("OBJECT_END"))
                    {
                        Start += 4 * (uint)this.DescriptorList["OBJECT_END"];
                    }
                    if (this.DescriptorList.ContainsKey("ITEM_END"))
                    {
                        Start += 4 * (uint)this.DescriptorList["ITEM_END"];
                    }
                }
                else if (What.StartsWith("PLAYER"))
                {
                    if (this.DescriptorList.ContainsKey("OBJECT_END"))
                    {
                        Start += 4 * (uint)this.DescriptorList["OBJECT_END"];
                    }
                    if (this.DescriptorList.ContainsKey("UNIT_END"))
                    {
                        Start += 4 * (uint)this.DescriptorList["UNIT_END"];
                    }
                }            
    
                # endregion
    
                if (this.DescriptorList.ContainsKey(What))
                {
                    //GLogClass.WriteLog(LOG_CATEGORY.INFORMATION, What + " : " + Start + 4 * (uint)this.DescriptorList[What]);
                    return Start + 4 * (uint)this.DescriptorList[What];
                }
                return 0;
    
                # endregion
    
            }
    
            # endregion
    
        }
    
        public delegate byte[] ReadDelegate(uint dwStart, uint nSize);

    DescriptorClass C#
All times are GMT -5. The time now is 07:48 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