Beispiel #1
0
        public static int ScanPattern(string mModuleName, string mPattern, int Offset = 0, int Extra = 0, bool ModuleSubract = false)
        {
            IntPtr        hProcess       = CylMem.hProcess.Handle;
            ProcessModule SelectedModule = null;

            foreach (ProcessModule module in CylMem.hProcess.Modules)
            {
                if (Path.GetFileName(module.FileName) == mModuleName)
                {
                    SelectedModule = module;
                }
            }
            if (SelectedModule == null)
            {
                throw new Exception("Selected Module is Null !");
            }
            var scanner = new SigScan(hProcess);

            scanner.SelectModule(SelectedModule.BaseAddress, SelectedModule.ModuleMemorySize);
            int Scaned = (int)scanner.FindPattern(mPattern, out long time);

            if (Scaned != 0)
            {
                var Scan = CylMem.ReadInt(Scaned + Offset) + Extra;
                if (ModuleSubract)
                {
                    Scan -= (Int32)SelectedModule.BaseAddress;
                }
                return(Scan);
            }
            else
            {
                return(0);
            }
        }
        public static int GetStringHash(string name)
        {
            CharCodes codes = CylMem.CRead <CharCodes>(Modules.VSTDLibDLLAdress + convar_name_hash_table);
            int       v2    = 0;
            int       v3    = 0;

            for (int i = 0; i < name.Length; i += 2)
            {
                v3 = codes.tab[v2 ^ char.ToUpper(name[i])];
                if (i + 1 == name.Length)
                {
                    break;
                }
                v2 = codes.tab[v3 ^ char.ToUpper(name[i + 1])];
            }
            return(v2 | (v3 << 8));
        }
        public static void ScanTable(IntPtr table, int level, int offset, string name)
        {
            var count = CylMem.ReadInt((int)table + 0x4);

            for (var i = 0; i < count; i++)
            {
                var propID      = CylMem.ReadInt((int)table) + i * 0x3C;
                var propName    = CylMem.ReadString(CylMem.ReadInt(propID));
                var isBaseClass = propName.IndexOf("baseclass") == 0;
                var propOffset  = offset + CylMem.ReadInt(propID + 0x2C);
                if (!isBaseClass)
                {
                    if (!Table.ContainsKey(name))
                    {
                        Table.Add(name, new Dictionary <string, int>());
                    }

                    if (!Table[name].ContainsKey(propName))
                    {
                        Table[name].Add(propName, propOffset);
                    }
                }

                var child = (IntPtr)CylMem.ReadInt(propID + 0x28);

                if (child == IntPtr.Zero)
                {
                    continue;
                }

                if (!isBaseClass)
                {
                    --level;
                }

                ScanTable(child, ++level, propOffset, name);
            }
        }
        public static void Init()
        {
            var _firstclass = (IntPtr)SigScan.ScanPattern(Managers.Modules.ClientDLLName, "A1 ? ? ? ? C3 CC CC CC CC CC CC CC CC CC CC A1 ? ? ? ? B9", 1, 0, false); // dwGetAllClasses

            _firstclass = (IntPtr)CylMem.ReadInt((int)_firstclass);

            if (_firstclass == IntPtr.Zero)
            {
                //Environment.Exit(-1);
            }

            do
            {
                var table = (IntPtr)CylMem.ReadInt((int)_firstclass + 0xC);
                if (table != IntPtr.Zero)
                {
                    var table_name = CylMem.ReadString(CylMem.ReadInt((int)table + 0xC));
                    ScanTable(table, 0, 0, table_name);
                }

                _firstclass = (IntPtr)CylMem.ReadInt((int)_firstclass + 0x10);
            } while (_firstclass != IntPtr.Zero);
        }
        public static int GetConVarAddress(string name)
        {
            var hash = GetStringHash(name);

            int      CvarEngine = CylMem.ReadInt(Modules.VSTDLibDLLAdress + interface_engine_cvar);
            int      Pointer    = CylMem.ReadInt(CylMem.ReadInt(CvarEngine + 0x34) + ((byte)hash * 4));
            Encoding enc        = Encoding.UTF8;

            while ((IntPtr)Pointer != IntPtr.Zero)
            {
                if (CylMem.ReadInt(Pointer) == hash)
                {
                    int ConVarPointer = CylMem.ReadInt(Pointer + 0x4);

                    if (CylMem.ReadString(CylMem.ReadInt(ConVarPointer + 0xC)) == name)
                    {
                        return(ConVarPointer);
                    }
                }

                Pointer = CylMem.ReadInt(Pointer + 0xC);
            }
            return((int)IntPtr.Zero);
        }
 public void ClearCallbacks()
 {
     CylMem.WriteInt(pThis + 0x44 + 0xC, 0);
 }