private void button6_Click(object sender, EventArgs e) { if (textBox2.Text != null && selectedProcess != null && pList != null) { try { byte[] bytes = File.ReadAllBytes(textBox2.Text); Process process = pList.FindProcess(selectedProcess); PS4.LoadElf(process.pid, bytes); label1.Text = "Elf Loaded"; } catch (Exception) { label1.Text = "Error"; MessageBox.Show("Unable to Load ELF"); } } else { MessageBox.Show("Select a Process First"); } }
private void ELF_BGWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { Invoke((MethodInvoker) delegate { CurrentStatus_Label.ForeColor = Color.RoyalBlue; CurrentStatus_Label.Text = $"Sending {ELF}.elf to {IP_TextBox.Text}:{Port_TextBox.Text}..."; }); byte[] elf = File.ReadAllBytes(ELF_File); Process process = pList.FindProcess(selectedProcess); ps4.LoadElf(process.pid, elf); Thread.Sleep(1000); Invoke((MethodInvoker) delegate { CurrentStatus_Label.ForeColor = Color.LimeGreen; CurrentStatus_Label.Text = $"{ELF}.elf injected successfully!"; }); } catch (Exception ex) { if (ex.HResult == -2147467259) { Invoke((MethodInvoker) delegate { CurrentStatus_Label.ForeColor = Color.Red; CurrentStatus_Label.Text = $"{ELF}.elf injection failed!"; }); } else { MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Hand); } } }