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 loaderForm_Load(object sender, EventArgs e) { IntPtr pCharname = (IntPtr)0x00A2AE80; clients = new Dictionary <string, GWCAMemory>(); Process[] procs = Process.GetProcessesByName("Gw"); if (procs.Length == 0) { MessageBox.Show("No Guild Wars clients found. Please start the client before running this."); Application.Exit(); } foreach (Process proc in procs) { GWCAMemory mem = new GWCAMemory(proc); string name = mem.ReadWString(pCharname, 30); if (name == "") { continue; } clients.Add(name, mem); } comboBoxCharnames.DataSource = new BindingSource(clients, null); comboBoxCharnames.DisplayMember = "Key"; comboBoxCharnames.ValueMember = "Value"; }
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); }
private void RefreshUI() { if (Program.accounts.Length > 4) { heightofgui = 143 + 17 * (Program.accounts.Length - 4); this.SetBounds(Location.X, Location.Y, Size.Width, heightofgui); } this.listViewAccounts.Items.Clear(); // Run through already open GW clients to see if accounts are already active. foreach (Process p in Process.GetProcessesByName("Gw")) { if (p.Threads.Count == 1) { continue; } GWCAMemory m = new GWCAMemory(p); GWMem.FindAddressesIfNeeded(m); string str = m.ReadWString(GWMem.EmailAddPtr, 64); for (int i = 0; i < Program.accounts.Length; ++i) { if (str == Program.accounts[i].email) { Program.accounts[i].active = true; Program.accounts[i].process = m; break; } } } // Fill out data. for (int i = 0; i < Program.accounts.Length; ++i) { listViewAccounts.Items.Add(new ListViewItem( new string[] { Program.accounts[i].character, Program.accounts[i].active ? "Active" : "Inactive" }, "gw-icon" )); } }
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); string charname = mem.ReadWString(charnameAddr, 30); comboBox1.Items.Add(charname); } comboBox1.SelectedIndex = 0; }
private void Form1_Load(object sender, EventArgs e) { procs = Process.GetProcessesByName("Gw"); if (procs.Length > 0) { var charnameAddr = GetCharnameAddress(procs[0]); var list = procs .Select(proc => { var mem = new GWCAMemory(proc); return(new GwProcess { Process = proc, Name = mem.ReadWString(charnameAddr, 30) }); }) .ToList(); listBox1.DataSource = list; listBox1.DisplayMember = "Name"; listBox1.ValueMember = "Process"; } }
private void MainForm_Load(object sender, EventArgs e) { heightofgui = 143; ImageList imglist = new ImageList(); imglist.Images.Add("gw-icon", Properties.Resources.gw_icon); listViewAccounts.SmallImageList = imglist; StreamReader file; try { file = new StreamReader("Accounts.json"); } catch (FileNotFoundException) { StreamWriter writerfile = File.CreateText("Accounts.json"); writerfile.Write("[]"); writerfile.Close(); file = new StreamReader("Accounts.json"); } JsonTextReader reader = new JsonTextReader(file); JsonSerializer serializer = new JsonSerializer(); accounts = serializer.Deserialize <Account[]>(reader); file.Close(); procs = new Process[accounts.Length]; bool[] alreadyonline = new bool[accounts.Length]; Process[] gwprocs = Process.GetProcessesByName("Gw"); foreach (Process proc in gwprocs) { GWCAMemory mem = new GWCAMemory(proc); string curaddr = mem.ReadWString(GWMem.EmailAddPtr, 100); for (int i = 0; i < accounts.Length; ++i) { if (accounts[i].email == curaddr) { procs[i] = proc; alreadyonline[i] = true; } } } if (first) { StatusUpdater.Interval = 1000; StatusUpdater.Tick += new EventHandler(TimerEventProcessor); StatusUpdater.Start(); BatchLoader.Interval = 7000; BatchLoader.Tick += new EventHandler(TimerBatchLoadAccounts); } if (accounts.Length > 4) { heightofgui += 17 * (accounts.Length - 4); this.SetBounds(Location.X, Location.Y, Size.Width, heightofgui); } for (int i = 0; i < accounts.Length; ++i) { listViewAccounts.Items.Add(new ListViewItem(new string[] { accounts[i].character, alreadyonline[i] ? "Active" : "Inactive" }, "gw-icon")); } first = false; }