private void GetAdressButton_Click(object sender, EventArgs e) { var memScanner = new MemoryScanner(cancerGame); var healthLocations = memScanner.SearchFor <byte[]>(new byte[] { 0x29, 0x51, 0x34 }); var energyLocations = memScanner.SearchFor <byte[]>(new byte[] { 0x29, 0x50, 0x40 }); var bowAmmoLocations = memScanner.SearchFor <byte[]>(new byte[] { 0x29, 0x42, 0x0C }); IntPtr GetLocation(IntPtr[] locations) { foreach (var p in locations) { MEMORY_BASIC_INFORMATION m; VirtualQueryEx(cancerGame.Handle, p, out m, (uint)Marshal.SizeOf(typeof(MEMORY_BASIC_INFORMATION))); if (m.Protect == 0x00000040) //0x00000040 equals PAGE_EXECUTE_READWRITE { return(p); } } return(IntPtr.Zero); } if (_healthAsmLocation == IntPtr.Zero) //checking wether this is set already { _healthAsmLocation = GetLocation(healthLocations); //getting the right asm line's location } if (_energyAsmLocation == IntPtr.Zero) { _energyAsmLocation = GetLocation(energyLocations); } if (_bowAmmoAsmLocation == IntPtr.Zero) { _bowAmmoAsmLocation = GetLocation(bowAmmoLocations); } void SetInitialized(IntPtr adress, Label l) { if (adress == IntPtr.Zero) { return; } l.ForeColor = Color.Green; l.Text = "Initialized"; } SetInitialized(_healthAsmLocation, HealthInitzialied); SetInitialized(_energyAsmLocation, EnergyInitialized); SetInitialized(_bowAmmoAsmLocation, ArrowsInitizialied); }
private void OpenChromeHandle() { //Automatically get the shockwave task from Chrome, this way: try { using (var handler = new ProcessHandler("chrome&flash")) { SetTitle(handler.ToString()); _scanner.SetProcess(handler); _scanner.SetSettings(_settings); _scanner.SearchFor("YAHAHA YOU DIDNT!"); } } catch (ProcessNotFoundException e) { // oh yeah, if you guys care about handle this, well, this is it... Console.WriteLine(e.Message); return; } }