private void CharSelector_Load(object sender, EventArgs e) { Process[] check_procs = Process.GetProcessesByName("Gw"); procs = new Process[check_procs.Length]; int validProcs = 0; for (int i = 0; i < check_procs.Length; i++) { GWCAMemory mem = new GWCAMemory(check_procs[i]); if (mem.HaveModule("GWToolbox.dll")) { continue; } Tuple <IntPtr, int> imagebase = mem.GetImageBase(); mem.InitScanner(imagebase.Item1, imagebase.Item2); IntPtr charnameAddr = mem.ScanForPtr(new byte[] { 0x8B, 0xF8, 0x6A, 0x03, 0x68, 0x0F, 0x00, 0x00, 0xC0, 0x8B, 0xCF, 0xE8 }, -0x42, true); mem.TerminateScanner(); procs[validProcs] = check_procs[i]; validProcs++; string charname = mem.ReadWString(charnameAddr, 30); comboBox.Items.Add(charname); checkedListBox.Items.Add(charname, CheckState.Unchecked); } comboBox.SelectedIndex = 0; if (checkedListBox.Items.Count > 0) { checkedListBox.SetItemCheckState(0, CheckState.Checked); } }
public Process[] GetValidProcesses() { Process[] check_procs = Process.GetProcessesByName("Gw"); Process[] tmp_procs = new Process[check_procs.Length]; string[] tmp_charnames = new string[check_procs.Length]; IntPtr charnameAddr = IntPtr.Zero; if (check_procs.Length < 1) { return(check_procs); } int validProcs = 0; // Check for admin rights. WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); bool isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator); procs = new Process[check_procs.Length]; for (int i = 0; i < check_procs.Length; i++) { if (!isElevated && ProcessHelper.IsProcessOwnerAdmin(check_procs[i])) { continue; // Guild wars has higher privileges } GWCAMemory mem = new GWCAMemory(check_procs[i]); if (mem.HaveModule("GWToolbox.dll")) { continue; } Tuple <IntPtr, int> imagebase = mem.GetImageBase(); mem.InitScanner(imagebase.Item1, imagebase.Item2); charnameAddr = mem.ScanForPtr(new byte[] { 0x8B, 0xF8, 0x6A, 0x03, 0x68, 0x0F, 0x00, 0x00, 0xC0, 0x8B, 0xCF, 0xE8 }, -0x42, true); mem.TerminateScanner(); if (charnameAddr == IntPtr.Zero) { continue; } tmp_procs[validProcs] = check_procs[i]; tmp_charnames[validProcs] = mem.ReadWString(charnameAddr, 40); validProcs++; } charnames = new string[validProcs]; procs = new Process[validProcs]; for (int i = 0; i < validProcs; i++) { procs[i] = tmp_procs[i]; charnames[i] = tmp_charnames[i]; } return(procs); }
public static void FindAddressesIfNeeded(GWCAMemory cli) { IntPtr tmp; Tuple <IntPtr, int> imagebase = cli.GetImageBase(); cli.InitScanner(imagebase.Item1, imagebase.Item2); tmp = cli.ScanForPtr(new byte[] { 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x10, 0x56, 0x6A }, 0x22, true); if (tmp != IntPtr.Zero) { WinTitle = tmp; } tmp = cli.ScanForPtr(new byte[] { 0x83, 0xC4, 0x40, 0x5F, 0x5E, 0x5B, 0x8B, 0x4D }); if (tmp != IntPtr.Zero) { EmailAddPtr = cli.Read <IntPtr>(new IntPtr(tmp.ToInt32() - 0x48)); CharnamePtr = cli.Read <IntPtr>(new IntPtr(tmp.ToInt32() - 0x2E)); } cli.TerminateScanner(); }