Exemplo n.º 1
0
        public static void Initialize()
        {
            Client = 0;
            Engine = 0;
            if (_processHandle != IntPtr.Zero)
            {
                CloseHandle(_processHandle);
            }

            Process process;

            do
            {
                Process[] list;
                do
                {
                    Thread.Sleep(1000);
                    list = Process.GetProcessesByName("csgo");
                } while (list.Length == 0);

                process = list[0];
                ProcessModuleCollection modules = process.Modules;
                Thread.Sleep(1000);
                foreach (ProcessModule module in modules)
                {
                    if (module.ModuleName.Equals("client.dll"))
                    {
                        Client = (int)module.BaseAddress;
                    }
                    else if (module.ModuleName.Equals("engine.dll"))
                    {
                        Engine = (int)module.BaseAddress;
                    }
                }
            } while (Client == 0 || Engine == 0);

            _processHandle = OpenProcess(ProcessAccessFlags.VirtualMemoryRead, false, process.Id);


            OffsetUpdater.UpdateOffsets();
        }