static void DoHax() { Process proc; var procs = Process.GetProcessesByName(procName); if (procs.Length == 0) { Console.WriteLine("No Proc found"); return; } else if (procs.Length == 1) { proc = procs[0]; } else { Console.WriteLine("Select proc [0-{0}]", procs.Length - 1); int index = int.Parse(Console.ReadLine()); proc = procs[index]; } string res = DllInjector.Inject((uint)proc.Id, @"TS3Hook.dll"); Console.WriteLine("Status = {0}", res ?? "OK"); Console.WriteLine("Done"); }
static bool DoHax() { Process[] procs; do { procs = Process.GetProcessesByName(ProcName); if (procs.Length == 0) { Console.WriteLine("No Process found"); System.Threading.Thread.Sleep(1000); } } while (procs.Length == 0); Process proc; if (procs.Length == 1) { proc = procs[0]; } else { for (int i = 0; i < procs.Length; i++) { Console.WriteLine("[{0}] TeamSpeak 3 ({1})", i, procs[i].MainModule.FileVersionInfo.FileVersion); } Console.WriteLine("Select proc [0-{0}]", procs.Length - 1); int index = int.Parse(Console.ReadLine()); proc = procs[index]; } string res = DllInjector.Inject(proc, @"TS3Hook.dll"); Console.WriteLine("Status = {0}", res ?? "OK"); Console.WriteLine("Done"); return(res == null); }
// Inject the DLL into the process and show errors if they occur private void Inject_Click(object sender, EventArgs e) { if (FileList.CheckedItems.Count == 0) { MessageBox.Show("No files were checked!\nNothing to inject", "Error"); return; } DllInjector ayy = DllInjector.GetInstance; int failed = 0; int attempted = FileList.CheckedItems.Count; for (int i = 0; i < attempted; i++) { string path = (FileList.CheckedItems[i] as CheatInfo).Path; switch (ayy.Inject(ProcessName.Text, path)) { case DllInjectionResult.DllNotFound: MessageBox.Show( $"Specified DLL file not found!\n\n" + $"Attempted to inject:\n" + $"'{path}'", "Error"); failed++; break; case DllInjectionResult.GameProcessNotFound: MessageBox.Show($"'{ProcessName.Text}.exe' couldn't be found!", "Error"); failed++; return; case DllInjectionResult.InjectionFailed: MessageBox.Show($"Injection failed!\n\n" + $"Attempted to inject:\n" + $"'{path}'", "Error"); failed++; break; } } if (MsgAfterInject.Checked) { Wav.Play(@"C:\Windows\Media\chord.wav"); if (failed == 0) { Dialogs.Win95.ShowMsg( "The injection was successful!\n" + "All DLLs have been injected", "Great news!"); } else { Dialogs.Win95.ShowMsg( $"{attempted - failed}/{attempted} " + $"DLLs were successfuly injected", "News of the day"); } } if (CloseAfterInject.Checked) { Close(); } }