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); } }
private void CharSelector_Load(object sender, EventArgs e) { procs = Process.GetProcessesByName("Gw"); IntPtr charnameAddr; { GWCAMemory firstprocmems = new GWCAMemory(procs[0]); firstprocmems.InitScanner(new IntPtr(0x401000), 0x49A000); charnameAddr = firstprocmems.ScanForPtr(new byte[] { 0x6A, 0x14, 0x8D, 0x96, 0xBC }, 0x9, true); firstprocmems.TerminateScanner(); } foreach (Process proc in procs) { GWCAMemory mem = new GWCAMemory(proc); if (mem.Read <Int32>(new IntPtr(0x00DE0000)) != 0) { continue; } if (mem.HaveModule("GWToolbox.dll")) { continue; } 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); 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.Read <Int32>(new IntPtr(0x00DE0000)) != 0) { continue; } if (mem.HaveModule("GWToolbox.dll")) { continue; } if (charnameAddr == IntPtr.Zero) { mem.InitScanner(new IntPtr(0x401000), 0x49A000); charnameAddr = mem.ScanForPtr(new byte[] { 0x6A, 0x14, 0x8D, 0x96, 0xBC }, 0x9, true); mem.TerminateScanner(); } if (charnameAddr == IntPtr.Zero) { continue; } tmp_procs[validProcs] = check_procs[i]; tmp_charnames[validProcs] = mem.ReadWString(charnameAddr, 60); 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 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); }