void bt_connect_Click(object sender, EventArgs e) { bt_connect.Enabled = false; tb_ip.Enabled = false; try { byte[] buffer = new byte[1]; cli = new TcpClient(tb_ip.Text, PORT); cli.Client.Receive(buffer); id = buffer[0]; sw = new StreamWriter(GlobalInfo.lastip_file, false, Encoding.Default); sw.Write(tb_ip.Text); sw.Close(); } catch (Exception ex) { MessageBox.Show(ex.Source + " - " + ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); bt_connect.Enabled = true; tb_ip.Enabled = true; return; } game = new Process(); game.StartInfo.FileName = game_exe; game.StartInfo.WorkingDirectory = Path.GetDirectoryName(game_exe); game.Start(); mem = new MemoryEdit.Memory(); while (!mem.Attach(game, 0x001F0FFF)) { ; } if (baseaddr) { Pointer.baseaddr = (uint)game.MainModule.BaseAddress.ToInt64(); } Pointer.mem = mem; sock = cli.Client; thd = new Thread(new ThreadStart(Rec)); thd.Start(); thd2 = new Thread(new ThreadStart(Snd)); thd2.Start(); #if DEBUG tmr.Start(); #endif }
void bt_connect_Click(object sender, EventArgs e) { bt_connect.Enabled = false; tb_ip.Enabled = false; try { byte[] buffer = new byte[1]; client = new TcpClient(tb_ip.Text, PORT); client.Client.Receive(buffer); id = buffer[0]; sw = new StreamWriter(lastip_file, false, Encoding.Default); sw.Write(tb_ip.Text); sw.Close(); } catch (Exception ex) { MessageBox.Show(ex.Source + " - " + ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); bt_connect.Enabled = true; tb_ip.Enabled = true; return; } game = Process.Start(game_exe); mem = new MemoryEdit.Memory(); while (!mem.Attach(game, 0x001F0FFF)) { ; } /*Movement not working properly * //Code injection * IntPtr tmp = mem.Allocate((uint)(movement_injection.Length + rotation_injection.Length)); * mem.WriteByte((uint)tmp, movement_injection, movement_injection.Length); * mem.WriteByte((uint)((uint)tmp + movement_injection.Length), movement2_injection, movement2_injection.Length); * mem.WriteByte((uint)((uint)tmp + movement_injection.Length + movement2_injection.Length), rotation_injection, rotation_injection.Length); * //Override movement * mem.WriteByte(movement_addr1, movement_ovrd, movement_ovrd.Length); * mem.WriteByte(movement_addr2, movement_ovrd, movement_ovrd.Length); * //Modify call * mem.WriteByte(movement_addr1 + offs_call, BitConverter.GetBytes(((uint)tmp - (movement_addr1 + offs_call + 4))), 4); * mem.WriteByte(movement_addr1 + offs_call2, BitConverter.GetBytes((((uint)tmp + movement_injection.Length) - (movement_addr1 + offs_call2 + 4))), 4); * // * mem.WriteByte(movement_addr2 + offs_call, BitConverter.GetBytes(((uint)tmp - (movement_addr2 + offs_call + 4))), 4); * mem.WriteByte(movement_addr2 + offs_call2, BitConverter.GetBytes((((uint)tmp + movement_injection.Length) - (movement_addr2 + offs_call2 + 4))), 4); * //Override rotation * mem.WriteByte(rotation_addr, rotation_ovrd, rotation_ovrd.Length); * //Modify call * mem.WriteByte(rotation_addr + offs_call, BitConverter.GetBytes((((uint)tmp + movement_injection.Length + movement2_injection.Length) - (rotation_addr + offs_call + 4))), 4); * //Code injection end */ //Code injection IntPtr tmp = mem.Allocate((uint)respawn_injection.Length); mem.WriteByte((uint)tmp, respawn_injection, respawn_injection.Length); //Override respawn mem.WriteByte(respawn_addr, respawn_ovrd, respawn_ovrd.Length); //Modify jmp mem.WriteByte(respawn_addr + offs_jmp0, BitConverter.GetBytes((uint)tmp - (respawn_addr + offs_jmp0 + 4)), 4); mem.WriteByte((uint)tmp + offs_jmp1, BitConverter.GetBytes(respawn3_addr - ((uint)tmp + offs_jmp1 + 4)), 4); mem.WriteByte((uint)tmp + offs_jmp2, BitConverter.GetBytes(respawn3_addr - ((uint)tmp + offs_jmp2 + 4)), 4); mem.WriteByte((uint)tmp + offs_jmp3, BitConverter.GetBytes(respawn2_addr - ((uint)tmp + offs_jmp3 + 4)), 4); //Code injection end sock = client.Client; thd = new Thread(new ThreadStart(NetRec)); thd.Start(); thd2 = new Thread(new ThreadStart(NetSend)); thd2.Start(); }
void bt_connect_Click(object sender, EventArgs e) { bt_connect.Enabled = false; tb_ip.Enabled = false; try { byte[] buffer = new byte[1]; client = new TcpClient(tb_ip.Text, PORT); client.Client.Receive(buffer); id = buffer[0]; sw = new StreamWriter(lastip_file, false, Encoding.Default); sw.Write(tb_ip.Text); sw.Close(); } catch (Exception ex) { MessageBox.Show(ex.Source + " - " + ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); bt_connect.Enabled = true; tb_ip.Enabled = true; return; } game = Process.Start(game_exe); mem = new MemoryEdit.Memory(); while (!mem.Attach(game, 0x001F0FFF)) { ; } //Code injection uint addr; IntPtr tmp = mem.Allocate((uint)inj_ptr_trc.Length); mem.WriteByte((uint)tmp, inj_ptr_trc, inj_ptr_trc.Length); //Pointer reset addr = 0x00448380; mem.WriteByte(addr, inj_ptr_res, inj_ptr_res.Length); mem.WriteByte(addr + 1, BitConverter.GetBytes((uint)tmp - (addr + LEN_JMP)), 4); //Ped pointer addr = 0x0050149B; mem.WriteByte(addr, inj_ptr_ped, inj_ptr_ped.Length); mem.WriteByte(addr + 3, BitConverter.GetBytes(((uint)tmp + inj_ofs_ped) - (addr + 2 + LEN_JMP)), 4); //Car pointer addr = 0x004E24C3; mem.WriteByte(addr, inj_ptr_car, inj_ptr_car.Length); mem.WriteByte(addr + 1, BitConverter.GetBytes(((uint)tmp + inj_ofs_car) - (addr + LEN_JMP)), 4); //JMP mem.WriteByte((uint)tmp + offs_jmp[0], BitConverter.GetBytes(0x00448386 - ((uint)tmp + offs_jmp[0] + 4)), 4); mem.WriteByte((uint)tmp + offs_jmp[1], BitConverter.GetBytes(0x005014A3 - ((uint)tmp + offs_jmp[1] + 4)), 4); mem.WriteByte((uint)tmp + offs_jmp[2], BitConverter.GetBytes(0x004E24C9 - ((uint)tmp + offs_jmp[2] + 4)), 4); //JNP mem.WriteByte((uint)tmp + offs_jnp, BitConverter.GetBytes(0x0050171F - ((uint)tmp + offs_jnp + 4)), 4); //CMP, MOV PTR_NET_PED = (uint)((uint)tmp + inj_ptr_trc.Length); PTR_NET_VEH = PTR_NET_PED + 4; mem.WriteByte((uint)tmp + offs_cmp[0], BitConverter.GetBytes(PTR_NET_PED), 4); mem.WriteByte((uint)tmp + offs_cmp[1], BitConverter.GetBytes(PTR_NET_VEH), 4); mem.WriteByte((uint)tmp + offs_cmp[2], BitConverter.GetBytes(PTR_NET_PED), 4); mem.WriteByte((uint)tmp + offs_cmp[3], BitConverter.GetBytes(PTR_NET_PED), 4); mem.WriteByte((uint)tmp + offs_cmp[4], BitConverter.GetBytes(PTR_NET_VEH), 4); mem.WriteByte((uint)tmp + offs_cmp[5], BitConverter.GetBytes(PTR_NET_VEH), 4); //Code injection end sock = client.Client; thd = new Thread(new ThreadStart(NetRec)); thd.Start(); thd2 = new Thread(new ThreadStart(NetSend)); thd2.Start(); }