private void HookTheGame(object sender, EventArgs e) { if (GameProcess == null) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit Invoke(new MethodInvoker(WriteGameIsHookedText)); Invoke(new MethodInvoker(DrawWindow)); Invoke(new MethodInvoker(DrawStuffTimer)); } catch { Invoke(new MethodInvoker(WriteWaitingForGameText)); } } else if (GameProcess.IsRunning == false) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit Invoke(new MethodInvoker(WriteGameIsHookedText)); Invoke(new MethodInvoker(DrawWindow)); Invoke(new MethodInvoker(DrawStuffTimer)); } catch { Invoke(new MethodInvoker(WriteWaitingForGameText)); } } }
private void setFPS_Click(object sender, EventArgs e) { using (var sharp = new MemorySharp(ApplicationFinder.FromProcessName("halo5forge").FirstOrDefault())) { long fps; try { fps = (long)Convert.ToInt32(FPSBox.Text); } catch (SystemException ex) { // this class's error string MessageBox.Show("Invalid FPS value"); return; } bool fpsValid = long.TryParse(FPSBox.Text.ToString(), out fps); if (fpsValid) { sharp[fpsAddress].Write <long>(1000000 / fps); } else { } } }
static void Main() { Console.WriteLine("sloobs ty fly"); Console.WriteLine("toggling fly!"); new Thread(() => { while (true) { using (var m = new MemorySharp(ApplicationFinder.FromProcessName("TY2").First())) { var jumpPointer = new IntPtr(0x004465EC); int[] offsets = { 0x3C, 0x3C, 0x238, 0x54, 0xDC, 0x4 }; jumpPointer = m[jumpPointer].Read <IntPtr>(); jumpPointer = m[jumpPointer + offsets[0], false].Read <IntPtr>(); jumpPointer = m[jumpPointer + offsets[1], false].Read <IntPtr>(); jumpPointer = m[jumpPointer + offsets[2], false].Read <IntPtr>(); jumpPointer = m[jumpPointer + offsets[3], false].Read <IntPtr>(); jumpPointer = m[jumpPointer + offsets[4], false].Read <IntPtr>(); m[jumpPointer + offsets[5], false].Write(1); Thread.Sleep(50); } } }).Start(); }
private void setFov_Click(object sender, EventArgs e) { using (var sharp = new MemorySharp(ApplicationFinder.FromProcessName("halo5forge").FirstOrDefault())) { float fov; try { fov = (float)Convert.ToDouble(fovBox.Text); } catch (SystemException ex) { // this class's error string MessageBox.Show("Invalid FOV value"); return; } bool fovValid = float.TryParse(fovBox.Text.ToString(), out fov); if (fovValid) { sharp[fovAddress].Write <float>(fov); } else { } } }
public void HookTheGame(object sender, EventArgs e) { if (GameProcess == null) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit HeroesHandle = WinAPIComponents.FindWindow(null, HEROES_WINDOW_NAME); Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteGameIsHookedText)); Program.xSmallMainWindow.Invoke(new MethodInvoker(DrawWindow)); } catch { Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteWaitingForGameText)); } } else if (GameProcess.IsRunning == false) { try { // Game Process GameProcess = new MemorySharp(ApplicationFinder.FromProcessName("Tsonic_win").First()); // If the first doesn't successfully happen this will never be hit HeroesHandle = WinAPIComponents.FindWindow(null, HEROES_WINDOW_NAME); Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteGameIsHookedText)); Program.xSmallMainWindow.Invoke(new MethodInvoker(DrawWindow)); } catch { Program.xSmallMainWindow.Invoke(new MethodInvoker(WriteWaitingForGameText)); } } }
private void readCurrentValues() { using (var sharp = new MemorySharp(ApplicationFinder.FromProcessName("halo5forge").FirstOrDefault())) { fovBox.Text = Convert.ToString(sharp[fovAddress].Read <float>()); FPSBox.Text = Convert.ToString(1000000 / sharp[fpsAddress].Read <long>()); } }
public static IList <KeyValuePair <string, string> > OpenWithListForExtension(String ext) { IList <String> progs = new List <string>(); List <KeyValuePair <string, string> > map = new List <KeyValuePair <string, string> >(); if (IsBlank(ext)) { return(map); } if (!ext.StartsWith(".")) { ext = "." + ext; } using (RegistryKey clsExt = Registry.ClassesRoot.OpenSubKey(ext)) { IList <string> rootList = OpenWithListForExtension(ext, clsExt); foreach (string s in rootList) { progs.Add(s); } } using ( RegistryKey clsExt = Registry.CurrentUser.OpenSubKey( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\" + ext)) { IList <string> explorerList = OpenWithListForExtension(ext, clsExt); foreach (string s in explorerList) { progs.Add(s); } } foreach (string exe in progs.Distinct()) { ApplicationFinder finder = ApplicationFinderFactory.get(); Application application = finder.getDescription(exe); if (finder.isInstalled(application)) { map.Add(new KeyValuePair <string, string>(application.getName(), exe)); } else { map.Add(new KeyValuePair <string, string>(LocalFactory.get(exe).getName(), exe)); } } map.Sort( delegate(KeyValuePair <string, string> pair1, KeyValuePair <string, string> pair2) { return(pair1.Key.CompareTo(pair2.Key)); }); return(map); }
public void FromWindowClassName() { // Arrange var process = Resources.ProcessTest; // Act var ret = ApplicationFinder.FromWindowClassName("Notepad++").First(); // Assert Assert.AreEqual(process.Id, ret.Id, "Both processes are not equal."); }
public void FromProcessId() { // Arrange var process = Resources.ProcessTest; // Act var ret = ApplicationFinder.FromProcessId(process.Id); // Assert Assert.AreEqual(process.Id, ret.Id, "Both processes are not equal."); }
private void button2_Click(object sender, EventArgs e) { //Max Level using (var m = new MemorySharp(ApplicationFinder.FromProcessName(gameName).FirstOrDefault())) { var levelPtr = new IntPtr(0x01CAC924); int[] offsets = { 0x324, 0x38 }; levelPtr = m[levelPtr].Read <IntPtr>(); levelPtr = m[levelPtr + offsets[0], false].Read <IntPtr>(); m[levelPtr + offsets[1], false].Write <int>(15); } }
private void button1_Click(object sender, EventArgs e) { //Max Money using (var m = new MemorySharp(ApplicationFinder.FromProcessName(gameName).FirstOrDefault())) { var moneyPtr = new IntPtr(0x01B71110); int[] offsets = { 0x0, 0x14, 0x14, 0x218 }; moneyPtr = m[moneyPtr].Read <IntPtr>(); moneyPtr = m[moneyPtr + offsets[0], false].Read <IntPtr>(); moneyPtr = m[moneyPtr + offsets[1], false].Read <IntPtr>(); moneyPtr = m[moneyPtr + offsets[2], false].Read <IntPtr>(); m[moneyPtr + offsets[3], false].Write <int>(999999999); } }
static void Main() { try { Process process = ApplicationFinder.FromProcessName(ProcessName).First(); if (process != null) { Memory = new MemorySharp(process); BaseAddress = Memory[BaseAddress].Read <IntPtr>(); ItemDataPointer = Memory[BaseAddress + ItemDataOffset, false]; CharacterPointer = Memory[BaseAddress + CharacterOffset, false]; ChallengePointer = Memory[BaseAddress + ChallengeOffset, false]; MiscPointer = Memory[BaseAddress + MiscOffset, false]; ItemPointer = Memory[BaseAddress + ItemOffset, false]; EquipPointer = Memory[BaseAddress + EquipOffset, false]; ScoutPointer = Memory[BaseAddress + ScoutOffset, false]; updateThread = new Thread(UpdateAddresses); updateThread.Start(); for (int i = 0; i < MaxEquipItems; i++) { EquipItems[i] = new EquipItem(); } Data.ParseItemData(); Data.ParseIDRanges(); Data.ParseParameters(); Data.ParseTraits(); // This is a stopgap fix to prevent some in-game CTDs and softlocks as reported by users in the tech forum process.PriorityClass = ProcessPriorityClass.High; } } catch { MessageBox.Show($"Failed to attach to {GameName}!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(-1); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); updateThread.Abort(); }
private static Process getProcess() { Process proc = ApplicationFinder.FromProcessName("halo5forge").FirstOrDefault(); Match match = versionRegex.Match(proc.MainModule.FileName); if (!match.Success) { throw new Exception("Unable to determine application version."); } String version = match.Groups[1].Value; if (version != EXPECTED_VERSION) { throw new Exception(String.Format("Wrong version. Expected={0}. Actual={1}.", EXPECTED_VERSION, version)); } return(proc); }
public DriverManager() { ApplicationFinder appFinder = new ApplicationFinder(); string defaultBrowserName = appFinder.GetSystemDefaultBrowser(); switch (defaultBrowserName) { case "Google Chrome": string chromeVersion = appFinder.GetApplicationVersion("Google Chrome"); if (chromeVersion != "") { ChromeDriver chromeDriver = new ChromeDriver(chromeVersion, "chromedriver_win32.zip", "chromedriver.exe"); SelectedDriver = chromeDriver; } break; case "Opera": string operaVersion = appFinder.GetApplicationVersionRegex(@"^Opera Stable [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$"); if (operaVersion != "") { OperaDriver operaDriver = new OperaDriver(operaVersion); operaDriver.ZipFileName = "operadriver_win64.zip"; operaDriver.Filename = "operadriver_win64\\operadriver.exe"; SelectedDriver = operaDriver; } break; case "Microsoft Edge": string edgeVersion = appFinder.GetApplicationVersion("Microsoft Edge"); if (edgeVersion != "") { EdgeDriver edgeDriver = new EdgeDriver(edgeVersion, "edgedriver_win64.zip", "msedgedriver.exe"); SelectedDriver = edgeDriver; } break; } }
static Memory() { process = new MemorySharp(ApplicationFinder.FromProcessName("Wow").First()); }
/// <summary> /// Initializes a new instance of the <see cref="MemorySharp"/> class. /// </summary> /// <param name="processId">Process id of the process to open.</param> public MemorySharp(int processId) : this(ApplicationFinder.FromProcessId(processId)) { }